use of org.apache.atlas.repository.graph.GraphBackedSearchIndexer in project atlas by apache.
the class AtlasRelationshipStoreV1Test method setUp.
@BeforeClass
public void setUp() throws Exception {
new GraphBackedSearchIndexer(typeRegistry);
// create employee relationship types
AtlasTypesDef employeeTypes = getDepartmentEmployeeTypes();
typeDefStore.createTypesDef(employeeTypes);
AtlasEntitiesWithExtInfo employeeInstances = getDepartmentEmployeeInstances();
EntityMutationResponse response = entityStore.createOrUpdate(new AtlasEntityStream(employeeInstances), false);
for (AtlasEntityHeader entityHeader : response.getCreatedEntities()) {
employeeNameIdMap.put((String) entityHeader.getAttribute(NAME), getAtlasObjectId(entityHeader));
}
init();
AtlasTypesDef typesDef = getInverseReferenceTestTypes();
AtlasTypesDef typesToCreate = AtlasTypeDefStoreInitializer.getTypesToCreate(typesDef, typeRegistry);
if (!typesToCreate.isEmpty()) {
typeDefStore.createTypesDef(typesToCreate);
}
}
use of org.apache.atlas.repository.graph.GraphBackedSearchIndexer in project incubator-atlas by apache.
the class AtlasRelationshipStoreV1Test method setUp.
@BeforeClass
public void setUp() throws Exception {
new GraphBackedSearchIndexer(typeRegistry);
// create employee relationship types
AtlasTypesDef employeeTypes = getDepartmentEmployeeTypes();
typeDefStore.createTypesDef(employeeTypes);
AtlasEntitiesWithExtInfo employeeInstances = getDepartmentEmployeeInstances();
EntityMutationResponse response = entityStore.createOrUpdate(new AtlasEntityStream(employeeInstances), false);
for (AtlasEntityHeader entityHeader : response.getCreatedEntities()) {
employeeNameIdMap.put((String) entityHeader.getAttribute(NAME), getAtlasObjectId(entityHeader));
}
init();
AtlasTypesDef testTypes = getInverseReferenceTestTypes();
typeDefStore.createTypesDef(testTypes);
}
use of org.apache.atlas.repository.graph.GraphBackedSearchIndexer in project incubator-atlas by apache.
the class TestUtils method setupGraphProvider.
/**
* Triggers the Atlas initialization process using the specified MetadataRepository.
* This causes the built-in types and their indices to be created.
*/
public static void setupGraphProvider(MetadataRepository repo) throws AtlasException {
TypeCache typeCache = null;
try {
typeCache = AtlasRepositoryConfiguration.getTypeCache().newInstance();
} catch (Throwable t) {
typeCache = new DefaultTypeCache();
}
final GraphBackedSearchIndexer indexer = new GraphBackedSearchIndexer(new AtlasTypeRegistry());
Configuration config = ApplicationProperties.get();
ITypeStore typeStore = new GraphBackedTypeStore(AtlasGraphProvider.getGraphInstance());
DefaultMetadataService defaultMetadataService = new DefaultMetadataService(repo, typeStore, new HashSet<TypesChangeListener>() {
{
add(indexer);
}
}, new HashSet<EntityChangeListener>(), TypeSystem.getInstance(), config, typeCache, // Fixme: Can we work with Noop
new InMemoryEntityAuditRepository());
// commit the created types
getGraph().commit();
}
use of org.apache.atlas.repository.graph.GraphBackedSearchIndexer in project incubator-atlas by apache.
the class GraphBackedDiscoveryServiceTest method addIndexesForNewTypes.
private void addIndexesForNewTypes(Collection<String> oldTypeNames, final TypeSystem typeSystem) throws AtlasException {
Set<String> newTypeNames = new HashSet<>();
newTypeNames.addAll(typeSystem.getTypeNames());
newTypeNames.removeAll(oldTypeNames);
Collection<IDataType> newTypes = new ArrayList<>();
for (String name : newTypeNames) {
try {
newTypes.add(typeSystem.getDataType(IDataType.class, name));
} catch (AtlasException e) {
e.printStackTrace();
}
}
// We need to commit the transaction before creating the indices to release the locks held by the transaction.
// otherwise, the index commit will fail while waiting for the those locks to be released.
AtlasGraphProvider.getGraphInstance().commit();
GraphBackedSearchIndexer idx = new GraphBackedSearchIndexer(new AtlasTypeRegistry());
idx.onAdd(newTypes);
}
use of org.apache.atlas.repository.graph.GraphBackedSearchIndexer in project atlas by apache.
the class AtlasEntityStoreV1Test method setUp.
@BeforeClass
public void setUp() throws Exception {
RequestContextV1.clear();
RequestContextV1.get().setUser(TestUtilsV2.TEST_USER, null);
new GraphBackedSearchIndexer(typeRegistry);
AtlasTypesDef[] testTypesDefs = new AtlasTypesDef[] { TestUtilsV2.defineDeptEmployeeTypes(), TestUtilsV2.defineHiveTypes(), TestUtilsV2.defineTypeWithNestedCollectionAttributes() };
for (AtlasTypesDef typesDef : testTypesDefs) {
AtlasTypesDef typesToCreate = AtlasTypeDefStoreInitializer.getTypesToCreate(typesDef, typeRegistry);
if (!typesToCreate.isEmpty()) {
typeDefStore.createTypesDef(typesToCreate);
}
}
deptEntity = TestUtilsV2.createDeptEg2();
dbEntity = TestUtilsV2.createDBEntityV2();
tblEntity = TestUtilsV2.createTableEntityV2(dbEntity.getEntity());
nestedCollectionAttrEntity = TestUtilsV2.createNestedCollectionAttrEntity();
AtlasTypesDef typesDef11 = new AtlasTypesDef();
List primitiveEntityDef = new ArrayList<AtlasEntityDef>();
primitiveEntityDef.add(TestUtilsV2.createPrimitiveEntityDef());
typesDef11.setEntityDefs(primitiveEntityDef);
typeDefStore.createTypesDef(typesDef11);
primitiveEntity = TestUtilsV2.createprimitiveEntityV2();
}
Aggregations