Search in sources :

Example 21 with RunAsClient

use of org.jboss.arquillian.container.test.api.RunAsClient in project deltaspike by apache.

the class NavigationParameterTest method testNavigationActionOverview.

@Test
@RunAsClient
public void testNavigationActionOverview() throws MalformedURLException {
    driver.get(new URL(contextPath, "origin.xhtml").toString());
    WebElement button = driver.findElement(By.id("parameter:pb005Overview"));
    button.click();
    Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("overviewPage"), "You arrived at overview page").apply(driver));
    System.out.println(driver.getCurrentUrl());
    Assert.assertTrue(driver.getCurrentUrl().contains("param1=staticValue2"));
    Assert.assertTrue(driver.getCurrentUrl().contains("param2=aValue"));
}
Also used : WebElement(org.openqa.selenium.WebElement) URL(java.net.URL) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 22 with RunAsClient

use of org.jboss.arquillian.container.test.api.RunAsClient in project wildfly by wildfly.

the class AnalyzerTransactionTimeoutTestCase method testTransactionTimeoutDisabled.

@Test
@RunAsClient
public void testTransactionTimeoutDisabled(@ArquillianResource URL url) throws Exception {
    final UrlBuilder builder = UrlBuilder.of(url, "start");
    builder.addParameter(StartBatchServlet.JOB_XML_PARAMETER, "analyzer-job");
    final String result = performCall(builder.build(), 20);
    final JobExecution jobExecution = JobExecutionMarshaller.unmarshall(result);
    assertEquals("COMPLETED", jobExecution.getBatchStatus().name());
}
Also used : JobExecution(javax.batch.runtime.JobExecution) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 23 with RunAsClient

use of org.jboss.arquillian.container.test.api.RunAsClient in project wildfly by wildfly.

the class ChunkPartitionTestCase method chunks.

@RunAsClient
@Test
public void chunks(@ArquillianResource final URL url) throws Exception {
    for (int i = 10; i >= 8; i--) {
        final UrlBuilder builder = UrlBuilder.of(url, "start");
        builder.addParameter(StartBatchServlet.JOB_XML_PARAMETER, "chunkPartition");
        builder.addParameter("thread.count", i);
        builder.addParameter("writer.sleep.time", 100);
        final String result = performCall(builder.build());
        final JobExecution jobExecution = JobExecutionMarshaller.unmarshall(result);
        Assert.assertEquals(BatchStatus.COMPLETED, jobExecution.getBatchStatus());
    // final String exitStatus = stepExecution0.getExitStatus();
    // Assert.assertTrue(exitStatus.startsWith("PASS"));
    }
    final UrlBuilder builder = UrlBuilder.of(url, "start");
    builder.addParameter(StartBatchServlet.JOB_XML_PARAMETER, "chunkPartition");
    builder.addParameter("thread.count", 1);
    builder.addParameter("skip.thread.check", "true");
    builder.addParameter("writer.sleep.time", 0);
    final String result = performCall(builder.build());
    final JobExecution jobExecution = JobExecutionMarshaller.unmarshall(result);
    Assert.assertEquals(BatchStatus.COMPLETED, jobExecution.getBatchStatus());
}
Also used : JobExecution(javax.batch.runtime.JobExecution) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 24 with RunAsClient

use of org.jboss.arquillian.container.test.api.RunAsClient in project wildfly by wildfly.

the class EJBClientInterceptorTestCase method testEJBClientInterceptionFromRemoteClient.

/**
     * @throws Exception
     */
@Test
// run as a truly remote client
@RunAsClient
public void testEJBClientInterceptionFromRemoteClient() throws Exception {
    // create some data that the client side interceptor will pass along during the EJB invocation
    final Map<String, Object> interceptorData = new HashMap<String, Object>();
    final String keyOne = "foo";
    final Object valueOne = "bar";
    final String keyTwo = "blah";
    final Object valueTwo = new Integer("12");
    interceptorData.put(keyOne, valueOne);
    interceptorData.put(keyTwo, valueTwo);
    final SimpleEJBClientInterceptor clientInterceptor = new SimpleEJBClientInterceptor(interceptorData);
    // get hold of the EJBClientContext and register the client side interceptor
    final EJBClientContext ejbClientContext = EJBClientContext.getCurrent().withAddedInterceptors(clientInterceptor);
    final Hashtable props = new Hashtable();
    props.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
    final Context jndiContext = new InitialContext(props);
    ejbClientContext.runCallable(() -> {
        final RemoteSFSB remoteSFSB = (RemoteSFSB) jndiContext.lookup("ejb:" + APP_NAME + "/" + MODULE_NAME + "/" + DISTINCT_NAME + "/" + SimpleSFSB.class.getSimpleName() + "!" + RemoteSFSB.class.getName() + "?stateful");
        // invoke the bean and ask it for the invocation data that it saw on the server side
        final Map<String, Object> valuesSeenOnServerSide = remoteSFSB.getInvocationData(keyOne, keyTwo);
        // make sure the server side bean was able to get the data which was passed on by the client side
        // interceptor
        Assert.assertNotNull("Server side context data was expected to be non-null", valuesSeenOnServerSide);
        Assert.assertFalse("Server side context data was expected to be non-empty", valuesSeenOnServerSide.isEmpty());
        for (final Map.Entry<String, Object> clientInterceptorDataEntry : interceptorData.entrySet()) {
            final String key = clientInterceptorDataEntry.getKey();
            final Object expectedValue = clientInterceptorDataEntry.getValue();
            Assert.assertEquals("Unexpected value in bean, on server side, via InvocationContext.getContextData() for key " + key, expectedValue, valuesSeenOnServerSide.get(key));
        }
        return null;
    });
}
Also used : InitialContext(javax.naming.InitialContext) Context(javax.naming.Context) EJBClientContext(org.jboss.ejb.client.EJBClientContext) HashMap(java.util.HashMap) Hashtable(java.util.Hashtable) EJBClientContext(org.jboss.ejb.client.EJBClientContext) InitialContext(javax.naming.InitialContext) HashMap(java.util.HashMap) Map(java.util.Map) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 25 with RunAsClient

use of org.jboss.arquillian.container.test.api.RunAsClient in project wildfly by wildfly.

the class TwoModulesFlatTestCase method testConnection2.

/**
     * Tests connection in pool
     *
     * @throws Exception in case of error
     */
@Test
@RunAsClient
public void testConnection2() throws Exception {
    final ModelNode address1 = ModuleAcDeploymentTestCaseSetup.address1.clone();
    address1.add("connection-definitions", cf1);
    address1.protect();
    final ModelNode operation1 = new ModelNode();
    operation1.get(OP).set("test-connection-in-pool");
    operation1.get(OP_ADDR).set(address1);
    executeOperation(operation1);
}
Also used : ModelNode(org.jboss.dmr.ModelNode) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Aggregations

RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)62 Test (org.junit.Test)61 URL (java.net.URL)49 WebElement (org.openqa.selenium.WebElement)34 QName (javax.xml.namespace.QName)9 Service (javax.xml.ws.Service)9 Bus (org.apache.cxf.Bus)9 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)9 WrapThreadContextClassLoader (org.jboss.as.test.integration.ws.WrapThreadContextClassLoader)9 IOException (java.io.IOException)6 ActAsServiceIface (org.jboss.as.test.integration.ws.wsse.trust.actas.ActAsServiceIface)6 OnBehalfOfServiceIface (org.jboss.as.test.integration.ws.wsse.trust.onbehalfof.OnBehalfOfServiceIface)6 HttpResponse (org.apache.http.HttpResponse)5 HttpGet (org.apache.http.client.methods.HttpGet)5 ServiceIface (org.jboss.as.test.integration.ws.wsse.trust.service.ServiceIface)5 ModelNode (org.jboss.dmr.ModelNode)5 InSequence (org.jboss.arquillian.junit.InSequence)4 Response (javax.ws.rs.core.Response)3 HashMap (java.util.HashMap)2 Hashtable (java.util.Hashtable)2