public boolean hasSuperType(String typeName) { return hasSuperType(superTypes, typeName); }
public boolean hasSuperType(String typeName) { return hasSuperType(superTypes, typeName); }
public void addSuperType(String typeName) { Set<String> s = this.superTypes; if (!hasSuperType(s, typeName)) { s = new HashSet<>(s); s.add(typeName); this.superTypes = s; } }
public void addSuperType(String typeName) { Set<String> s = this.superTypes; if (!hasSuperType(s, typeName)) { s = new HashSet<>(s); s.add(typeName); this.superTypes = s; } }
public void removeSuperType(String typeName) { Set<String> s = this.superTypes; if (hasSuperType(s, typeName)) { s = new HashSet<>(s); s.remove(typeName); this.superTypes = s; } }
public void removeSuperType(String typeName) { Set<String> s = this.superTypes; if (hasSuperType(s, typeName)) { s = new HashSet<>(s); s.remove(typeName); this.superTypes = s; } }
@Test public void testEntityDefHasSuperTypeWithNoSuperType() { AtlasEntityDef entityDef = ModelTestUtil.getEntityDef(); for (String superType : entityDef.getSuperTypes()) { assertTrue(entityDef.hasSuperType(superType)); } assertFalse(entityDef.hasSuperType("01234-xyzabc-;''-)(")); }
@Test public void testEntityDefHasSuperTypeWithNoSuperTypes() { AtlasEntityDef entityDef = ModelTestUtil.getEntityDefWithSuperTypes(); for (String superType : entityDef.getSuperTypes()) { assertTrue(entityDef.hasSuperType(superType)); } assertFalse(entityDef.hasSuperType("01234-xyzabc-;''-)(")); } }
@Test public void testEntityDefHasSuperTypeWithNoSuperType() { AtlasEntityDef entityDef = ModelTestUtil.getEntityDef(); for (String superType : entityDef.getSuperTypes()) { assertTrue(entityDef.hasSuperType(superType)); } assertFalse(entityDef.hasSuperType("01234-xyzabc-;''-)(")); }
@Test public void testEntityDefHasSuperTypeWithNoSuperTypes() { AtlasEntityDef entityDef = ModelTestUtil.getEntityDefWithSuperTypes(); for (String superType : entityDef.getSuperTypes()) { assertTrue(entityDef.hasSuperType(superType)); } assertFalse(entityDef.hasSuperType("01234-xyzabc-;''-)(")); } }
@Test public void testEntityDefSetSuperTypes() { AtlasEntityDef entityDef = ModelTestUtil.newEntityDefWithSuperTypes(); Set<String> oldSuperTypes = entityDef.getSuperTypes(); Set<String> newSuperTypes = new HashSet<>(); newSuperTypes.add("newType-abcd-1234"); entityDef.setSuperTypes(newSuperTypes); for (String superType : oldSuperTypes) { assertFalse(entityDef.hasSuperType(superType)); } for (String superType : newSuperTypes) { assertTrue(entityDef.hasSuperType(superType)); } // restore old sypertypes entityDef.setSuperTypes(oldSuperTypes); }
@Test public void testEntityDefSetSuperTypes() { AtlasEntityDef entityDef = ModelTestUtil.newEntityDefWithSuperTypes(); Set<String> oldSuperTypes = entityDef.getSuperTypes(); Set<String> newSuperTypes = new HashSet<>(); newSuperTypes.add("newType-abcd-1234"); entityDef.setSuperTypes(newSuperTypes); for (String superType : oldSuperTypes) { assertFalse(entityDef.hasSuperType(superType)); } for (String superType : newSuperTypes) { assertTrue(entityDef.hasSuperType(superType)); } // restore old sypertypes entityDef.setSuperTypes(oldSuperTypes); }
@Test public void testEntityDefAddSuperType() { AtlasEntityDef entityDef = ModelTestUtil.newEntityDef(); String newSuperType = "newType-abcd-1234"; entityDef.addSuperType(newSuperType); assertTrue(entityDef.hasSuperType(newSuperType)); entityDef.removeSuperType(newSuperType); }
@Test public void testEntityDefAddSuperType() { AtlasEntityDef entityDef = ModelTestUtil.newEntityDef(); String newSuperType = "newType-abcd-1234"; entityDef.addSuperType(newSuperType); assertTrue(entityDef.hasSuperType(newSuperType)); entityDef.removeSuperType(newSuperType); }
@Test public void testEntityDefRemoveElement() { AtlasEntityDef entityDef = ModelTestUtil.newEntityDefWithSuperTypes(); for (String superType : entityDef.getSuperTypes()) { entityDef.removeSuperType(superType); assertFalse(entityDef.hasSuperType(superType)); } }
@Test public void testEntityDefRemoveElement() { AtlasEntityDef entityDef = ModelTestUtil.newEntityDefWithSuperTypes(); for (String superType : entityDef.getSuperTypes()) { entityDef.removeSuperType(superType); assertFalse(entityDef.hasSuperType(superType)); } }