MConnector extends Configurable { public MConnector clone(boolean cloneWithValue) { cloneWithValue = false; MFromConfig fromConfig = this.getFromConfig(); MToConfig toConfig = this.getToConfig(); if (fromConfig != null) { fromConfig = fromConfig.clone(cloneWithValue); } if (toConfig != null) { toConfig = toConfig.clone(cloneWithValue); } MConnector copy = new MConnector(this.getUniqueName(), this.getClassName(), this.getVersion(), this.getLinkConfig().clone(cloneWithValue), fromConfig, toConfig); copy.setPersistenceId(this.getPersistenceId()); return copy; } MConnector(String uniqueName, String className, String version, MLinkConfig linkConfig,
      MFromConfig fromConfig, MToConfig toConfig); String getUniqueName(); String getClassName(); @Override String toString(); @Override boolean equals(Object other); @Override int hashCode(); MConnector clone(boolean cloneWithValue); MLinkConfig getLinkConfig(); MConfigList getConfig(Direction type); MFromConfig getFromConfig(); MToConfig getToConfig(); String getVersion(); MConfigurableType getType(); SupportedDirections getSupportedDirections();  }
@Test public void testClone() { MConnector connector = createConnector(Arrays.asList(Direction.FROM, Direction.TO)); assertEquals("NAME", connector.getUniqueName()); assertEquals("CLASSNAME", connector.getClassName()); assertEquals("1.0", connector.getVersion()); MConnector cloneConnector1 = connector.clone(true); assertEquals("NAME", cloneConnector1.getUniqueName()); assertEquals("CLASSNAME", cloneConnector1.getClassName()); assertEquals("1.0", cloneConnector1.getVersion()); MConfig clonedLinkConfig = cloneConnector1.getLinkConfig().getConfigs().get(0); assertNull(clonedLinkConfig.getInputs().get(0).getValue()); assertNull(clonedLinkConfig.getInputs().get(1).getValue()); MConfig clonedFromConfig = cloneConnector1.getConfig(Direction.FROM).getConfigs().get(0); assertNull(clonedFromConfig.getInputs().get(0).getValue()); assertNull(clonedFromConfig.getInputs().get(1).getValue()); MConfig clonedToConfig = cloneConnector1.getConfig(Direction.TO).getConfigs().get(0); assertNull(clonedToConfig.getInputs().get(0).getValue()); assertNull(clonedToConfig.getInputs().get(1).getValue()); MConnector clonedConnector2 = connector.clone(false); clonedLinkConfig = clonedConnector2.getLinkConfig().getConfigs().get(0); assertNull(clonedLinkConfig.getInputs().get(0).getValue()); assertNull(clonedLinkConfig.getInputs().get(1).getValue()); clonedFromConfig = clonedConnector2.getConfig(Direction.FROM).getConfigs().get(0); assertNull(clonedFromConfig.getInputs().get(0).getValue()); assertNull(clonedFromConfig.getInputs().get(1).getValue()); clonedToConfig = clonedConnector2.getConfig(Direction.TO).getConfigs().get(0); assertNull(clonedToConfig.getInputs().get(0).getValue()); assertNull(clonedToConfig.getInputs().get(1).getValue()); }