use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class WSTrustTestCase method testNoClientCallback.
/**
* No CallbackHandler is provided in STSCLient. Username and password provided instead.
*
* @throws Exception
*/
@Test
@RunAsClient
@OperateOnDeployment(SERVER_DEP)
@WrapThreadContextClassLoader
public void testNoClientCallback() 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.setupWsseAndSTSClientNoCallbackHandler(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.OperateOnDeployment in project wildfly by wildfly.
the class WSTrustTestCase method testActAs.
/**
* Request a security token that allows it to act as if it were somebody else.
*
* @throws Exception
*/
@Test
@RunAsClient
@OperateOnDeployment(ACT_AS_SERVER_DEP)
@WrapThreadContextClassLoader
public void testActAs() throws Exception {
Bus bus = BusFactory.newInstance().createBus();
try {
BusFactory.setThreadDefaultBus(bus);
final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/actaswssecuritypolicy", "ActAsService");
final URL wsdlURL = new URL(serviceURL + "ActAsService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ActAsServiceIface proxy = (ActAsServiceIface) service.getPort(ActAsServiceIface.class);
WSTrustTestUtils.setupWsseAndSTSClientActAs((BindingProvider) proxy, bus);
assertEquals("ActAs WS-Trust Hello World!", proxy.sayHello(serviceURL.getHost(), String.valueOf(serviceURL.getPort())));
} finally {
bus.shutdown(true);
}
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class IIOPNamingInContainerDDNameTestCase method testIIOPNamingInvocationWithDDOverride.
/**
* <p>
* Tests the lookup of a bean that used the jboss-ejb3.xml deployment descriptor to override the COSNaming binding.
* So, insteand of looking for the standard test2/IIOPNamingBean context we will look for the configured
* bean/custom/name/IIOPNamingBean context.
* </p>
*
* @throws NamingException if an error occurs while looking up the bean.
* @throws RemoteException if an error occurs while invoking the remote bean.
*/
@Test
@OperateOnDeployment("test")
public void testIIOPNamingInvocationWithDDOverride() throws NamingException, RemoteException {
final Properties prope = new Properties();
final InitialContext context = new InitialContext(prope);
final Object iiopObj = context.lookup("corbaname:iiop:" + managementClient.getMgmtAddress() + ":3528#bean/custom/name/IIOPNamingBean");
final IIOPNamingHome object = (IIOPNamingHome) PortableRemoteObject.narrow(iiopObj, IIOPNamingHome.class);
final IIOPRemote result = object.create();
Assert.assertEquals("hello", result.hello());
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class IIOPNamingInContainerTestCase method testStatefulIIOPNamingInvocation.
@Test
@OperateOnDeployment("test")
public void testStatefulIIOPNamingInvocation() throws NamingException, RemoteException, RemoveException {
final Properties prope = new Properties();
final InitialContext context = new InitialContext(prope);
final Object iiopObj = context.lookup("corbaname:iiop:" + managementClient.getMgmtAddress() + ":3528#IIOPStatefulNamingBean");
final IIOPStatefulNamingHome object = (IIOPStatefulNamingHome) PortableRemoteObject.narrow(iiopObj, IIOPStatefulNamingHome.class);
final IIOPStatefulRemote result = object.create(10);
Assert.assertEquals(11, result.increment());
Assert.assertEquals(12, result.increment());
result.remove();
try {
result.increment();
Assert.fail("Expected NoSuchObjectException");
} catch (NoSuchObjectException expected) {
}
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class JAXBUsageTestCase method testJAXBServlet.
@OperateOnDeployment("app")
@Test
public void testJAXBServlet() throws Exception {
final HttpClient httpClient = new DefaultHttpClient();
final String xml = "dummy.xml";
final String requestURL = url.toExternalForm() + JAXBUsageServlet.URL_PATTERN;
final HttpGet request = new HttpGet(requestURL);
final HttpResponse response = httpClient.execute(request);
int statusCode = response.getStatusLine().getStatusCode();
Assert.assertEquals("Unexpected status code", 200, statusCode);
final HttpEntity entity = response.getEntity();
Assert.assertNotNull("Response message from servlet was null", entity);
final String responseMessage = EntityUtils.toString(entity);
Assert.assertEquals("Wrong return value", "Mill Valley", responseMessage.trim());
}
Aggregations