use of org.jboss.arquillian.container.test.api.RunAsClient in project wildfly by wildfly.
the class WSTrustTestCase method testNoSignatureUsername.
/**
* No SIGNATURE_USERNAME is provided to the service. Service will use the
* client's keystore alias in its place.
*
* @throws Exception
*/
@Test
@RunAsClient
@OperateOnDeployment(SERVER_DEP)
@WrapThreadContextClassLoader
public void testNoSignatureUsername() throws Exception {
Bus bus = BusFactory.newInstance().createBus();
try {
BusFactory.setThreadDefaultBus(bus);
final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");
final URL wsdlURL = new URL(serviceURL + "SecurityService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
final QName stsServiceName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "SecurityTokenService");
final QName stsPortName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "UT_Port");
URL stsURL = new URL(serviceURL.getProtocol(), serviceURL.getHost(), serviceURL.getPort(), "/jaxws-samples-wsse-policy-trust-sts/SecurityTokenService?wsdl");
WSTrustTestUtils.setupWsseAndSTSClientNoSignatureUsername(proxy, bus, stsURL.toString(), stsServiceName, stsPortName);
assertEquals("WS-Trust Hello World!", proxy.sayHello());
} finally {
bus.shutdown(true);
}
}
use of org.jboss.arquillian.container.test.api.RunAsClient in project wildfly by wildfly.
the class ContainerInterceptorsTestCase method testDataPassingForContainerInterceptorsOnRemoteView.
/**
* Tests that the container-interceptor(s) have access to the data that's passed by a remote client via the
* {@link javax.interceptor.InvocationContext#getContextData()}
*/
@Test
// force real remote invocation so that the RemotingConnectionEJBReceiver is used instead of a LocalEJBReceiver
@RunAsClient
public void testDataPassingForContainerInterceptorsOnRemoteView() 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>();
interceptorData.put(FlowTrackingBean.CONTEXT_DATA_KEY, ContainerInterceptorOne.class.getName());
final SimpleEJBClientInterceptor clientInterceptor = new SimpleEJBClientInterceptor(interceptorData);
// get hold of the EJBClientContext and register the client side interceptor
EJBClientContext ejbClientContext = EJBClientContext.getCurrent().withAddedInterceptors(clientInterceptor);
final Hashtable<String, Object> jndiProps = new Hashtable<String, Object>();
jndiProps.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
final Context jndiCtx = new InitialContext(jndiProps);
ejbClientContext.runCallable(() -> {
final FlowTracker bean = (FlowTracker) jndiCtx.lookup("ejb:/" + EJB_JAR_NAME + "/" + FlowTrackingBean.class.getSimpleName() + "!" + FlowTracker.class.getName());
final String message = "foo";
// we passed ContainerInterceptorOne as the value of the context data for the invocation, which means that we want the ContainerInterceptorOne
// to be skipped, so except that interceptor, the rest should be invoked.
final String expectedResultForFirstInvocation = NonContainerInterceptor.class.getName() + " " + FlowTrackingBean.class.getName() + " " + message;
final String firstResult = bean.echo(message);
Assert.assertEquals("Unexpected result invoking on bean when passing context data via EJB client interceptor", expectedResultForFirstInvocation, firstResult);
// Now try another invocation, this time skip a different interceptor
interceptorData.clear();
interceptorData.put(FlowTrackingBean.CONTEXT_DATA_KEY, NonContainerInterceptor.class.getName());
final String secondMessage = "bar";
// we passed NonContainerInterceptor as the value of the context data for the invocation, which means that we want the NonContainerInterceptor
// to be skipped, so except that interceptor, the rest should be invoked.
final String expectedResultForSecondInvocation = ContainerInterceptorOne.class.getName() + " " + FlowTrackingBean.class.getName() + " " + secondMessage;
final String secondResult = bean.echo(secondMessage);
Assert.assertEquals("Unexpected result invoking on bean when passing context data via EJB client interceptor", expectedResultForSecondInvocation, secondResult);
return null;
});
}
use of org.jboss.arquillian.container.test.api.RunAsClient in project wildfly by wildfly.
the class TestsuiteSanityTestCase method testSystemPropertiesClient.
@Test
@RunAsClient
public void testSystemPropertiesClient() throws Exception {
for (String var : EXPECTED_PROPS) {
String path = System.getProperty(var);
Assert.assertNotNull("Property " + var + " is not set (outside container).", path);
File dir = new File(path);
Assert.assertTrue("Directory " + dir.getAbsolutePath() + " doesn't exist, check Surefire's system property " + var, dir.exists());
}
}
use of org.jboss.arquillian.container.test.api.RunAsClient in project wildfly by wildfly.
the class TwoModulesOfDifferentTypeTestCase 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);
}
use of org.jboss.arquillian.container.test.api.RunAsClient in project deltaspike by apache.
the class NavigationParameterTest method testNavigationActionIndex.
@Test
@RunAsClient
public void testNavigationActionIndex() throws MalformedURLException {
driver.get(new URL(contextPath, "origin.xhtml").toString());
WebElement button = driver.findElement(By.id("parameter:pb005Index"));
button.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("indexPage"), "You arrived at index page").apply(driver));
System.out.println(driver.getCurrentUrl());
Assert.assertTrue(driver.getCurrentUrl().contains("param1=staticValue2"));
}
Aggregations