CustomExecutionEnvironment implements ExecutionEnvironment { @Override public Properties getProfileProperties() { return properties; } CustomExecutionEnvironment(String profileName, List<SystemCapability> systemCapabilities); @Override String getProfileName(); @Override Properties getProfileProperties(); @Override Collection<SystemPackageEntry> getSystemPackages(); @Override String getCompilerSourceLevelDefault(); @Override String getCompilerTargetLevelDefault(); @Override boolean isCompatibleCompilerTargetLevel(String target); @Override String toString();  }
@Test public void testTwoOsgiEeCapabilities() throws Exception { createExecutionEnvironment(OSGI_JAVASE_1_6, OSGI_OSGIMINIMUM_1_0); assertThat(customExecutionEnvironment.getProfileProperties().size(), is(3)); assertProperty(Constants.FRAMEWORK_SYSTEMCAPABILITIES, "osgi.ee; osgi.ee=\"JavaSE\"; version:Version=\"1.6\"," + "osgi.ee; osgi.ee=\"OSGi/Minimum\"; version:Version=\"1.0\""); assertProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, "JavaSE-1.6,OSGi/Minimum-1.0"); }
@Test public void testOsgiEeCapabilityInTwoVersions() throws Exception { createExecutionEnvironment(OSGI_JAVASE_1_6, OSGI_JAVASE_1_7); assertThat(customExecutionEnvironment.getProfileProperties().size(), is(3)); assertProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, "JavaSE-1.6,JavaSE-1.7"); assertProperty(Constants.FRAMEWORK_SYSTEMCAPABILITIES, "osgi.ee; osgi.ee=\"JavaSE\"; version:List<Version>=\"1.6, 1.7\""); }
@Test public void testOsgiEeCapabilityStrangeVersion() throws Exception { createExecutionEnvironment(new SystemCapability(Type.OSGI_EE, "JavaSE", "1.6.1")); assertThat(customExecutionEnvironment.getProfileProperties().size(), is(3)); assertProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, "JavaSE-1.6.1"); assertProperty(Constants.FRAMEWORK_SYSTEMCAPABILITIES, "osgi.ee; osgi.ee=\"JavaSE\"; version:Version=\"1.6.1\""); }
@Test public void testOsgiEeCapabilityAlphanumericVersion() throws Exception { createExecutionEnvironment(new SystemCapability(Type.OSGI_EE, "JavaSE", "AlphaRelease.beta-245.0")); assertThat(customExecutionEnvironment.getProfileProperties().size(), is(3)); assertProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, "JavaSE-AlphaRelease.beta-245.0"); assertProperty(Constants.FRAMEWORK_SYSTEMCAPABILITIES, "osgi.ee; osgi.ee=\"JavaSE\"; version:Version=\"AlphaRelease.beta-245.0\""); }
@Test public void testJavaSEVersionNameMappings() throws Exception { List<SystemCapability> javaSeVersions = new ArrayList<>(); for (String version : new String[] { "1.2.0", "1.3.0", "1.4.0", "1.5.0", "1.6.0", "1.7.0" }) { SystemCapability capability = new SystemCapability(Type.OSGI_EE, "JavaSE", version); javaSeVersions.add(capability); } customExecutionEnvironment = new CustomExecutionEnvironment("name", javaSeVersions); assertThat(customExecutionEnvironment.getProfileProperties().size(), is(3)); assertProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, "J2SE-1.2,J2SE-1.3,J2SE-1.4,J2SE-1.5,JavaSE-1.6,JavaSE-1.7"); }