/** * */ ContainerListener() { ConfigurationManager cm = new ConfigurationManager(); systemType = cm.getProperty(EXAM_SYSTEM_KEY, EXAM_SYSTEM_TEST); }
/** * * @return packages to be loaded from system class loader */ private String[] getSystemPackages() { String systemPackagesString = cm.getProperty(WILDFLY80_SYSTEM_PACKAGES_KEY, "org.jboss.logging, org.slf4j").trim(); String[] systemPackages = systemPackagesString.split(",\\s*"); return systemPackages; }
public WildFly90TestContainer(ExamSystem system) { this.system = system; this.testDirectory = TestDirectory.getInstance(); this.cm = new ConfigurationManager(); }
private void startEmbeddedServer() { installContainer(); cm.loadSystemProperties(WILDFLY80_SYSTEM_PROPERTIES_KEY); File tempDir = system.getTempFolder(); File dataDir = new File(tempDir, "data"); dataDir.mkdir(); File configFile = new File(configTargetDir, "standalone.xml"); if (!configFile.exists()) { throw new TestContainerException(configFile + " does not exist"); } parseServerConfiguration(configFile); System.setProperty("jboss.server.data.dir", dataDir.getAbsolutePath()); validateManagementPort(); server = EmbeddedServerFactory.create(wildFlyHome, null, null, getSystemPackages()); try { server.start(); } catch (ServerStartException exc) { throw new TestContainerException("Problem starting embedded server.", exc); } }
/** * * @return packages to be loaded from system class loader */ private String[] getSystemPackages() { String systemPackagesString = cm.getProperty(WILDFLY90_SYSTEM_PACKAGES_KEY, "org.jboss.logging, org.slf4j").trim(); String[] systemPackages = systemPackagesString.split(",\\s*"); return systemPackages; }
public TomcatContextConfig() { this.cm = new ConfigurationManager(); setDefaultWebXml(Constants.NoDefaultWebXml); }
private void startEmbeddedServer() { installContainer(); cm.loadSystemProperties(WILDFLY90_SYSTEM_PROPERTIES_KEY); File tempDir = system.getTempFolder(); File dataDir = new File(tempDir, "data"); dataDir.mkdir(); File configFile = new File(configTargetDir, "standalone.xml"); if (!configFile.exists()) { throw new TestContainerException(configFile + " does not exist"); } parseServerConfiguration(configFile); System.setProperty("jboss.server.data.dir", dataDir.getAbsolutePath()); validateManagementPort(); server = EmbeddedServerFactory.create(wildFlyHome, null, getSystemPackages(), null); try { server.start(); } catch (ServerStartException exc) { throw new TestContainerException("Problem starting embedded server.", exc); } }
private String getVersion() { ConfigurationManager cm = new ConfigurationManager(); return cm.getProperty("pax.exam.karaf.version"); }
private void installWildFlyModules() { String modulesList = cm.getProperty(WILDFLY80_MODULES_KEY); if (modulesList == null) { return; } File addOnsDir = new File(wildFlyHome, "modules/system/add-ons/pax-exam"); addOnsDir.mkdirs(); String[] modules = modulesList.split(",\\s*"); for (String module : modules) { installWildFlyModule(module, addOnsDir); } }
public WildFly80TestContainer(ExamSystem system) { this.system = system; this.testDirectory = TestDirectory.getInstance(); this.cm = new ConfigurationManager(); }
private void validateConfiguration() { ConfigurationManager cm = new ConfigurationManager(); String systemType = cm.getProperty(Constants.EXAM_SYSTEM_KEY); if (!Constants.EXAM_SYSTEM_CDI.equals(systemType)) { String msg = "OpenWebBeansTestContainer requires pax.exam.system = cdi"; throw new TestContainerException(msg); } }
private void installWildFlyModules() { String modulesList = cm.getProperty(WILDFLY90_MODULES_KEY); if (modulesList == null) { return; } File addOnsDir = new File(wildFlyHome, "modules/system/add-ons/pax-exam"); addOnsDir.mkdirs(); Arrays.stream(modulesList.split(",\\s*")).forEach(m -> installWildFlyModule(m, addOnsDir)); }
/** * Private constructor for singleton. */ private ReactorManager() { try { cm = new ConfigurationManager(); system = createExamSystem(); reactorStrategies = new HashMap<String, StagedExamReactorFactory>(3); reactorStrategies.put(EXAM_REACTOR_STRATEGY_PER_SUITE, new PerSuite()); reactorStrategies.put(EXAM_REACTOR_STRATEGY_PER_CLASS, new PerClass()); reactorStrategies.put(EXAM_REACTOR_STRATEGY_PER_METHOD, new PerMethod()); } catch (IOException exc) { throw new TestContainerException("cannot create Exam system", exc); } }
private void validateConfiguration() { ConfigurationManager cm = new ConfigurationManager(); String systemType = cm.getProperty(Constants.EXAM_SYSTEM_KEY); if (! Constants.EXAM_SYSTEM_CDI.equals(systemType)) { String msg = "WeldTestContainer requires pax.exam.system = cdi"; throw new TestContainerException(msg); } }
@Override public void start() { String host; String httpPortNumber; CredentialsCallbackHandler callbackHandler = null; if (cm.getProperty(WILDFLY90_REMOTE_HOST_KEY) == null) { startEmbeddedServer(); host = "localhost"; httpPortNumber = Integer.toString(httpPort); } else { host = cm.getProperty(WILDFLY90_REMOTE_HOST_KEY); httpPortNumber = cm.getProperty(WILDFLY90_REMOTE_HTTP_PORT_KEY, "8080"); String username = cm.getProperty(WILDFLY90_REMOTE_USERNAME_KEY); String password = cm.getProperty(WILDFLY90_REMOTE_PASSWORD_KEY); callbackHandler = new CredentialsCallbackHandler(username, password); mgmtPort = Integer.parseInt(cm.getProperty(WILDFLY90_REMOTE_MGMT_PORT_KEY, "9990")); } try { deploymentManager = ServerDeploymentManager.Factory.create( InetAddress.getByName(host), mgmtPort, callbackHandler); String uri = String.format("http://%s:%s/Pax-Exam-Probe/", host, httpPortNumber); testDirectory.setAccessPoint(new URI(uri)); deployModules(); } catch (URISyntaxException | UnknownHostException exc) { throw new TestContainerException("Problem starting test container.", exc); } }
private void verifyThatBundlesAreResolved(List<Bundle> bundles) { boolean hasUnresolvedBundles = false; for (Bundle bundle : bundles) { if (bundle.getState() == Bundle.INSTALLED) { LOG.error("Bundle [{}] is not resolved", bundle); hasUnresolvedBundles = true; } } ConfigurationManager cm = new ConfigurationManager(); boolean failOnUnresolved = Boolean.parseBoolean(cm.getProperty(EXAM_FAIL_ON_UNRESOLVED_KEY, "false")); if (hasUnresolvedBundles && failOnUnresolved) { throw new TestContainerException( "There are unresolved bundles. See previous ERROR log messages for details."); } }
@Override public void start() { String host; String httpPortNumber; CredentialsCallbackHandler callbackHandler = null; if (cm.getProperty(WILDFLY80_REMOTE_HOST_KEY) == null) { startEmbeddedServer(); host = "localhost"; httpPortNumber = Integer.toString(httpPort); } else { host = cm.getProperty(WILDFLY80_REMOTE_HOST_KEY); httpPortNumber = cm.getProperty(WILDFLY80_REMOTE_HTTP_PORT_KEY, "8080"); String username = cm.getProperty(WILDFLY80_REMOTE_USERNAME_KEY); String password = cm.getProperty(WILDFLY80_REMOTE_PASSWORD_KEY); callbackHandler = new CredentialsCallbackHandler(username, password); mgmtPort = Integer.parseInt(cm.getProperty(WILDFLY80_REMOTE_MGMT_PORT_KEY, "9990")); } try { deploymentManager = ServerDeploymentManager.Factory.create( InetAddress.getByName(host), mgmtPort, callbackHandler); String uri = String.format("http://%s:%s/Pax-Exam-Probe/", host, httpPortNumber); testDirectory.setAccessPoint(new URI(uri)); deployModules(); } catch (URISyntaxException | UnknownHostException exc) { throw new TestContainerException("Problem starting test container.", exc); } }
private void verifyThatBundlesAreResolved() { boolean hasUnresolvedBundles = Arrays.stream(framework.getBundleContext().getBundles()) .filter(b -> b.getState() == INSTALLED) .peek(b -> LOG.error("Bundle [{}] is not resolved", b)).count() > 0; ConfigurationManager cm = new ConfigurationManager(); boolean failOnUnresolved = Boolean.parseBoolean(cm.getProperty(EXAM_FAIL_ON_UNRESOLVED_KEY, "false")); if (hasUnresolvedBundles && failOnUnresolved) { throw new TestContainerException( "There are unresolved bundles. See previous ERROR log messages for details."); } }
String propertyRef = getProperty(configurationKey); if (propertyRef == null) { return;
private void verifyThatBundlesAreResolved(List<Long> bundleIds) throws RemoteException { boolean hasUnresolvedBundles = false; for (long bundleId : bundleIds) { try { if (remoteFramework.getBundleState(bundleId) == Bundle.INSTALLED) { LOG.error("Bundle [id:{}, url:{}] is not resolved", bundleId, bundlesById.get(bundleId)); hasUnresolvedBundles = true; } } catch (BundleException exc) { throw new TestContainerException(exc); } } ConfigurationManager cm = new ConfigurationManager(); boolean failOnUnresolved = Boolean.parseBoolean(cm.getProperty(EXAM_FAIL_ON_UNRESOLVED_KEY, "false")); if (hasUnresolvedBundles && failOnUnresolved) { throw new TestContainerException( "There are unresolved bundles. See previous ERROR log messages for details."); } }