@Test public void testPreserveImplementedInterfaces() { Object object = new Test1Class(); Object newObject = VariableInterpolation.interpolate(new HashMap<>(), object); assertTrue(newObject instanceof Test1); object = new Test2Class(); newObject = VariableInterpolation.interpolate(new HashMap<>(), object); assertTrue(newObject instanceof Test1); object = new Test3Class(); newObject = VariableInterpolation.interpolate(new HashMap<>(), object); assertTrue(newObject instanceof Test1); }
@Test public void testPreserveImplementedInterfaces() { Object object = new Test1Class(); Object newObject = VariableInterpolation.interpolate(new HashMap<>(), object); assertTrue(newObject instanceof Test1); object = new Test2Class(); newObject = VariableInterpolation.interpolate(new HashMap<>(), object); assertTrue(newObject instanceof Test1); object = new Test3Class(); newObject = VariableInterpolation.interpolate(new HashMap<>(), object); assertTrue(newObject instanceof Test1); }
@Test public void testVariablesResolution() { Map<String, String> values = new HashMap<>(); values.put(ContextAwareWildflyRuntimeExecConfig.WAR_PATH, FILE_PATH); values.put(ContextAwareWildflyRuntimeExecConfig.REDEPLOY_STRATEGY, REDEPLOY_OPTION); values.put(ContextAwareWildflyRuntimeExecConfig.RUNTIME_NAME, RUNTIME_NAME); final ContextAwareWildflyRuntimeExecConfig config = new ContextAwareWildflyRuntimeExecConfig(); final ContextAwareWildflyRuntimeExecConfig varConfig = interpolate(singletonMap("input", values), config); assertEquals(FILE_PATH, varConfig.getWarPath()); assertEquals(REDEPLOY_OPTION, varConfig.getRedeployStrategy()); assertEquals(RUNTIME_NAME, varConfig.getRuntimeName()); } }
((ContextAware) output).setContext(Collections.unmodifiableMap(context.getValues())); final Object newOutput = interpolate(context.getValues(), output); if (executor == null) {
((ContextAware) output).setContext(Collections.unmodifiableMap(context.getValues())); final Object newOutput = interpolate(context.getValues(), output); if (executor == null) {
@Test public void basicTest() { final Test1 object = new Test1() { }; final Test1 newObject = VariableInterpolation.interpolate(new HashMap<String, Object>() {{ put("input", new HashMap<String, String>() {{ put("value1", "myvalue1"); put("value2", "myvalue2"); }}); }}, object); assertEquals("myvalue1", newObject.getValue1()); assertEquals("myvalue2", newObject.getValue2()); assertEquals("myvalue1", newObject.getValue3()); }
@Test public void missingContentTest() { final Test1 object = new Test1() { }; final Test1 newObject = VariableInterpolation.interpolate(new HashMap<String, Object>() {{ put("input", new HashMap<String, String>() {{ put("value2", "myvalue2"); }}); }}, object); assertEquals("", newObject.getValue1()); assertEquals("myvalue2", newObject.getValue2()); assertEquals("", newObject.getValue3()); }
@Test public void missingContentTest() { final Test1 object = new Test1() { }; final Test1 newObject = VariableInterpolation.interpolate(new HashMap<String, Object>() {{ put("input", new HashMap<String, String>() {{ put("value2", "myvalue2"); }}); }}, object); assertEquals("", newObject.getValue1()); assertEquals("myvalue2", newObject.getValue2()); assertEquals("", newObject.getValue3()); }
@Test public void basicTest() { final Test1 object = new Test1() { }; final Test1 newObject = VariableInterpolation.interpolate(new HashMap<String, Object>() {{ put("input", new HashMap<String, String>() {{ put("value1", "myvalue1"); put("value2", "myvalue2"); }}); }}, object); assertEquals("myvalue1", newObject.getValue1()); assertEquals("myvalue2", newObject.getValue2()); assertEquals("myvalue1", newObject.getValue3()); }