AtlasTypeDefGraphStore implements AtlasTypeDefStore, ActiveStateChangeHandler { @Override public AtlasTypesDef searchTypesDef(SearchFilter searchFilter) throws AtlasBaseException { final AtlasTypesDef typesDef = new AtlasTypesDef(); Predicate searchPredicates = FilterUtil.getPredicateFromSearchFilter(searchFilter); for(AtlasEnumType enumType : typeRegistry.getAllEnumTypes()) { if (searchPredicates.evaluate(enumType)) { typesDef.getEnumDefs().add(enumType.getEnumDef()); } } for(AtlasStructType structType : typeRegistry.getAllStructTypes()) { if (searchPredicates.evaluate(structType)) { typesDef.getStructDefs().add(structType.getStructDef()); } } for(AtlasClassificationType classificationType : typeRegistry.getAllClassificationTypes()) { if (searchPredicates.evaluate(classificationType)) { typesDef.getClassificationDefs().add(classificationType.getClassificationDef()); } } for(AtlasEntityType entityType : typeRegistry.getAllEntityTypes()) { if (searchPredicates.evaluate(entityType)) { typesDef.getEntityDefs().add(entityType.getEntityDef()); } } for(AtlasRelationshipType relationshipType : typeRegistry.getAllRelationshipTypes()) { if (searchPredicates.evaluate(relationshipType)) { typesDef.getRelationshipDefs().add(relationshipType.getRelationshipDef()); } } return typesDef; } protected  AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry,
                                     Set<TypeDefChangeListener> typeDefChangeListeners); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void instanceIsActive(); @Override void instanceIsPassive();  }
@Test(priority = 1) public void testGet() { try { AtlasTypesDef typesDef = typeDefStore.searchTypesDef(new SearchFilter()); assertNotNull(typesDef.getEnumDefs()); assertEquals(typesDef.getStructDefs().size(), 0); assertNotNull(typesDef.getStructDefs()); assertEquals(typesDef.getClassificationDefs().size(), 0); assertNotNull(typesDef.getClassificationDefs()); assertEquals(typesDef.getEntityDefs().size(), 0); assertNotNull(typesDef.getEntityDefs()); } catch (AtlasBaseException e) { fail("Search of types shouldn't have failed"); } }
@Test(dependsOnMethods = "testGet") public void testSearchFunctionality() { SearchFilter searchFilter = new SearchFilter(); searchFilter.setParam(SearchFilter.PARAM_SUPERTYPE, "Person"); try { AtlasTypesDef typesDef = typeDefStore.searchTypesDef(searchFilter); assertNotNull(typesDef); assertNotNull(typesDef.getEntityDefs()); assertEquals(typesDef.getEntityDefs().size(), 3); } catch (AtlasBaseException e) { fail("Search should've succeeded", e); } }