private ContainerInfo updateWithAppServerInfo( ContainerInfo appServerInfo, int clusterPortOffset) { try { String appServerContextRootStr = isRelative(testContext.getTestClass()) ? getAuthServerContextRoot(clusterPortOffset) : getAppServerContextRoot(clusterPortOffset); appServerInfo.setContextRoot(new URL(appServerContextRootStr)); } catch (MalformedURLException ex) { throw new IllegalArgumentException(ex); } return appServerInfo; }
public void updateTestContextWithAppServerInfo(@Observes(precedence = 1) BeforeClass event) { testContext = testContextProducer.get(); String appServerQualifier = getAppServerQualifier(testContext.getTestClass()); for (ContainerInfo container : testContext.getSuiteContext().getContainers()) { if (container.getQualifier().equals(appServerQualifier)) { testContext.setAppServerInfo(updateWithAppServerInfo(container)); } } // validate app server if (appServerQualifier != null && testContext.getAppServerInfo() == null) { throw new RuntimeException( String.format( "No app server container matching '%s' was activated. Check if defined and enabled in arquillian.xml.", appServerQualifier)); } log.info("\n\n" + testContext); }