@Test public void testGetConfigSetOverlayWithShimConfig() { Set<String> rootConfig = new HashSet<String>( Arrays.asList( "one", "b", "iii" ) ); Set<String> shimConfig = new HashSet<String>( Arrays.asList( "1", "two", "tres" ) ); Set<String> combinedConfig = new HashSet<String>( rootConfig ); combinedConfig.addAll( shimConfig ); shimProperties.setProperty( "propName", join( ",", rootConfig ) ); shimProperties.setProperty( "mr1.propName", join( ",", shimConfig ) ); shimProperties.setProperty( ShimProperties.SHIM_CP_CONFIG, "mr1" ); assertEquals( combinedConfig, shimProperties.getConfigSet( "propName", SetOverrideType.OVERLAY ) ); }
@Test public void testGetConfigListReplaceWith2ShimConfig() { List<String> rootConfig = new ArrayList<String>( Arrays.asList( "one", "b", "iii" ) ); List<String> shimConfig = new ArrayList<String>( Arrays.asList( "1", "two", "tres" ) ); List<String> shimConfig2 = new ArrayList<String>( Arrays.asList( "3", "cee", "p", "o" ) ); shimProperties.setProperty( "propName", join( ",", rootConfig ) ); shimProperties.setProperty( "mr1.propName", join( ",", shimConfig ) ); shimProperties.setProperty( "hbase.propName", join( ",", shimConfig2 ) ); shimProperties.setProperty( ShimProperties.SHIM_CP_CONFIG, "mr1,hbase" ); assertEquals( shimConfig2, shimProperties.getConfigList( "propName", ListOverrideType.REPLACE ) ); }
@Test public void testGetConfigListPrependWith2ShimConfig() { List<String> rootConfig = new ArrayList<String>( Arrays.asList( "one", "b", "iii" ) ); List<String> shimConfig = new ArrayList<String>( Arrays.asList( "1", "two", "tres" ) ); List<String> shimConfig2 = new ArrayList<String>( Arrays.asList( "3", "cee", "p", "o" ) ); List<String> combinedList = new ArrayList<String>( shimConfig2 ); combinedList.addAll( shimConfig ); combinedList.addAll( rootConfig ); shimProperties.setProperty( "propName", join( ",", rootConfig ) ); shimProperties.setProperty( "mr1.propName", join( ",", shimConfig ) ); shimProperties.setProperty( "hbase.propName", join( ",", shimConfig2 ) ); shimProperties.setProperty( ShimProperties.SHIM_CP_CONFIG, "mr1,hbase" ); assertEquals( combinedList, shimProperties.getConfigList( "propName", ListOverrideType.PREPEND ) ); }
@Test public void testGetConfigListAppendWith2ShimConfig() { List<String> rootConfig = new ArrayList<String>( Arrays.asList( "one", "b", "iii" ) ); List<String> shimConfig = new ArrayList<String>( Arrays.asList( "1", "two", "tres" ) ); List<String> shimConfig2 = new ArrayList<String>( Arrays.asList( "3", "cee", "p", "o" ) ); List<String> combinedList = new ArrayList<String>( rootConfig ); combinedList.addAll( shimConfig ); combinedList.addAll( shimConfig2 ); shimProperties.setProperty( "propName", join( ",", rootConfig ) ); shimProperties.setProperty( "mr1.propName", join( ",", shimConfig ) ); shimProperties.setProperty( "hbase.propName", join( ",", shimConfig2 ) ); shimProperties.setProperty( ShimProperties.SHIM_CP_CONFIG, "mr1,hbase" ); assertEquals( combinedList, shimProperties.getConfigList( "propName", ListOverrideType.APPEND ) ); }
@Test public void testGetConfigListPrependWithShimConfig() { List<String> rootConfig = new ArrayList<String>( Arrays.asList( "one", "b", "iii" ) ); List<String> shimConfig = new ArrayList<String>( Arrays.asList( "1", "two", "tres" ) ); List<String> combinedList = new ArrayList<String>( shimConfig ); combinedList.addAll( rootConfig ); shimProperties.setProperty( "propName", join( ",", rootConfig ) ); shimProperties.setProperty( "mr1.propName", join( ",", shimConfig ) ); shimProperties.setProperty( ShimProperties.SHIM_CP_CONFIG, "mr1" ); assertEquals( combinedList, shimProperties.getConfigList( "propName", ListOverrideType.PREPEND ) ); }
@Test public void testGetConfigListAppendWithShimConfig() { List<String> rootConfig = new ArrayList<String>( Arrays.asList( "one", "b", "iii" ) ); List<String> shimConfig = new ArrayList<String>( Arrays.asList( "1", "two", "tres" ) ); List<String> combinedList = new ArrayList<String>( rootConfig ); combinedList.addAll( shimConfig ); shimProperties.setProperty( "propName", join( ",", rootConfig ) ); shimProperties.setProperty( "mr1.propName", join( ",", shimConfig ) ); shimProperties.setProperty( ShimProperties.SHIM_CP_CONFIG, "mr1" ); assertEquals( combinedList, shimProperties.getConfigList( "propName", ListOverrideType.APPEND ) ); }
@Test public void testGetConfigListDefaultsToAppend() { List<String> rootConfig = new ArrayList<String>( Arrays.asList( "one", "b", "iii" ) ); List<String> shimConfig = new ArrayList<String>( Arrays.asList( "1", "two", "tres" ) ); List<String> combinedList = new ArrayList<String>( rootConfig ); combinedList.addAll( shimConfig ); shimProperties.setProperty( "propName", join( ",", rootConfig ) ); shimProperties.setProperty( "mr1.propName", join( ",", shimConfig ) ); shimProperties.setProperty( ShimProperties.SHIM_CP_CONFIG, "mr1" ); assertEquals( combinedList, shimProperties.getConfigList( "propName" ) ); }
@Test public void testGetConfigSetDefaultsToOverlay() { Set<String> rootConfig = new HashSet<String>( Arrays.asList( "one", "b", "iii" ) ); Set<String> shimConfig = new HashSet<String>( Arrays.asList( "1", "two", "tres" ) ); Set<String> combinedConfig = new HashSet<String>( rootConfig ); combinedConfig.addAll( shimConfig ); shimProperties.setProperty( "propName", join( ",", rootConfig ) ); shimProperties.setProperty( "mr1.propName", join( ",", shimConfig ) ); shimProperties.setProperty( ShimProperties.SHIM_CP_CONFIG, "mr1" ); assertEquals( combinedConfig, shimProperties.getConfigSet( "propName" ) ); }
@Test public void testGetConfigSetReplaceWithShimConfig() { Set<String> rootConfig = new HashSet<String>( Arrays.asList( "one", "b", "iii" ) ); Set<String> shimConfig = new HashSet<String>( Arrays.asList( "1", "two", "tres" ) ); shimProperties.setProperty( "propName", join( ",", rootConfig ) ); shimProperties.setProperty( "mr1.propName", join( ",", shimConfig ) ); shimProperties.setProperty( ShimProperties.SHIM_CP_CONFIG, "mr1" ); assertEquals( shimConfig, shimProperties.getConfigSet( "propName", SetOverrideType.REPLACE ) ); }
@Test public void testGetConfigListReplaceWithShimConfig() { List<String> rootConfig = new ArrayList<String>( Arrays.asList( "one", "b", "iii" ) ); List<String> shimConfig = new ArrayList<String>( Arrays.asList( "1", "two", "tres" ) ); shimProperties.setProperty( "propName", join( ",", rootConfig ) ); shimProperties.setProperty( "mr1.propName", join( ",", shimConfig ) ); shimProperties.setProperty( ShimProperties.SHIM_CP_CONFIG, "mr1" ); assertEquals( shimConfig, shimProperties.getConfigList( "propName", ListOverrideType.REPLACE ) ); }
@Test public void testGetConfigListReplaceWithNoRootConfig() { List<String> shimConfig = new ArrayList<String>( Arrays.asList( "1", "two", "tres" ) ); shimProperties.setProperty( "mr1.propName", join( ",", shimConfig ) ); assertEquals( new ArrayList<String>(), shimProperties.getConfigList( "propName", ListOverrideType.REPLACE ) ); shimProperties.setProperty( ShimProperties.SHIM_CP_CONFIG, "mr1" ); assertEquals( shimConfig, shimProperties.getConfigList( "propName", ListOverrideType.REPLACE ) ); }
@Test public void testGetConfigSetOverlayWithNoRootConfig() { Set<String> shimConfig = new HashSet<String>( Arrays.asList( "1", "two", "tres" ) ); shimProperties.setProperty( "mr1.propName", join( ",", shimConfig ) ); assertEquals( new HashSet<String>(), shimProperties.getConfigSet( "propName", SetOverrideType.OVERLAY ) ); shimProperties.setProperty( ShimProperties.SHIM_CP_CONFIG, "mr1" ); assertEquals( shimConfig, shimProperties.getConfigSet( "propName", SetOverrideType.OVERLAY ) ); }
@Test public void testGetConfigListAppendWithNoRootConfig() { List<String> shimConfig = new ArrayList<String>( Arrays.asList( "1", "two", "tres" ) ); shimProperties.setProperty( "mr1.propName", join( ",", shimConfig ) ); assertEquals( new ArrayList<String>(), shimProperties.getConfigList( "propName", ListOverrideType.APPEND ) ); shimProperties.setProperty( ShimProperties.SHIM_CP_CONFIG, "mr1" ); assertEquals( shimConfig, shimProperties.getConfigList( "propName", ListOverrideType.APPEND ) ); }
@Test public void testGetConfigSetReplaceWithNoRootConfig() { Set<String> shimConfig = new HashSet<String>( Arrays.asList( "1", "two", "tres" ) ); shimProperties.setProperty( "mr1.propName", join( ",", shimConfig ) ); assertEquals( new HashSet<String>(), shimProperties.getConfigSet( "propName", SetOverrideType.REPLACE ) ); shimProperties.setProperty( ShimProperties.SHIM_CP_CONFIG, "mr1" ); assertEquals( shimConfig, shimProperties.getConfigSet( "propName", SetOverrideType.REPLACE ) ); }
@Test public void testGetConfigListPrependWithNoRootConfig() { List<String> shimConfig = new ArrayList<String>( Arrays.asList( "1", "two", "tres" ) ); shimProperties.setProperty( "mr1.propName", join( ",", shimConfig ) ); assertEquals( new ArrayList<String>(), shimProperties.getConfigList( "propName", ListOverrideType.PREPEND ) ); shimProperties.setProperty( ShimProperties.SHIM_CP_CONFIG, "mr1" ); assertEquals( shimConfig, shimProperties.getConfigList( "propName", ListOverrideType.PREPEND ) ); }
@Test public void testGetConfigListAppendWithNoShimConfig() { List<String> rootConfig = new ArrayList<String>( Arrays.asList( "one", "b", "iii" ) ); shimProperties.setProperty( "propName", join( ",", rootConfig ) ); assertEquals( rootConfig, shimProperties.getConfigList( "propName", ListOverrideType.APPEND ) ); shimProperties.setProperty( ShimProperties.SHIM_CP_CONFIG, "mr1" ); assertEquals( rootConfig, shimProperties.getConfigList( "propName", ListOverrideType.APPEND ) ); }
@Test public void testGetConfigSetOverlayWithNoShimConfig() { Set<String> rootConfig = new HashSet<String>( Arrays.asList( "one", "b", "iii" ) ); shimProperties.setProperty( "propName", join( ",", rootConfig ) ); assertEquals( rootConfig, shimProperties.getConfigSet( "propName", SetOverrideType.OVERLAY ) ); shimProperties.setProperty( ShimProperties.SHIM_CP_CONFIG, "mr1" ); assertEquals( rootConfig, shimProperties.getConfigSet( "propName", SetOverrideType.OVERLAY ) ); }
@Test public void testGetConfigListReplaceWithNoShimConfig() { List<String> rootConfig = new ArrayList<String>( Arrays.asList( "one", "b", "iii" ) ); shimProperties.setProperty( "propName", join( ",", rootConfig ) ); assertEquals( rootConfig, shimProperties.getConfigList( "propName", ListOverrideType.REPLACE ) ); shimProperties.setProperty( ShimProperties.SHIM_CP_CONFIG, "mr1" ); assertEquals( rootConfig, shimProperties.getConfigList( "propName", ListOverrideType.REPLACE ) ); }
@Test public void testGetConfigListPrependWithNoShimConfig() { List<String> rootConfig = new ArrayList<String>( Arrays.asList( "one", "b", "iii" ) ); shimProperties.setProperty( "propName", join( ",", rootConfig ) ); assertEquals( rootConfig, shimProperties.getConfigList( "propName", ListOverrideType.PREPEND ) ); shimProperties.setProperty( ShimProperties.SHIM_CP_CONFIG, "mr1" ); assertEquals( rootConfig, shimProperties.getConfigList( "propName", ListOverrideType.PREPEND ) ); }
@Test public void testGetConfigSetReplaceWithNoShimConfig() { Set<String> rootConfig = new HashSet<String>( Arrays.asList( "one", "b", "iii" ) ); shimProperties.setProperty( "propName", join( ",", rootConfig ) ); assertEquals( rootConfig, shimProperties.getConfigSet( "propName", SetOverrideType.REPLACE ) ); shimProperties.setProperty( ShimProperties.SHIM_CP_CONFIG, "mr1" ); assertEquals( rootConfig, shimProperties.getConfigSet( "propName", SetOverrideType.REPLACE ) ); }