protected File getMavenProjectRootDirectory() { String baseDir = PathUtils.getBaseDir(); return new File(new File(new File(new File(baseDir).getParent()).getParent()).getParent()); }
private Option getComponentUnderTestOptions() { String componentArtifactId = System.getProperty("component.artifactId"); String componentVersion = System.getProperty("component.version"); String bundleJarName = String.format("%s-%s.jar", componentArtifactId, componentVersion); String bundleJarUrl = Paths.get(PathUtils.getBaseDir(), "target", bundleJarName).toUri().toString(); LOGGER.info("Component under test artifact name: {}", bundleJarUrl); return bundle(bundleJarUrl).start(); } }
public static SystemPropertyOption logbackConfigFile() { File logbackXml = new File(PathUtils.getBaseDir(), "src/test/resources/logback.xml"); if (logbackXml.exists()) return systemProperty("logback.configurationFile").value("file:" + logbackXml); else return null; }
public static UrlProvisionOption thisBundle() { File classes = new File(PathUtils.getBaseDir() + "/target/classes"); Manifest manifest; try { InputStream stream = new File(classes, "META-INF/MANIFEST.MF").toURI().toURL().openStream(); try { manifest = new Manifest(stream); } finally { stream.close(); }} catch (IOException e) { throw new RuntimeException(e); } String components = manifest.getMainAttributes().getValue("Service-Component"); if (components != null) for (String component : components.split(",")) if (!(new File(classes, component)).exists()) { Properties dependencies = new Properties(); try { dependencies.load(new FileInputStream(new File(classes, "META-INF/maven/dependencies.properties"))); } catch (IOException e) { throw new RuntimeException(e); } String artifactId = dependencies.getProperty("artifactId"); String version = dependencies.getProperty("version"); // assuming JAR is named ${artifactId}-${version}.jar return bundle("reference:" + new File(PathUtils.getBaseDir() + "/target/" + artifactId + "-" + version + ".jar").toURI()); } return bundle("reference:" + classes.toURI()); }
@Test public void runXProcSpec() throws Exception { File baseDir = new File(PathUtils.getBaseDir()); File testsDir = new File(baseDir, "src/test/xprocspec"); if (testsDir.exists()) { boolean success = xprocspecRunner.run(testsDir, new File(baseDir, "target/xprocspec-reports"), new File(baseDir, "target/surefire-reports"), new File(baseDir, "target/xprocspec"), new XProcSpecRunner.Reporter.DefaultReporter()); assertTrue("XProcSpec tests should run with success", success); } }
@Test public void runXSpec() throws Exception { File baseDir = new File(PathUtils.getBaseDir()); File testsDir = new File(baseDir, "src/test/xspec"); if (testsDir.exists()) { File reportsDir = new File(baseDir, "target/surefire-reports"); reportsDir.mkdirs(); TestResults result = xspecRunner.run(testsDir, reportsDir); assertEquals("Number of failures and errors should be zero", 0L, result.getFailures() + result.getErrors()); } }
public static Option calabashConfigFile() { File configFile = new File(PathUtils.getBaseDir() + "/src/test/resources/config-calabash.xml"); return composite( configFile.exists() ? systemProperty("org.daisy.pipeline.xproc.configuration").value(configFile.toString()) : null, systemProperty("com.xmlcalabash.config.user").value("") ); }
public static Option logbackBundles() { LOG.info("Console Enabled {}", consoleEnabled); return composite( when(consoleEnabled).useOptions(systemProperty("osgi.console").value("6666"), systemProperty("osgi.console.enable.builtin").value("true")), when(consoleEnabled && isFelix()).useOptions( mavenBundle("org.apache.felix", "org.apache.felix.gogo.command", "0.14.0"), mavenBundle("org.apache.felix", "org.apache.felix.gogo.runtime", "0.12.1"), mavenBundle("org.apache.felix", "org.apache.felix.gogo.shell", "0.10.0")), systemProperty("logback.configurationFile").value( "file:" + PathUtils.getBaseDir() + "/src/test/resources/logback.xml"), linkBundle("slf4j.api"), linkBundle("jcl.over.slf4j"), linkBundle("ch.qos.logback.core"), linkBundle("ch.qos.logback.classic")); }
"org.opendaylight.controller.config.persist.storage.file.xml.XmlFileStorageAdapter"), // systemProperty("netconf.config.persister.1.properties.fileStorage") .value(PathUtils.getBaseDir() + "/src/test/resources/controller.xml"), // systemProperty("netconf.config.persister.1.properties.numberOfBackups").value("1") //