|
| 1 | +package org.ocpsoft.rewrite.annotation.query; |
| 2 | + |
| 3 | +import static junit.framework.Assert.assertTrue; |
| 4 | +import static org.junit.Assert.assertEquals; |
| 5 | + |
| 6 | +import org.apache.http.client.methods.HttpGet; |
| 7 | +import org.jboss.arquillian.container.test.api.Deployment; |
| 8 | +import org.jboss.arquillian.junit.Arquillian; |
| 9 | +import org.jboss.shrinkwrap.api.asset.StringAsset; |
| 10 | +import org.jboss.shrinkwrap.api.spec.WebArchive; |
| 11 | +import org.junit.Ignore; |
| 12 | +import org.junit.Test; |
| 13 | +import org.junit.runner.RunWith; |
| 14 | +import org.ocpsoft.rewrite.annotation.RewriteAnnotationTest; |
| 15 | +import org.ocpsoft.rewrite.test.HttpAction; |
| 16 | +import org.ocpsoft.rewrite.test.RewriteTest; |
| 17 | +import org.ocpsoft.rewrite.test.RewriteTestBase; |
| 18 | + |
| 19 | +@RunWith(Arquillian.class) |
| 20 | +public class QueryParameterTest extends RewriteTestBase |
| 21 | +{ |
| 22 | + |
| 23 | + @Deployment(testable = false) |
| 24 | + public static WebArchive getDeployment() |
| 25 | + { |
| 26 | + return RewriteTest.getDeploymentWithCDI() |
| 27 | + .addAsLibrary(RewriteAnnotationTest.getRewriteAnnotationArchive()) |
| 28 | + .addAsLibrary(RewriteAnnotationTest.getRewriteCdiArchive()) |
| 29 | + .addClass(QueryParameterBean.class) |
| 30 | + .addAsWebResource(new StringAsset( |
| 31 | + "Log: [${queryParameterBean.value}], ${request.parameterMap['q']}"), |
| 32 | + "query.jsp"); |
| 33 | + } |
| 34 | + |
| 35 | + @Test |
| 36 | + @Ignore |
| 37 | + public void testQueryParameter() throws Exception |
| 38 | + { |
| 39 | + HttpAction<HttpGet> action = get("/query?q=foo"); |
| 40 | + assertEquals(200, action.getStatusCode()); |
| 41 | + assertTrue(action.getResponseContent().contains("Log: [foo]")); |
| 42 | + } |
| 43 | + |
| 44 | +} |
0 commit comments