Commit 6f0de5076fc837ca0588594d5bb387d02cd72c03
1 parent
04b1bc7d
Exists in
master
Reativando os testes que estavam desativados
Showing
3 changed files
with
89 additions
and
93 deletions
Show diff stats
impl/extension/servlet/src/test/java/producer/request/HttpServletRequestProducerTest.java
... | ... | @@ -14,14 +14,12 @@ import org.jboss.arquillian.container.test.api.Deployment; |
14 | 14 | import org.jboss.arquillian.junit.Arquillian; |
15 | 15 | import org.jboss.arquillian.test.api.ArquillianResource; |
16 | 16 | import org.jboss.shrinkwrap.api.spec.WebArchive; |
17 | -import org.junit.Ignore; | |
18 | 17 | import org.junit.Test; |
19 | 18 | import org.junit.runner.RunWith; |
20 | 19 | |
21 | 20 | import test.Tests; |
22 | 21 | |
23 | 22 | @RunWith(Arquillian.class) |
24 | -@Ignore | |
25 | 23 | public class HttpServletRequestProducerTest { |
26 | 24 | |
27 | 25 | private static final String PATH = "src/test/resources/producer/request"; | ... | ... |
impl/extension/servlet/src/test/java/producer/response/HttpServletResponseProducerTest.java
... | ... | @@ -14,7 +14,6 @@ import org.jboss.arquillian.container.test.api.Deployment; |
14 | 14 | import org.jboss.arquillian.junit.Arquillian; |
15 | 15 | import org.jboss.arquillian.test.api.ArquillianResource; |
16 | 16 | import org.jboss.shrinkwrap.api.spec.WebArchive; |
17 | -import org.junit.Ignore; | |
18 | 17 | import org.junit.Test; |
19 | 18 | import org.junit.runner.RunWith; |
20 | 19 | |
... | ... | @@ -22,7 +21,6 @@ import producer.request.HelperServlet; |
22 | 21 | import test.Tests; |
23 | 22 | |
24 | 23 | @RunWith(Arquillian.class) |
25 | -@Ignore | |
26 | 24 | public class HttpServletResponseProducerTest { |
27 | 25 | |
28 | 26 | private static final String PATH = "src/test/resources/producer/response"; | ... | ... |
impl/extension/servlet/src/test/java/security/authentication/form/ServletAuthenticatorTest.java
1 | -//package security.authentication.form; | |
2 | -// | |
3 | -//import static org.apache.http.HttpStatus.SC_FORBIDDEN; | |
4 | -//import static org.apache.http.HttpStatus.SC_OK; | |
5 | -//import static org.apache.http.HttpStatus.SC_UNAUTHORIZED; | |
6 | -//import static org.junit.Assert.assertEquals; | |
7 | -// | |
8 | -//import java.io.IOException; | |
9 | -//import java.net.URISyntaxException; | |
10 | -//import java.net.URL; | |
11 | -// | |
12 | -//import org.apache.http.HttpResponse; | |
13 | -//import org.apache.http.client.ClientProtocolException; | |
14 | -//import org.apache.http.client.methods.HttpGet; | |
15 | -//import org.apache.http.client.utils.URIBuilder; | |
16 | -//import org.apache.http.impl.client.HttpClientBuilder; | |
17 | -//import org.jboss.arquillian.container.test.api.Deployment; | |
18 | -//import org.jboss.arquillian.junit.Arquillian; | |
19 | -//import org.jboss.arquillian.test.api.ArquillianResource; | |
20 | -//import org.jboss.shrinkwrap.api.spec.WebArchive; | |
21 | -//import org.junit.Test; | |
22 | -//import org.junit.runner.RunWith; | |
23 | -// | |
24 | -//import test.Tests; | |
25 | -// | |
26 | -//@RunWith(Arquillian.class) | |
27 | -//public class ServletAuthenticatorTest { | |
28 | -// | |
29 | -// private static final String PATH = "src/test/resources/security/authentication/form"; | |
30 | -// | |
31 | -// @ArquillianResource | |
32 | -// private URL deploymentUrl; | |
33 | -// | |
34 | -// @Deployment(testable = false) | |
35 | -// public static WebArchive createDeployment() { | |
36 | -// return Tests.createDeployment().addClasses(HelperServlet.class) | |
37 | -// .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml"); | |
38 | -// } | |
39 | -// | |
40 | -// @Test | |
41 | -// public void loginSucessfull() throws ClientProtocolException, IOException, URISyntaxException { | |
42 | -// URIBuilder uriBuilder = new URIBuilder(deploymentUrl + "/helper/login"); | |
43 | -// uriBuilder.setParameter("username", "demoiselle"); | |
44 | -// uriBuilder.setParameter("password", "changeit"); | |
45 | -// | |
46 | -// HttpGet httpGet = new HttpGet(uriBuilder.build()); | |
47 | -// HttpResponse httpResponse = HttpClientBuilder.create().build().execute(httpGet); | |
48 | -// | |
49 | -// int status = httpResponse.getStatusLine().getStatusCode(); | |
50 | -// assertEquals(SC_OK, status); | |
51 | -// } | |
52 | -// | |
53 | -// @Test | |
54 | -// public void loginFailed() throws ClientProtocolException, IOException, URISyntaxException { | |
55 | -// URIBuilder uriBuilder = new URIBuilder(deploymentUrl + "/helper/login"); | |
56 | -// uriBuilder.setParameter("username", "invalid"); | |
57 | -// uriBuilder.setParameter("password", "invalid"); | |
58 | -// | |
59 | -// HttpGet get = new HttpGet(uriBuilder.build()); | |
60 | -// HttpResponse response = HttpClientBuilder.create().build().execute(get); | |
61 | -// | |
62 | -// int status = response.getStatusLine().getStatusCode(); | |
63 | -// assertEquals(SC_FORBIDDEN, status); | |
64 | -// } | |
65 | -// | |
66 | -// @Test | |
67 | -// public void logoutSucessfull() throws ClientProtocolException, IOException, URISyntaxException { | |
68 | -// URIBuilder uriBuilder = new URIBuilder(deploymentUrl + "/helper/logout"); | |
69 | -// uriBuilder.setParameter("username", "demoiselle"); | |
70 | -// uriBuilder.setParameter("password", "changeit"); | |
71 | -// | |
72 | -// HttpGet httpGet = new HttpGet(uriBuilder.build()); | |
73 | -// HttpResponse httpResponse = HttpClientBuilder.create().build().execute(httpGet); | |
74 | -// | |
75 | -// int status = httpResponse.getStatusLine().getStatusCode(); | |
76 | -// assertEquals(SC_OK, status); | |
77 | -// } | |
78 | -// | |
79 | -// @Test | |
80 | -// public void logoutFailedByNotLoggedInException() throws ClientProtocolException, IOException, URISyntaxException { | |
81 | -// URIBuilder uriBuilder = new URIBuilder(deploymentUrl + "/helper/logout"); | |
82 | -// | |
83 | -// HttpGet httpGet = new HttpGet(uriBuilder.build()); | |
84 | -// HttpResponse httpResponse = HttpClientBuilder.create().build().execute(httpGet); | |
85 | -// | |
86 | -// int status = httpResponse.getStatusLine().getStatusCode(); | |
87 | -// assertEquals(SC_UNAUTHORIZED, status); | |
88 | -// } | |
89 | -//} | |
1 | +package security.authentication.form; | |
2 | + | |
3 | +import static org.apache.http.HttpStatus.SC_FORBIDDEN; | |
4 | +import static org.apache.http.HttpStatus.SC_OK; | |
5 | +import static org.apache.http.HttpStatus.SC_UNAUTHORIZED; | |
6 | +import static org.junit.Assert.assertEquals; | |
7 | + | |
8 | +import java.io.IOException; | |
9 | +import java.net.URISyntaxException; | |
10 | +import java.net.URL; | |
11 | + | |
12 | +import org.apache.http.HttpResponse; | |
13 | +import org.apache.http.client.ClientProtocolException; | |
14 | +import org.apache.http.client.methods.HttpGet; | |
15 | +import org.apache.http.client.utils.URIBuilder; | |
16 | +import org.apache.http.impl.client.HttpClientBuilder; | |
17 | +import org.jboss.arquillian.container.test.api.Deployment; | |
18 | +import org.jboss.arquillian.junit.Arquillian; | |
19 | +import org.jboss.arquillian.test.api.ArquillianResource; | |
20 | +import org.jboss.shrinkwrap.api.spec.WebArchive; | |
21 | +import org.junit.Test; | |
22 | +import org.junit.runner.RunWith; | |
23 | + | |
24 | +import test.Tests; | |
25 | + | |
26 | +@RunWith(Arquillian.class) | |
27 | +public class ServletAuthenticatorTest { | |
28 | + | |
29 | + private static final String PATH = "src/test/resources/security/authentication/form"; | |
30 | + | |
31 | + @ArquillianResource | |
32 | + private URL deploymentUrl; | |
33 | + | |
34 | + @Deployment(testable = false) | |
35 | + public static WebArchive createDeployment() { | |
36 | + return Tests.createDeployment().addClasses(HelperServlet.class) | |
37 | + .addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml"); | |
38 | + } | |
39 | + | |
40 | + @Test | |
41 | + public void loginSucessfull() throws ClientProtocolException, IOException, URISyntaxException { | |
42 | + URIBuilder uriBuilder = new URIBuilder(deploymentUrl + "/helper/login"); | |
43 | + uriBuilder.setParameter("username", "demoiselle"); | |
44 | + uriBuilder.setParameter("password", "changeit"); | |
45 | + | |
46 | + HttpGet httpGet = new HttpGet(uriBuilder.build()); | |
47 | + HttpResponse httpResponse = HttpClientBuilder.create().build().execute(httpGet); | |
48 | + | |
49 | + int status = httpResponse.getStatusLine().getStatusCode(); | |
50 | + assertEquals(SC_OK, status); | |
51 | + } | |
52 | + | |
53 | + @Test | |
54 | + public void loginFailed() throws ClientProtocolException, IOException, URISyntaxException { | |
55 | + URIBuilder uriBuilder = new URIBuilder(deploymentUrl + "/helper/login"); | |
56 | + uriBuilder.setParameter("username", "invalid"); | |
57 | + uriBuilder.setParameter("password", "invalid"); | |
58 | + | |
59 | + HttpGet get = new HttpGet(uriBuilder.build()); | |
60 | + HttpResponse response = HttpClientBuilder.create().build().execute(get); | |
61 | + | |
62 | + int status = response.getStatusLine().getStatusCode(); | |
63 | + assertEquals(SC_FORBIDDEN, status); | |
64 | + } | |
65 | + | |
66 | + @Test | |
67 | + public void logoutSucessfull() throws ClientProtocolException, IOException, URISyntaxException { | |
68 | + URIBuilder uriBuilder = new URIBuilder(deploymentUrl + "/helper/logout"); | |
69 | + uriBuilder.setParameter("username", "demoiselle"); | |
70 | + uriBuilder.setParameter("password", "changeit"); | |
71 | + | |
72 | + HttpGet httpGet = new HttpGet(uriBuilder.build()); | |
73 | + HttpResponse httpResponse = HttpClientBuilder.create().build().execute(httpGet); | |
74 | + | |
75 | + int status = httpResponse.getStatusLine().getStatusCode(); | |
76 | + assertEquals(SC_OK, status); | |
77 | + } | |
78 | + | |
79 | + @Test | |
80 | + public void logoutFailedByNotLoggedInException() throws ClientProtocolException, IOException, URISyntaxException { | |
81 | + URIBuilder uriBuilder = new URIBuilder(deploymentUrl + "/helper/logout"); | |
82 | + | |
83 | + HttpGet httpGet = new HttpGet(uriBuilder.build()); | |
84 | + HttpResponse httpResponse = HttpClientBuilder.create().build().execute(httpGet); | |
85 | + | |
86 | + int status = httpResponse.getStatusLine().getStatusCode(); | |
87 | + assertEquals(SC_UNAUTHORIZED, status); | |
88 | + } | |
89 | +} | ... | ... |