AllocationUtils { public static TTopologyTemplate deepcopy(TTopologyTemplate topologyTemplate) { return deepcopy(topologyTemplate, true); }  static List<List<T>> getPermutations(List<List<T>> possibilities, int max); static List<TopologyWrapper> generateTargetLabelTopologies(TopologyWrapper topology,
                                                                      List<List<PermutationHelper>> permutations); static List<TPolicyTemplate> getPolicyTemplates(TNodeTemplate nodeTemplate); static TPolicyTemplate toPolicyTemplate(TPolicy policy); static TTopologyTemplate deepcopy(TTopologyTemplate topologyTemplate); static TTopologyTemplate deepcopy(TTopologyTemplate topologyTemplate, boolean changeNames); static TNodeTemplate clone(TNodeTemplate nodeTemplate, boolean changeNames); static TRelationshipTemplate clone(TRelationshipTemplate relationshipTemplate, boolean changeNames); static long idCounter; }
@Test public void deepcopy() { topology.getNodeTemplates().forEach(nt -> { nt.setMinInstances(1); nt.setMaxInstances("1"); }); TTopologyTemplate clone = BackendUtils.clone(topology); assertEquals(topology, clone); TTopologyTemplate cloneNotEquals = AllocationUtils.deepcopy(topology); assertNotEquals(topology, cloneNotEquals); }