-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5edba1b
commit ec4ad27
Showing
10 changed files
with
44 additions
and
260 deletions.
There are no files selected for viewing
29 changes: 0 additions & 29 deletions
29
examples/permissive/src/test/java/org/jboss/shamrock/example/test/JaxRSITCase.java
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
examples/permissive/src/test/java/org/jboss/shamrock/example/test/JaxRSInjectionITCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.jboss.shamrock.example.test; | ||
|
||
import org.jboss.shamrock.junit.GraalTest; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(GraalTest.class) | ||
public class JaxRSInjectionITCase extends JaxRSInjectionTestCase { | ||
|
||
} |
51 changes: 1 addition & 50 deletions
51
examples/permissive/src/test/java/org/jboss/shamrock/example/test/OpenApiITCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,12 @@ | ||
package org.jboss.shamrock.example.test; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.ByteArrayOutputStream; | ||
import java.io.InputStream; | ||
import java.net.URL; | ||
import java.net.URLConnection; | ||
import java.util.Set; | ||
|
||
import javax.json.Json; | ||
import javax.json.JsonObject; | ||
import javax.json.JsonReader; | ||
|
||
import org.jboss.shamrock.junit.GraalTest; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
/** | ||
* @author Ken Finnigan | ||
*/ | ||
@RunWith(GraalTest.class) | ||
public class OpenApiITCase { | ||
|
||
@Test | ||
public void testOpenAPIJSON() throws Exception { | ||
URL uri = new URL("http://localhost:8080/openapi"); | ||
URLConnection connection = uri.openConnection(); | ||
connection.setRequestProperty("Accept", "application/json"); | ||
InputStream in = connection.getInputStream(); | ||
byte[] buf = new byte[100]; | ||
int r; | ||
ByteArrayOutputStream out = new ByteArrayOutputStream(); | ||
while ((r = in.read(buf)) > 0) { | ||
out.write(buf, 0, r); | ||
} | ||
JsonReader parser = Json.createReader(new ByteArrayInputStream(out.toByteArray())); | ||
JsonObject obj = parser.readObject(); | ||
Assert.assertNotNull(obj); | ||
|
||
Assert.assertEquals("3.0.1", obj.getString("openapi")); | ||
Assert.assertEquals("Generated API", obj.getJsonObject("info").getString("title")); | ||
Assert.assertEquals("1.0", obj.getJsonObject("info").getString("version")); | ||
|
||
JsonObject paths = obj.getJsonObject("paths"); | ||
Assert.assertEquals(2, paths.size()); | ||
|
||
JsonObject testObj = paths.getJsonObject("/rest/test"); | ||
Assert.assertNotNull(testObj); | ||
Set<String> keys = testObj.keySet(); | ||
Assert.assertEquals(1, keys.size()); | ||
Assert.assertEquals("get", keys.iterator().next()); | ||
|
||
public class OpenApiITCase extends OpenApiTestCase { | ||
|
||
JsonObject injectionObj = paths.getJsonObject("/rest/test/injection"); | ||
Assert.assertNotNull(injectionObj); | ||
keys = injectionObj.keySet(); | ||
Assert.assertEquals(1, keys.size()); | ||
Assert.assertEquals("get", keys.iterator().next()); | ||
} | ||
} |
22 changes: 1 addition & 21 deletions
22
...ples/permissive/src/test/java/org/jboss/shamrock/example/test/ServletInjectionITCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,9 @@ | ||
package org.jboss.shamrock.example.test; | ||
|
||
import java.io.ByteArrayOutputStream; | ||
import java.io.InputStream; | ||
import java.net.URL; | ||
import java.net.URLConnection; | ||
|
||
import org.jboss.shamrock.junit.GraalTest; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(GraalTest.class) | ||
public class ServletInjectionITCase { | ||
public class ServletInjectionITCase extends ServletInjectionTestCase { | ||
|
||
@Test | ||
public void testServletInjection() throws Exception { | ||
URL uri = new URL("http://localhost:8080/injection"); | ||
URLConnection connection = uri.openConnection(); | ||
InputStream in = connection.getInputStream(); | ||
byte[] buf = new byte[100]; | ||
int r; | ||
ByteArrayOutputStream out = new ByteArrayOutputStream(); | ||
while ((r = in.read(buf)) > 0) { | ||
out.write(buf, 0, r); | ||
} | ||
Assert.assertEquals("A message", new String(out.toByteArray())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
examples/strict/src/test/java/org/jboss/shamrock/example/test/ExternalIndexITCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.jboss.shamrock.example.test; | ||
|
||
import org.jboss.shamrock.junit.GraalTest; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(GraalTest.class) | ||
public class ExternalIndexITCase extends ExternalIndexTestCase { | ||
|
||
} |
27 changes: 1 addition & 26 deletions
27
...ples/strict/src/test/java/org/jboss/shamrock/example/test/JPAReflectionInGraalITCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,14 @@ | ||
package org.jboss.shamrock.example.test; | ||
|
||
import org.jboss.shamrock.junit.GraalTest; | ||
import org.jboss.shamrock.junit.ShamrockTest; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import java.io.ByteArrayOutputStream; | ||
import java.io.InputStream; | ||
import java.lang.reflect.Field; | ||
import java.lang.reflect.Method; | ||
import java.net.URL; | ||
import java.net.URLConnection; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
/** | ||
* Test reflection around JPA entities | ||
* | ||
* @author Emmanuel Bernard [email protected] | ||
*/ | ||
@RunWith(GraalTest.class) | ||
public class JPAReflectionInGraalITCase { | ||
public class JPAReflectionInGraalITCase extends JPAReflectionTestCase { | ||
|
||
@Test | ||
public void testFieldAndGetterReflectionOnEntityFromServlet() throws Exception { | ||
URL uri = new URL("http://localhost:8080/jpa/test"); | ||
URLConnection connection = uri.openConnection(); | ||
InputStream in = connection.getInputStream(); | ||
byte[] buf = new byte[100]; | ||
int r; | ||
ByteArrayOutputStream out = new ByteArrayOutputStream(); | ||
while ((r = in.read(buf)) > 0) { | ||
out.write(buf, 0, r); | ||
} | ||
assertEquals("OK", new String(out.toByteArray())); | ||
} | ||
} |
106 changes: 1 addition & 105 deletions
106
examples/strict/src/test/java/org/jboss/shamrock/example/test/JaxRSITCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,113 +1,9 @@ | ||
package org.jboss.shamrock.example.test; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.ByteArrayOutputStream; | ||
import java.io.InputStream; | ||
import java.net.URL; | ||
import java.net.URLConnection; | ||
|
||
import javax.json.Json; | ||
import javax.json.JsonObject; | ||
import javax.xml.parsers.DocumentBuilder; | ||
import javax.xml.parsers.DocumentBuilderFactory; | ||
|
||
import org.jboss.shamrock.junit.GraalTest; | ||
import org.jboss.shamrock.junit.ShamrockTest; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.w3c.dom.Document; | ||
import org.w3c.dom.Element; | ||
import org.w3c.dom.NodeList; | ||
|
||
@RunWith(GraalTest.class) | ||
public class JaxRSITCase { | ||
|
||
@Test | ||
public void testJAXRS() throws Exception { | ||
URL uri = new URL("http://localhost:8080/rest/test"); | ||
URLConnection connection = uri.openConnection(); | ||
InputStream in = connection.getInputStream(); | ||
byte[] buf = new byte[100]; | ||
int r; | ||
ByteArrayOutputStream out = new ByteArrayOutputStream(); | ||
while ((r = in.read(buf)) > 0) { | ||
out.write(buf, 0, r); | ||
} | ||
Assert.assertEquals("TEST", new String(out.toByteArray())); | ||
} | ||
|
||
@Test | ||
public void testJsonp() throws Exception { | ||
|
||
URL uri = new URL("http://localhost:8080/rest/test/jsonp"); | ||
URLConnection connection = uri.openConnection(); | ||
InputStream in = connection.getInputStream(); | ||
byte[] buf = new byte[100]; | ||
int r; | ||
ByteArrayOutputStream out = new ByteArrayOutputStream(); | ||
while ((r = in.read(buf)) > 0) { | ||
out.write(buf, 0, r); | ||
} | ||
JsonObject obj = Json.createReader(new ByteArrayInputStream(out.toByteArray())).readObject(); | ||
Assert.assertEquals("Stuart", obj.getString("name")); | ||
Assert.assertEquals("A Value", obj.getString("value")); | ||
} | ||
|
||
@Test | ||
public void testJackson() throws Exception { | ||
|
||
URL uri = new URL("http://localhost:8080/rest/test/jackson"); | ||
URLConnection connection = uri.openConnection(); | ||
InputStream in = connection.getInputStream(); | ||
byte[] buf = new byte[100]; | ||
int r; | ||
ByteArrayOutputStream out = new ByteArrayOutputStream(); | ||
while ((r = in.read(buf)) > 0) { | ||
out.write(buf, 0, r); | ||
} | ||
JsonObject obj = Json.createReader(new ByteArrayInputStream(out.toByteArray())).readObject(); | ||
Assert.assertEquals("Stuart", obj.getString("name")); | ||
Assert.assertEquals("A Value", obj.getString("value")); | ||
} | ||
|
||
|
||
@Test | ||
public void testJaxb() throws Exception { | ||
|
||
URL uri = new URL("http://localhost:8080/rest/test/xml"); | ||
URLConnection connection = uri.openConnection(); | ||
InputStream in = connection.getInputStream(); | ||
byte[] buf = new byte[100]; | ||
int r; | ||
ByteArrayOutputStream out = new ByteArrayOutputStream(); | ||
while ((r = in.read(buf)) > 0) { | ||
out.write(buf, 0, r); | ||
} | ||
DocumentBuilderFactory factory = | ||
DocumentBuilderFactory.newInstance(); | ||
DocumentBuilder builder = factory.newDocumentBuilder(); | ||
Document dom = builder.parse(new ByteArrayInputStream(out.toByteArray()) ); | ||
Element root = dom.getDocumentElement(); | ||
Assert.assertEquals("xmlObject", root.getTagName()); | ||
NodeList value = root.getElementsByTagName("value"); | ||
Assert.assertEquals(1, value.getLength()); | ||
Assert.assertEquals("A Value", value.item(0).getTextContent()); | ||
} | ||
|
||
|
||
@Test | ||
public void testBytecodeTransformation() throws Exception { | ||
public class JaxRSITCase extends JaxRSTestCase { | ||
|
||
URL uri = new URL("http://localhost:8080/rest/test/transformed"); | ||
URLConnection connection = uri.openConnection(); | ||
InputStream in = connection.getInputStream(); | ||
byte[] buf = new byte[100]; | ||
int r; | ||
ByteArrayOutputStream out = new ByteArrayOutputStream(); | ||
while ((r = in.read(buf)) > 0) { | ||
out.write(buf, 0, r); | ||
} | ||
Assert.assertEquals("Transformed Endpoint", new String(out.toByteArray())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters