use of org.jboss.eap.additional.testsuite.annotations.ATTest in project eap-additional-testsuite by jboss-set.
the class MarshallingTestCase method deserializationTest.
@ATTest({ "modules/testcases/jdkAll/Wildfly/core/src/main/java#10.0.0.Final*11.0.0.Beta1" })
public void deserializationTest() throws Exception {
RiverMarshallerFactory factory = new RiverMarshallerFactory();
MarshallingConfiguration configuration = new MarshallingConfiguration();
configuration.setVersion(2);
// Create a marshaller on some stream we have
RiverMarshaller marshaller = (RiverMarshaller) factory.createMarshaller(configuration);
final ByteArrayOutputStream fileOutputStream = new ByteArrayOutputStream();
marshaller.start(new OutputStreamByteOutput(fileOutputStream));
Bar bar = new Bar("Hello");
Foo foo = new Foo(bar);
// Write lots of stuff
marshaller.writeObject(foo);
// Done
marshaller.finish();
RiverUnmarshaller unmarshaller = (RiverUnmarshaller) factory.createUnmarshaller(configuration);
ByteArrayInputStream fileInputStream = new ByteArrayInputStream(fileOutputStream.toByteArray());
unmarshaller.start(new InputStreamByteInput(fileInputStream));
try {
Foo f = unmarshaller.readObject(Foo.class);
Assert.assertEquals(f.bar.aString, "Hello");
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
}
unmarshaller.finish();
}
use of org.jboss.eap.additional.testsuite.annotations.ATTest in project eap-additional-testsuite by jboss-set.
the class StatefulFailoverTestCase method noFailover.
/**
* Validates that a @Stateful(passivationCapable=false) bean does not replicate
*/
@ATTest({ "modules/testcases/jdkAll/Wildfly/clustering/src/main/java#10.0.0.Final*11.0.0.Final", "modules/testcases/jdkAll/Eap7/clustering/src/main/java", "modules/testcases/jdkAll/Eap71x-Proposed/clustering/src/main/java", "modules/testcases/jdkAll/Eap71x/clustering/src/main/java" })
public void noFailover(@ArquillianResource() @OperateOnDeployment(DEPLOYMENT_1) URL baseURL1, @ArquillianResource() @OperateOnDeployment(DEPLOYMENT_2) URL baseURL2) throws Exception {
URI uri1 = StatefulServlet.createURI(baseURL1, MODULE_NAME, PassivationIncapableIncrementorBean.class.getSimpleName());
URI uri2 = StatefulServlet.createURI(baseURL2, MODULE_NAME, PassivationIncapableIncrementorBean.class.getSimpleName());
try (CloseableHttpClient client = TestHttpClientUtils.promiscuousCookieHttpClient()) {
assertEquals(1, queryCount(client, uri1));
assertEquals(2, queryCount(client, uri1));
assertEquals(0, queryCount(client, uri2));
undeploy(DEPLOYMENT_2);
assertEquals(1, queryCount(client, uri1));
assertEquals(2, queryCount(client, uri1));
deploy(DEPLOYMENT_2);
assertEquals(3, queryCount(client, uri1));
assertEquals(4, queryCount(client, uri1));
assertEquals(0, queryCount(client, uri2));
undeploy(DEPLOYMENT_1);
assertEquals(1, queryCount(client, uri2));
assertEquals(2, queryCount(client, uri2));
deploy(DEPLOYMENT_1);
assertEquals(0, queryCount(client, uri1));
}
}
use of org.jboss.eap.additional.testsuite.annotations.ATTest in project eap-additional-testsuite by jboss-set.
the class StatefulWithXPCFailoverTestCase method testBasicXPC.
@ATTest({ "modules/testcases/jdkAll/Wildfly/clustering/src/main/java#10.0.0.Final*11.0.0.Final", "modules/testcases/jdkAll/Eap72x/clustering/src/main/java", "modules/testcases/jdkAll/Eap72x-Proposed/clustering/src/main/java", "modules/testcases/jdkAll/Eap7/clustering/src/main/java", "modules/testcases/jdkAll/Eap71x-Proposed/clustering/src/main/java", "modules/testcases/jdkAll/Eap71x/clustering/src/main/java" })
public void testBasicXPC(@ArquillianResource() @OperateOnDeployment(DEPLOYMENT_1) URL baseURL1, @ArquillianResource() @OperateOnDeployment(DEPLOYMENT_2) URL baseURL2) throws IOException, URISyntaxException {
URI xpc1_create_url = StatefulServlet.createEmployeeURI(baseURL1);
URI xpc1_get_url = StatefulServlet.getEmployeeURI(baseURL1);
URI xpc2_get_url = StatefulServlet.getEmployeeURI(baseURL2);
URI xpc1_getempsecond_url = StatefulServlet.get2ndBeanEmployeeURI(baseURL1);
URI xpc2_getempsecond_url = StatefulServlet.get2ndBeanEmployeeURI(baseURL2);
URI xpc2_getdestroy_url = StatefulServlet.destroyURI(baseURL2);
try (CloseableHttpClient client = TestHttpClientUtils.promiscuousCookieHttpClient()) {
stop(CONTAINER_2);
// extended persistence context is available on node1
log.trace(new Date() + "create employee entity ");
String employeeName = executeUrlWithAnswer(client, xpc1_create_url, "create entity that lives in the extended persistence context that this test will verify is always available");
assertEquals(employeeName, "Tom Brady");
log.trace(new Date() + "1. about to read entity on node1");
// ensure that we can get it from node 1
employeeName = executeUrlWithAnswer(client, xpc1_get_url, "1. xpc on node1, node1 should be able to read entity on node1");
assertEquals(employeeName, "Tom Brady");
employeeName = executeUrlWithAnswer(client, xpc1_getempsecond_url, "1. xpc on node1, node1 should be able to read entity from second bean on node1");
assertEquals(employeeName, "Tom Brady");
start(CONTAINER_2);
log.trace(new Date() + "2. started node2 + deployed, about to read entity on node1");
employeeName = executeUrlWithAnswer(client, xpc2_get_url, "2. started node2, xpc on node1, node1 should be able to read entity on node1");
assertEquals(employeeName, "Tom Brady");
employeeName = executeUrlWithAnswer(client, xpc2_getempsecond_url, "2. started node2, xpc on node1, node1 should be able to read entity from second bean on node1");
assertEquals(employeeName, "Tom Brady");
// failover to deployment2
// failover #1 to node 2
stop(CONTAINER_1);
log.trace(new Date() + "3. stopped node1 to force failover, about to read entity on node2");
employeeName = executeUrlWithAnswer(client, xpc2_get_url, "3. stopped deployment on node1, xpc should failover to node2, node2 should be able to read entity from xpc");
assertEquals(employeeName, "Tom Brady");
employeeName = executeUrlWithAnswer(client, xpc2_getempsecond_url, "3. stopped deployment on node1, xpc should failover to node2, node2 should be able to read entity from xpc that is on node2 (second bean)");
assertEquals(employeeName, "Tom Brady");
String destroyed = executeUrlWithAnswer(client, xpc2_getdestroy_url, "4. destroy the bean on node2");
assertEquals(destroyed, "DESTROY");
log.trace(new Date() + "4. test is done");
}
}
use of org.jboss.eap.additional.testsuite.annotations.ATTest in project eap-additional-testsuite by jboss-set.
the class SecurityTestCase method testUnsuccessfulAuthorization.
@ATTest({ "modules/testcases/jdkAll/Wildfly/messaging/src/main/java#11.0.0*14.0.0.Beta2" })
public void testUnsuccessfulAuthorization() throws Exception {
final String queueName = "queue.testUnsuccessfulAuthorization";
final ClientSessionFactory sf = createClientSessionFactory(managementClient.getMgmtAddress(), managementClient.getWebUri().getPort());
ClientSession session = null;
try {
session = sf.createSession("guest", "guest", false, true, true, false, 1);
session.createQueue(queueName, queueName, true);
fail("Must not create a durable queue without the CREATE_DURABLE_QUEUE permission");
} catch (ActiveMQException e) {
assertEquals(ActiveMQExceptionType.SECURITY_EXCEPTION, e.getType());
assertTrue(e.getMessage().startsWith("AMQ119032") || e.getMessage().startsWith("AMQ229032"));
assertTrue(e.getMessage().contains(CheckType.CREATE_DURABLE_QUEUE.toString()));
} finally {
if (session != null) {
session.close();
}
}
}
use of org.jboss.eap.additional.testsuite.annotations.ATTest in project eap-additional-testsuite by jboss-set.
the class LoggingProfilesTestCase method separateApplicationLoggingTest.
@RunAsClient
@ATTest({ "modules/testcases/jdkAll/Wildfly/logging/src/main/java#12.0.0.Final", "modules/testcases/jdkAll/WildflyRelease-17.0.0.Final/logging/src/main/java", "modules/testcases/jdkAll/Eap7/logging/src/main/java#7.1.0.GA", "modules/testcases/jdkAll/Eap71x/logging/src/main/java#7.1.1.GA", "modules/testcases/jdkAll/Eap71x-Proposed/logging/src/main/java#7.1.1.GA" })
@Test
public void separateApplicationLoggingTest() throws Exception {
URL testURL = new URL("http://" + managementClient.getMgmtAddress() + ":8080/Application1");
CloseableHttpClient httpClient = HttpClients.createDefault();
final HttpGet request = new HttpGet(testURL.toString());
CloseableHttpResponse response = null;
response = httpClient.execute(request);
testURL = new URL("http://" + managementClient.getMgmtAddress() + ":8080/Application2");
httpClient = HttpClients.createDefault();
final HttpGet request2 = new HttpGet(testURL.toString());
response = httpClient.execute(request2);
List<String> logfile = new LinkedList<>();
final String logDir = System.getProperty("server.dir") + "/standalone/log";
if (logDir == null) {
throw new RuntimeException("Could not resolve jboss.server.log.dir");
}
final java.nio.file.Path logFile = Paths.get(logDir, "myapp1.log");
if (!Files.notExists(logFile)) {
logfile = Files.readAllLines(logFile, StandardCharsets.UTF_8);
}
assertTrue("Should not have messages from second App...", !StringUtils.join(logfile, ", ").contains("Application 2"));
}
Aggregations