public static AtlasEntityDef createClassTypeDef(String name, String description, ImmutableSet<String> superTypes, AtlasAttributeDef... attrDefs) { return createClassTypeDef(name, description, "1.0", superTypes, attrDefs); }
public static AtlasEntityDef createClassTypeDef(String name, ImmutableSet<String> superTypes, AtlasAttributeDef... attrDefs) { return createClassTypeDef(name, null, "1.0", superTypes, attrDefs); }
public static AtlasEntityDef createClassTypeDef(String name, Set<String> superTypes, AtlasAttributeDef... attrDefs) { return createClassTypeDef(name, null, "1.0", superTypes, attrDefs); }
public static AtlasEntityDef createClassTypeDef(String name, String description, Set<String> superTypes, AtlasAttributeDef... attrDefs) { return createClassTypeDef(name, description, "1.0", superTypes, attrDefs); }
public static AtlasEntityDef getSingleEntityWithName(String name) { AtlasEntityDef developerTypeDef = createClassTypeDef(name, "Developer_description", Collections.<String>emptySet(), new AtlasAttributeDef("language", String.format("array<%s>", "string"), false, AtlasAttributeDef.Cardinality.SET, 1, 10, false, false, false, Collections.<AtlasConstraintDef>emptyList())); return developerTypeDef; }
public static List<AtlasEntityDef> getEntityWithValidSuperType() { AtlasEntityDef developerTypeDef = AtlasTypeUtil.createClassTypeDef("Developer", "Developer_description", ImmutableSet.of("Employee"), new AtlasAttributeDef("language", String.format("array<%s>", "string"), false, AtlasAttributeDef.Cardinality.SET, 1, 10, false, false, Collections.<AtlasConstraintDef>emptyList())); return Arrays.asList(developerTypeDef); }
public static List<AtlasEntityDef> getEntityWithValidSuperType() { AtlasEntityDef developerTypeDef = createClassTypeDef("Developer", "Developer_description", Collections.singleton("Employee"), new AtlasAttributeDef("language", String.format("array<%s>", "string"), false, AtlasAttributeDef.Cardinality.SET, 1, 10, false, false, false, Collections.<AtlasConstraintDef>emptyList())); List<AtlasEntityDef> ret = Arrays.asList(developerTypeDef); populateSystemAttributes(ret); return ret; }
public static List<AtlasEntityDef> getEntityWithName(String name) { AtlasEntityDef developerTypeDef = createClassTypeDef(name, "Developer_description", Collections.<String>emptySet(), new AtlasAttributeDef("language", String.format("array<%s>", "string"), false, AtlasAttributeDef.Cardinality.SET, 1, 10, false, false, false, Collections.<AtlasConstraintDef>emptyList())); List<AtlasEntityDef> ret = Arrays.asList(developerTypeDef); populateSystemAttributes(ret); return ret; }
@DataProvider public Object[][] invalidAttributeNameWithReservedKeywords(){ AtlasEntityDef invalidAttrNameType = AtlasTypeUtil.createClassTypeDef("Invalid_Attribute_Type", "description", Collections.emptySet(), AtlasTypeUtil.createRequiredAttrDef("order", "string"), AtlasTypeUtil.createRequiredAttrDef("limit", "string")); return new Object[][] {{ invalidAttrNameType }}; }
@DataProvider public Object[][] invalidAttributeNameWithReservedKeywords(){ AtlasEntityDef invalidAttrNameType = AtlasTypeUtil.createClassTypeDef("Invalid_Attribute_Type", "description", Collections.emptySet(), AtlasTypeUtil.createRequiredAttrDef("order", "string"), AtlasTypeUtil.createRequiredAttrDef("limit", "string")); return new Object[][] {{ invalidAttrNameType }}; }
public static AtlasTypesDef simpleTypeUpdatedDiff() { AtlasEntityDef newSuperTypeDefinition = createClassTypeDef("new_h_type", Collections.<String>emptySet(), createOptionalAttrDef("attr", "string")); AtlasTypesDef ret = AtlasTypeUtil.getTypesDef(Collections.<AtlasEnumDef>emptyList(), Collections.<AtlasStructDef>emptyList(), Collections.<AtlasClassificationDef>emptyList(), Collections.singletonList(newSuperTypeDefinition)); populateSystemAttributes(ret); return ret; }
public static AtlasTypesDef simpleTypeUpdatedDiff() { AtlasEntityDef newSuperTypeDefinition = AtlasTypeUtil.createClassTypeDef("new_h_type", ImmutableSet.<String>of(), AtlasTypeUtil.createOptionalAttrDef("attr", "string")); return AtlasTypeUtil.getTypesDef(ImmutableList.<AtlasEnumDef>of(), ImmutableList.<AtlasStructDef>of(), ImmutableList.<AtlasClassificationDef>of(), ImmutableList.of(newSuperTypeDefinition)); }
public static AtlasTypesDef defineTypeWithComplexCollectionAttributes() { AtlasStructDef structType = new AtlasStructDef(STRUCT_TYPE, "struct_type_description", "1.0", Arrays.asList(createRequiredAttrDef(NAME, "string"))); AtlasEntityDef entityType = createClassTypeDef(ENTITY_TYPE, "entity_type_description", Collections.emptySet(), createUniqueRequiredAttrDef(NAME, "string"), createOptionalAttrDef("isReplicated", "boolean")); AtlasEntityDef complexCollectionEntityType = createClassTypeDef(ENTITY_TYPE_WITH_COMPLEX_COLLECTION_ATTR, ENTITY_TYPE_WITH_COMPLEX_COLLECTION_ATTR + "_description", null, createUniqueRequiredAttrDef("name", "string"), new AtlasAttributeDef("listOfStructs", String.format("array<%s>", STRUCT_TYPE), true, LIST, 1, 1, false, false, false, Collections.emptyList()), new AtlasAttributeDef("listOfEntities", String.format("array<%s>", ENTITY_TYPE), true, LIST, 1, 1, false, false, false, new ArrayList<AtlasConstraintDef>() {{ add(new AtlasConstraintDef(CONSTRAINT_TYPE_OWNED_REF)); }}), new AtlasAttributeDef("mapOfStructs", String.format("map<%s,%s>", "string", STRUCT_TYPE), true, SINGLE, 1, 1, false, false, false, Collections.emptyList()), new AtlasAttributeDef("mapOfEntities", String.format("map<%s,%s>", "string", ENTITY_TYPE), true, SINGLE, 1, 1, false, false, false, new ArrayList<AtlasConstraintDef>() {{ add(new AtlasConstraintDef(CONSTRAINT_TYPE_OWNED_REF)); }}) ); AtlasTypesDef ret = AtlasTypeUtil.getTypesDef(Collections.emptyList(), Arrays.asList(structType), Collections.emptyList(), Arrays.asList(entityType, complexCollectionEntityType)); populateSystemAttributes(ret); return ret; }
public static AtlasTypesDef defineTypeWithMapAttributes() { AtlasEntityDef entityType = createClassTypeDef(ENTITY_TYPE_MAP, "entity_type_map_description", Collections.emptySet(), createUniqueRequiredAttrDef("mapAttr1", "map<string,string>"), createUniqueRequiredAttrDef("mapAttr2", "map<string,int>"), createUniqueRequiredAttrDef("mapAttr3", "map<string,boolean>"), createOptionalAttrDef("mapAttr4", "map<string,float>"), createOptionalAttrDef("mapAttr5", "map<string,date>")); AtlasTypesDef ret = AtlasTypeUtil.getTypesDef(Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), Arrays.asList(entityType)); populateSystemAttributes(ret); return ret; }
public static AtlasTypesDef simpleType(){ AtlasEntityDef superTypeDefinition = createClassTypeDef("h_type", Collections.<String>emptySet(), createOptionalAttrDef("attr", "string")); AtlasStructDef structTypeDefinition = new AtlasStructDef("s_type", "structType", "1.0", Arrays.asList(createRequiredAttrDef("name", "string"))); AtlasClassificationDef traitTypeDefinition = AtlasTypeUtil.createTraitTypeDef("t_type", "traitType", Collections.<String>emptySet()); AtlasEnumDef enumTypeDefinition = new AtlasEnumDef("e_type", "enumType", "1.0", Arrays.asList(new AtlasEnumElementDef("ONE", "Element Description", 1))); AtlasTypesDef ret = AtlasTypeUtil.getTypesDef(Collections.singletonList(enumTypeDefinition), Collections.singletonList(structTypeDefinition), Collections.singletonList(traitTypeDefinition), Collections.singletonList(superTypeDefinition)); populateSystemAttributes(ret); return ret; }
public static AtlasTypesDef simpleTypeUpdated(){ AtlasEntityDef superTypeDefinition = createClassTypeDef("h_type", Collections.<String>emptySet(), createOptionalAttrDef("attr", "string")); AtlasEntityDef newSuperTypeDefinition = createClassTypeDef("new_h_type", Collections.<String>emptySet(), createOptionalAttrDef("attr", "string")); AtlasStructDef structTypeDefinition = new AtlasStructDef("s_type", "structType", "1.0", Arrays.asList(createRequiredAttrDef("name", "string"))); AtlasClassificationDef traitTypeDefinition = AtlasTypeUtil.createTraitTypeDef("t_type", "traitType", Collections.<String>emptySet()); AtlasEnumDef enumTypeDefinition = new AtlasEnumDef("e_type", "enumType", Arrays.asList(new AtlasEnumElementDef("ONE", "Element Description", 1))); AtlasTypesDef ret = AtlasTypeUtil.getTypesDef(Collections.singletonList(enumTypeDefinition), Collections.singletonList(structTypeDefinition), Collections.singletonList(traitTypeDefinition), Arrays.asList(superTypeDefinition, newSuperTypeDefinition)); populateSystemAttributes(ret); return ret; }
public static AtlasTypesDef defineInverseReferenceTestTypes() { AtlasEntityDef aDef = AtlasTypeUtil.createClassTypeDef("A", ImmutableSet.<String>of(), AtlasTypeUtil.createUniqueRequiredAttrDef("name", "string"), new AtlasAttributeDef("b", "B", true, Cardinality.SINGLE, 0, 1, false, false, Collections.<AtlasConstraintDef>emptyList()), // 1-1 new AtlasAttributeDef("oneB", "B", true, Cardinality.SINGLE, 0, 1, false, false, Collections.<AtlasConstraintDef>emptyList()), // 1-* new AtlasAttributeDef("manyB", AtlasBaseTypeDef.getArrayTypeName("B"), true, Cardinality.SINGLE, 0, 1, false, false, Collections.<AtlasConstraintDef>emptyList()), new AtlasAttributeDef("mapToB", AtlasBaseTypeDef.getMapTypeName("string", "B"), true, Cardinality.SINGLE, 0, 1, false, false, Collections.<AtlasConstraintDef>singletonList(new AtlasConstraintDef( AtlasConstraintDef.CONSTRAINT_TYPE_INVERSE_REF, Collections.<String, Object>singletonMap(AtlasConstraintDef.CONSTRAINT_PARAM_ATTRIBUTE, "mappedFromA"))))); // *-* AtlasEntityDef bDef = AtlasTypeUtil.createClassTypeDef("B", ImmutableSet.<String>of(), AtlasTypeUtil.createUniqueRequiredAttrDef("name", "string"), new AtlasAttributeDef("a", "A", true, Cardinality.SINGLE, 0, 1, false, false, Collections.<AtlasConstraintDef>singletonList(new AtlasConstraintDef( AtlasConstraintDef.CONSTRAINT_TYPE_INVERSE_REF, Collections.<String, Object>singletonMap(AtlasConstraintDef.CONSTRAINT_PARAM_ATTRIBUTE, "b")))), new AtlasAttributeDef("manyA", AtlasBaseTypeDef.getArrayTypeName("A"), true, Cardinality.SINGLE, 0, 1, false, false, Collections.<AtlasConstraintDef>singletonList(new AtlasConstraintDef( AtlasConstraintDef.CONSTRAINT_TYPE_INVERSE_REF, Collections.<String, Object>singletonMap(AtlasConstraintDef.CONSTRAINT_PARAM_ATTRIBUTE, "oneB")))), new AtlasAttributeDef("manyToManyA", AtlasBaseTypeDef.getArrayTypeName("A"), true, Cardinality.SINGLE, 0, 1, false, false, Collections.<AtlasConstraintDef>singletonList(new AtlasConstraintDef( AtlasConstraintDef.CONSTRAINT_TYPE_INVERSE_REF, Collections.<String, Object>singletonMap(AtlasConstraintDef.CONSTRAINT_PARAM_ATTRIBUTE, "manyB")))), new AtlasAttributeDef("mappedFromA", "A", true, Cardinality.SINGLE, 0, 1, false, false, Collections.<AtlasConstraintDef>emptyList())); return new AtlasTypesDef(ImmutableList.<AtlasEnumDef>of(), ImmutableList.<AtlasStructDef>of(), ImmutableList.<AtlasClassificationDef>of(), ImmutableList.<AtlasEntityDef>of(aDef, bDef)); }
private void createEmployeeTypes() throws AtlasBaseException { AtlasEntityDef phoneDef = AtlasTypeUtil.createClassTypeDef(PHONE_TYPE, getDescription(PHONE_TYPE), Collections.<String>emptySet(), AtlasTypeUtil.createRequiredAttrDef("phone_number", "int"), AtlasTypeUtil.createOptionalAttrDef("area_code", "int"), AtlasTypeUtil.createOptionalAttrDef("owner", EMPLOYEE_TYPE)); AtlasEntityDef employeeDef = AtlasTypeUtil.createClassTypeDef(EMPLOYEE_TYPE, getDescription(EMPLOYEE_TYPE), Collections.<String>emptySet(), AtlasTypeUtil.createRequiredAttrDef("name", "string"), AtlasTypeUtil.createOptionalAttrDef("dob", "date"), AtlasTypeUtil.createOptionalAttrDef("age", "int"), AtlasTypeUtil.createRequiredAttrDef("phone_no", PHONE_TYPE)); AtlasEntityDef departmentDef = AtlasTypeUtil.createClassTypeDef(DEPARTMENT_TYPE, getDescription(DEPARTMENT_TYPE), Collections.<String>emptySet(), AtlasTypeUtil.createRequiredAttrDef("name", "string"), AtlasTypeUtil.createOptionalAttrDef("count", "int")); AtlasEntityDef addressDef = AtlasTypeUtil.createClassTypeDef(ADDRESS_TYPE, getDescription(ADDRESS_TYPE), Collections.<String>emptySet(), AtlasTypeUtil.createOptionalAttrDef("street", "string"), AtlasTypeUtil.createRequiredAttrDef("city", "string"), AtlasTypeUtil.createRequiredAttrDef("state", "string"), AtlasTypeUtil.createOptionalAttrDef("zip", "int")); createTypes(new ArrayList<>(Arrays.asList(phoneDef, employeeDef, departmentDef, addressDef))); }
private void createEmployeeTypes() throws AtlasBaseException { AtlasEntityDef phoneDef = AtlasTypeUtil.createClassTypeDef(PHONE_TYPE, getDescription(PHONE_TYPE), ImmutableSet.<String>of(), AtlasTypeUtil.createRequiredAttrDef("phone_number", "int"), AtlasTypeUtil.createOptionalAttrDef("area_code", "int"), AtlasTypeUtil.createOptionalAttrDef("owner", EMPLOYEE_TYPE)); AtlasEntityDef employeeDef = AtlasTypeUtil.createClassTypeDef(EMPLOYEE_TYPE, getDescription(EMPLOYEE_TYPE), ImmutableSet.<String>of(), AtlasTypeUtil.createRequiredAttrDef("name", "string"), AtlasTypeUtil.createOptionalAttrDef("dob", "date"), AtlasTypeUtil.createOptionalAttrDef("age", "int"), AtlasTypeUtil.createRequiredAttrDef("phone_no", PHONE_TYPE)); AtlasEntityDef departmentDef = AtlasTypeUtil.createClassTypeDef(DEPARTMENT_TYPE, getDescription(DEPARTMENT_TYPE), ImmutableSet.<String>of(), AtlasTypeUtil.createRequiredAttrDef("name", "string"), AtlasTypeUtil.createOptionalAttrDef("count", "int")); AtlasEntityDef addressDef = AtlasTypeUtil.createClassTypeDef(ADDRESS_TYPE, getDescription(ADDRESS_TYPE), ImmutableSet.<String>of(), AtlasTypeUtil.createOptionalAttrDef("street", "string"), AtlasTypeUtil.createRequiredAttrDef("city", "string"), AtlasTypeUtil.createRequiredAttrDef("state", "string"), AtlasTypeUtil.createOptionalAttrDef("zip", "int")); createTypes(new ArrayList<>(Arrays.asList(phoneDef, employeeDef, departmentDef, addressDef))); }
public static AtlasTypesDef getInverseReferenceTestTypes() throws AtlasBaseException { AtlasEntityDef aType = createClassTypeDef(TYPE_A, superType(null), createUniqueRequiredAttrDef("name", "string")); AtlasEntityDef bType = createClassTypeDef(TYPE_B, superType(null), createUniqueRequiredAttrDef("name", "string")); AtlasRelationshipDef relationshipType1 = new AtlasRelationshipDef("TypeA_to_TypeB_on_b", description("TypeA_to_TypeB_on_b"), DEFAULT_VERSION, ASSOCIATION, ONE_TO_TWO, new AtlasRelationshipEndDef(TYPE_A, "b", SINGLE), new AtlasRelationshipEndDef(TYPE_B, "a", SINGLE)); AtlasRelationshipDef relationshipType2 = new AtlasRelationshipDef("TypeA_to_TypeB_on_oneB", description("TypeA_to_TypeB_on_oneB"), DEFAULT_VERSION, ASSOCIATION, ONE_TO_TWO, new AtlasRelationshipEndDef(TYPE_A, "oneB", SINGLE), new AtlasRelationshipEndDef(TYPE_B, "manyA", SET)); AtlasRelationshipDef relationshipType3 = new AtlasRelationshipDef("TypeA_to_TypeB_on_manyB", description("TypeA_to_TypeB_on_manyB"), DEFAULT_VERSION, ASSOCIATION, ONE_TO_TWO, new AtlasRelationshipEndDef(TYPE_A, "manyB", SET), new AtlasRelationshipEndDef(TYPE_B, "manyToManyA", SET)); AtlasRelationshipDef relationshipType4 = new AtlasRelationshipDef("TypeB_to_TypeA_on_mappedFromA", description("TypeB_to_TypeA_on_mappedFromA"), DEFAULT_VERSION, ASSOCIATION, ONE_TO_TWO, new AtlasRelationshipEndDef(TYPE_B, "mappedFromA", SINGLE), new AtlasRelationshipEndDef(TYPE_A, "mapToB", SET)); return new AtlasTypesDef(Collections.<AtlasEnumDef>emptyList(), Collections.<AtlasStructDef>emptyList(), Collections.<AtlasClassificationDef>emptyList(), Arrays.asList(aType, bType), Arrays.asList(relationshipType1, relationshipType2, relationshipType3, relationshipType4)); }