DefaultTychoResolver implements TychoResolver { protected void setTychoEnvironmentProperties(Properties properties, MavenProject project) { String arch = PlatformPropertiesUtils.getArch(properties); String os = PlatformPropertiesUtils.getOS(properties); String ws = PlatformPropertiesUtils.getWS(properties); project.getProperties().put(TYCHO_ENV_OSGI_WS, ws); project.getProperties().put(TYCHO_ENV_OSGI_OS, os); project.getProperties().put(TYCHO_ENV_OSGI_ARCH, arch); }  @Override void setupProject(MavenSession session, MavenProject project, ReactorProject reactorProject); @Override void resolveProject(MavenSession session, MavenProject project, List<ReactorProject> reactorProjects); @Override void traverse(MavenProject project, final DependencyVisitor visitor); static final String TYCHO_ENV_OSGI_WS; static final String TYCHO_ENV_OSGI_OS; static final String TYCHO_ENV_OSGI_ARCH; static final String PROPERTY_PREFIX; }
@Test public void testTychoEnvironmentPropertiesGetSet() { System.setProperty("os.name", PlatformPropertiesUtils.INTERNAL_OS_LINUX); System.setProperty("os.arch", PlatformPropertiesUtils.INTERNAL_AMD64); MavenProject project = mock(MavenProject.class); Properties mergedProperties = new Properties(); Properties projectProperties = new Properties(); when(project.getProperties()).thenReturn(projectProperties); defaultTychoResolver.setTychoEnvironmentProperties(mergedProperties, project); Object ws = projectProperties.getProperty(DefaultTychoResolver.TYCHO_ENV_OSGI_WS); Object os = projectProperties.getProperty(DefaultTychoResolver.TYCHO_ENV_OSGI_OS); Object arch = projectProperties.getProperty(DefaultTychoResolver.TYCHO_ENV_OSGI_ARCH); Assert.assertEquals(3, projectProperties.size()); Assert.assertEquals(PlatformPropertiesUtils.ARCH_X86_64, arch); Assert.assertEquals(PlatformPropertiesUtils.OS_LINUX, os); Assert.assertEquals(PlatformPropertiesUtils.WS_GTK, ws); }