Skip to content

Commit 698548f

Browse files
committed
Fixed tests to work around arquillian issue
1 parent d800206 commit 698548f

2 files changed

Lines changed: 18 additions & 6 deletions

File tree

‎integration-cdi/src/test/java/com/ocpsoft/rewrite/cdi/bridge/RewriteLifecycleEventObserver.java‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
import com.ocpsoft.rewrite.cdi.events.AfterInboundRewrite;
2828
import com.ocpsoft.rewrite.event.Rewrite;
29-
import com.ocpsoft.rewrite.servlet.event.RewriteBase.Flow;
3029
import com.ocpsoft.rewrite.servlet.http.event.HttpInboundServletRewrite;
3130
import com.ocpsoft.rewrite.servlet.http.event.HttpOutboundServletRewrite;
3231

@@ -61,7 +60,10 @@ public void rewriteOutbound(@Observes final HttpOutboundServletRewrite event)
6160

6261
public void rewriteInbound(@Observes final HttpInboundServletRewrite event)
6362
{
64-
if (!event.getFlow().is(Flow.HANDLED))
63+
String requestURL = event.getRequestURL();
64+
if ("/success".equals(requestURL))
65+
event.sendStatusCode(200);
66+
else if ("/outbound-rewritten".equals(requestURL))
6567
event.sendStatusCode(200);
6668
}
6769
}

‎test-harness/src/main/java/com/ocpsoft/rewrite/test/RewriteTestBase.java‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
*/
2424

2525
import java.io.File;
26+
import java.net.MalformedURLException;
2627
import java.net.URL;
2728
import java.util.Collection;
2829

@@ -35,7 +36,6 @@
3536
import org.apache.http.protocol.HttpContext;
3637
import org.jboss.arquillian.container.test.api.Deployment;
3738
import org.jboss.arquillian.junit.Arquillian;
38-
import org.jboss.arquillian.test.api.ArquillianResource;
3939
import org.jboss.shrinkwrap.api.ArchivePaths;
4040
import org.jboss.shrinkwrap.api.GenericArchive;
4141
import org.jboss.shrinkwrap.api.ShrinkWrap;
@@ -81,8 +81,8 @@ private static Collection<GenericArchive> resolveDependencies(final String coord
8181
.resolveAs(GenericArchive.class);
8282
}
8383

84-
@ArquillianResource
85-
URL baseURL;
84+
// @ArquillianResource
85+
// private URL baseURL;
8686

8787
/**
8888
* Request a resource from the deployed test-application. The {@link HttpServletRequest#getContextPath()} will be
@@ -95,7 +95,7 @@ protected HttpAction<HttpGet> get(final String path)
9595
DefaultHttpClient httpClient = new DefaultHttpClient();
9696
try
9797
{
98-
String url = baseURL.toExternalForm();
98+
String url = baseURL().toExternalForm();
9999
if (url.endsWith("/"))
100100
{
101101
url = url.substring(0, url.length() - 1);
@@ -114,4 +114,14 @@ protected HttpAction<HttpGet> get(final String path)
114114
throw new RuntimeException(e);
115115
}
116116
}
117+
118+
public URL baseURL()
119+
{
120+
try {
121+
return new URL("http://localhost:9090/rewrite-test/");
122+
}
123+
catch (MalformedURLException e) {
124+
throw new RuntimeException(e);
125+
}
126+
}
117127
}

0 commit comments

Comments
 (0)