private List<String> getShimConfigs() { List<String> shimConfigs = new ArrayList<String>(); String shimCurrentConfig = super.getProperty( SHIM_CP_CONFIG ); String os = "linux"; if ( windowsChecker.isWindows() ) { os = "windows"; } shimConfigs.add( os ); if ( shimCurrentConfig != null ) { for ( String config : shimCurrentConfig.trim().split( "," ) ) { shimConfigs.add( config.trim() ); shimConfigs.add( os + "." + config.trim() ); } } return shimConfigs; }
@Test public void testGetPrefixedOsPropertiesWindowsShimConfigTrumpedBySetConfig() { when( windowsChecker.isWindows() ).thenReturn( true ); shimProperties.setProperty( "java.system.flatclass", "false" ); shimProperties.setProperty( "windows.java.system.flatclass", "false" ); shimProperties.setProperty( "mr1.java.system.flatclass", "true" ); shimProperties.setProperty( ShimProperties.SHIM_CP_CONFIG, "mr1" ); assertEquals( "true", shimProperties.getProperty( "java.system.flatclass" ) ); }
@Test public void testGetPrefixedOsPropertiesLinuxShimConfigNoBase() { when( windowsChecker.isWindows() ).thenReturn( false ); shimProperties.setProperty( "linux.java.system.flatclass", "true" ); assertEquals( "true", shimProperties.getProperty( "java.system.flatclass", "false" ) ); }
@Test public void testGetPrefixedOsPropertiesLinuxShimConfigFallback() { when( windowsChecker.isWindows() ).thenReturn( false ); shimProperties.setProperty( "java.system.flatclass", "true" ); assertEquals( "true", shimProperties.getProperty( "java.system.flatclass", "false" ) ); }
@Test public void testGetPrefixedOsPropertiesWindowsAndShimConfigTrumpsWindowsConfig() { when( windowsChecker.isWindows() ).thenReturn( true ); shimProperties.setProperty( "java.system.flatclass", "false" ); shimProperties.setProperty( "windows.java.system.flatclass", "false" ); shimProperties.setProperty( "mr1.java.system.flatclass", "false" ); shimProperties.setProperty( "windows.mr1.java.system.flatclass", "true" ); shimProperties.setProperty( ShimProperties.SHIM_CP_CONFIG, "mr1" ); assertEquals( "true", shimProperties.getProperty( "java.system.flatclass" ) ); } }
@Test public void testGetPrefixedOsPropertiesWindowsShimConfig() { when( windowsChecker.isWindows() ).thenReturn( true ); shimProperties.setProperty( "java.system.flatclass", "false" ); shimProperties.setProperty( "windows.java.system.flatclass", "true" ); assertEquals( "true", shimProperties.getPrefixedProperties( "java.system" ).get( "flatclass" ) ); }
@Test public void testGetPrefixedOsPropertiesLinuxShimConfig() { when( windowsChecker.isWindows() ).thenReturn( false ); shimProperties.setProperty( "java.system.flatclass", "false" ); shimProperties.setProperty( "linux.java.system.flatclass", "true" ); assertEquals( "true", shimProperties.getProperty( "java.system.flatclass" ) ); }