use of org.apache.atlas.v1.model.notification.EntityNotificationV1 in project atlas by apache.
the class EntityNotificationTest method testGetOperationType.
@Test
public void testGetOperationType() throws Exception {
Referenceable entity = getEntity("id");
EntityNotificationV1 entityNotification = new EntityNotificationV1(entity, OperationType.ENTITY_CREATE, Collections.<Struct>emptyList());
assertEquals(EntityNotificationV1.OperationType.ENTITY_CREATE, entityNotification.getOperationType());
}
use of org.apache.atlas.v1.model.notification.EntityNotificationV1 in project atlas by apache.
the class EntityNotificationTest method testEquals.
@Test
public void testEquals() throws Exception {
Referenceable entity = getEntity("id");
EntityNotificationV1 entityNotification2 = new EntityNotificationV1(entity, OperationType.ENTITY_CREATE, Collections.<Struct>emptyList());
EntityNotificationV1 entityNotification = new EntityNotificationV1(entity, OperationType.ENTITY_CREATE, Collections.<Struct>emptyList());
assertTrue(entityNotification.equals(entityNotification2));
assertTrue(entityNotification2.equals(entityNotification));
}
use of org.apache.atlas.v1.model.notification.EntityNotificationV1 in project atlas by apache.
the class EntityNotificationTest method testGetAllTraitsSuperTraits.
@Test
public void testGetAllTraitsSuperTraits() throws Exception {
AtlasTypeRegistry typeRegistry = mock(AtlasTypeRegistry.class);
String traitName = "MyTrait";
Struct myTrait = new Struct(traitName);
String superTraitName = "MySuperTrait";
AtlasClassificationType traitType = mock(AtlasClassificationType.class);
Set<String> superTypeNames = Collections.singleton(superTraitName);
AtlasClassificationType superTraitType = mock(AtlasClassificationType.class);
Set<String> superSuperTypeNames = Collections.emptySet();
Referenceable entity = getEntity("id", myTrait);
when(typeRegistry.getClassificationTypeByName(traitName)).thenReturn(traitType);
when(typeRegistry.getClassificationTypeByName(superTraitName)).thenReturn(superTraitType);
when(traitType.getAllSuperTypes()).thenReturn(superTypeNames);
when(superTraitType.getAllSuperTypes()).thenReturn(superSuperTypeNames);
EntityNotificationV1 entityNotification = new EntityNotificationV1(entity, OperationType.TRAIT_ADD, typeRegistry);
List<Struct> allTraits = entityNotification.getAllTraits();
assertEquals(2, allTraits.size());
for (Struct trait : allTraits) {
String typeName = trait.getTypeName();
assertTrue(typeName.equals(traitName) || typeName.equals(superTraitName));
}
}
use of org.apache.atlas.v1.model.notification.EntityNotificationV1 in project atlas by apache.
the class EntityNotificationTest method testGetAllTraits.
@Test
public void testGetAllTraits() throws Exception {
Referenceable entity = getEntity("id");
String traitName = "MyTrait";
List<Struct> traitInfo = Collections.singletonList(new Struct(traitName, Collections.<String, Object>emptyMap()));
EntityNotificationV1 entityNotification = new EntityNotificationV1(entity, OperationType.TRAIT_ADD, traitInfo);
assertEquals(traitInfo, entityNotification.getAllTraits());
}
Aggregations