@Override public File getTempFolder() { return delegate.getTempFolder(); }
/** * Returns a collection of default Pax Runner arguments. * * @return collection of default arguments * @throws java.io.IOException problems */ private Collection<String> defaultArguments(ExamSystem system) throws IOException { final List<String> arguments = new ArrayList<String>(); arguments.add( "--noConsole" ); arguments.add( "--noDownloadFeedback" ); arguments.add( "--log=warn" ); if( !argsSetManually ) { arguments.add( "--noArgs" ); } arguments.add( "--workingDirectory=" + system.getTempFolder() ); return arguments; }
private void setProbeClassLoader() { JarProbeOption probeOption = system.getSingleOption(JarProbeOption.class); if (probeOption == null) { return; } probeDir = new File(system.getTempFolder(), UUID.randomUUID().toString()); probeDir.mkdir(); JarBuilder builder = new JarBuilder(probeDir, probeOption); URI jar = builder.buildJar(); try { URLClassLoader classLoader = new URLClassLoader(new URL[] { jar.toURL() }); contextClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(classLoader); } catch (MalformedURLException exc) { throw new TestContainerException(exc); } }
private String localize(String url) { try { URL realUrl = new URL(url); if (realUrl.getProtocol().equals("reference")) { // must be "reference:file:..." return new URL(realUrl.getPath()).getPath(); } else if (realUrl.getProtocol().equals("file")) { return realUrl.getPath(); } File artifact = platform.download(system.getTempFolder(), realUrl, url, false, false, false, false); return artifact.getCanonicalPath(); } catch (MalformedURLException exc) { throw new TestContainerException(exc); } catch (IOException exc) { throw new TestContainerException(exc); } }
private void setProbeClassLoader() { JarProbeOption probeOption = system.getSingleOption(JarProbeOption.class); if (probeOption == null) { return; } probeDir = new File(system.getTempFolder(), UUID.randomUUID().toString()); probeDir.mkdir(); JarBuilder builder = new JarBuilder(probeDir, probeOption); URI jar = builder.buildJar(); try { URLClassLoader classLoader = new URLClassLoader(new URL[]{jar.toURL()}); contextClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(classLoader); } catch (MalformedURLException exc) { throw new TestContainerException(exc); } }
private Map<String, Object> createFrameworkProperties() throws IOException { final Map<String, Object> p = new HashMap<String, Object>(); p.put(FRAMEWORK_STORAGE, system.getTempFolder().getAbsolutePath()); SystemPackageOption[] systemPackageOptions = system.getOptions(SystemPackageOption.class); if (systemPackageOptions.length > 0) { p.put(FRAMEWORK_SYSTEMPACKAGES_EXTRA, join(systemPackageOptions)); } p.put(FRAMEWORK_BOOTDELEGATION, join(system.getOptions(BootDelegationOption.class))); for (FrameworkPropertyOption option : system.getOptions(FrameworkPropertyOption.class)) { p.put(option.getKey(), option.getValue()); } for (SystemPropertyOption option : system.getOptions(SystemPropertyOption.class)) { System.setProperty(option.getKey(), option.getValue()); } return p; }
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 Map<String, String> createFrameworkProperties() throws ExamConfigurationException { final Map<String, String> p = new HashMap<>(); CleanCachesOption cleanCaches = system.getOption(CleanCachesOption.class); if (cleanCaches != null && cleanCaches.getValue() != null && cleanCaches.getValue()) { p.put(FRAMEWORK_STORAGE_CLEAN, FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT); } p.put(FRAMEWORK_STORAGE, system.getTempFolder().getAbsolutePath()); p.put(FRAMEWORK_SYSTEMPACKAGES_EXTRA, join(system.getOptions(SystemPackageOption.class))); p.put(FRAMEWORK_BOOTDELEGATION, join(system.getOptions(BootDelegationOption.class))); for (FrameworkPropertyOption option : system.getOptions(FrameworkPropertyOption.class)) { p.put(option.getKey(), (String) option.getValue()); } if (LOG.isDebugEnabled()) { logFrameworkProperties(p); } return p; }
private void installAndStartBundles() throws BundleException, RemoteException, ExamConfigurationException { File workDir = new File(system.getTempFolder(), "pax-exam-downloads"); workDir.mkdirs(); List<Long> bundleIds = new ArrayList<Long>(); ProvisionOption<?>[] options = system.getOptions(ProvisionOption.class); bundlesById = new HashMap<Long, String>(); for (ProvisionOption<?> bundle : options) { String localUrl = downloadBundle(workDir, bundle.getURL()); long id = remoteFramework.installBundle(localUrl, bundle.shouldStart(),getStartLevel(bundle)); bundlesById.put(id,bundle.getURL()); if (bundle.shouldStart()) { bundleIds.add(id); } } remoteFramework.start(); setFrameworkStartLevel(); verifyThatBundlesAreResolved(bundleIds); }
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); } }
private Map<String, String> createFrameworkProperties() throws IOException { final Map<String, String> p = new HashMap<String, String>(); CleanCachesOption cleanCaches = system.getSingleOption(CleanCachesOption.class); if (cleanCaches != null && cleanCaches.getValue() != null && cleanCaches.getValue()) { p.put(FRAMEWORK_STORAGE_CLEAN, FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT); } p.put(FRAMEWORK_STORAGE, system.getTempFolder().getAbsolutePath()); p.put(FRAMEWORK_SYSTEMPACKAGES_EXTRA, buildString(system.getOptions(SystemPackageOption.class))); p.put(FRAMEWORK_BOOTDELEGATION, buildString(system.getOptions(BootDelegationOption.class))); for (FrameworkPropertyOption option : system.getOptions(FrameworkPropertyOption.class)) { p.put(option.getKey(), (String) option.getValue()); } for (SystemPropertyOption option : system.getOptions(SystemPropertyOption.class)) { System.setProperty(option.getKey(), option.getValue()); } String repositories = buildString(system.getOptions(RepositoryOption.class)); if (!repositories.isEmpty()) { System.setProperty("org.ops4j.pax.url.mvn.repositories", repositories); } return p; }
@Override public void start() { LOG.info("starting Tomcat"); File tempDir = system.getTempFolder(); webappDir = new File(tempDir, "webapps"); webappDir.mkdirs(); tomcat = new PaxExamTomcat(); tomcat.setBaseDir(tempDir.getPath()); tomcat.enableNaming(); Host host = tomcat.getHost(); xmlBase = new File(tempDir, "conf"); xmlBase.mkdirs(); host.setXmlBase(xmlBase.getAbsolutePath()); try { int httpPort = 9080; Connector connector = tomcat.getConnector(); connector.setPort(httpPort); tomcat.start(); testDirectory.setAccessPoint(new URI("http://localhost:" + httpPort + "/Pax-Exam-Probe/")); } catch (URISyntaxException exc) { new TestContainerException(exc); } catch (LifecycleException exc) { new TestContainerException(exc); } }
fork.getTempFolder()); Map<String, String> initialProperties = createFrameworkProperties(fork, setLocationProperties(createEclipseDefaults(), layout));