org.apache.olingo.odata2.api.edm.FullQualifiedName Java Examples
The following examples show how to use
org.apache.olingo.odata2.api.edm.FullQualifiedName.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AnnotationEdmProviderTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private void validateAssociation(final Association association, final String fromRole, final EdmMultiplicity fromMulti, final FullQualifiedName fromType, final String toRole, final EdmMultiplicity toMulti, final FullQualifiedName toType) { AssociationEnd[] ends = new AssociationEnd[] { association.getEnd1(), association.getEnd2() }; for (AssociationEnd associationEnd : ends) { if (associationEnd.getRole().equals(fromRole)) { validateAssociationEnd(associationEnd, fromRole, fromMulti, fromType); } else if (associationEnd.getRole().equals(toRole)) { validateAssociationEnd(associationEnd, toRole, toMulti, toType); } else { fail("Unexpected navigation end '" + associationEnd.getRole() + "' for association with name '" + association.getName() + "'."); } } }
Example #2
Source File: Model.java From DataHubSystem with GNU Affero General Public License v3.0 | 6 votes |
@Override public AssociationSet getAssociationSet(String entity_container, FullQualifiedName association, String source_entity_set_name, String source_entity_set_role) throws ODataException { if (association == null || association.getName() == null) { return null; } if (entity_container == null || entity_container.equals(ENTITY_CONTAINER)) { for (AssociationSet assoc: ENTITYSETS.get(source_entity_set_name).getAssociationSets()) { if (assoc.getName().equals(association.getName())) { return assoc; } } } return null; }
Example #3
Source File: Model.java From DataHubSystem with GNU Affero General Public License v3.0 | 6 votes |
@Override public Association getAssociation(FullQualifiedName edm_fq_name) throws ODataException { if (edm_fq_name != null && edm_fq_name.getNamespace().equals(NAMESPACE)) { String assocName = edm_fq_name.getName(); String entity = assocName.substring(0, assocName.indexOf("_")); for (Association assoc: ENTITYSETS.get(AbstractEntitySet.generateEntitySetName(entity)).getAssociations()) { if (assoc.getName().equals(edm_fq_name.getName())) { return assoc; } } } return null; }
Example #4
Source File: XmlMetadataConsumer.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private EntityType fetchLastBaseType (FullQualifiedName baseTypeFQName, Map<FullQualifiedName, EntityType> entityTypesMap) throws EntityProviderException { EntityType baseEntityType = null ; while(baseTypeFQName!=null){ baseEntityType = entityTypesMap.get(baseTypeFQName); if(baseEntityType.getKey()!=null){ break; }else if(baseEntityType !=null && baseEntityType.getBaseType() !=null){ baseTypeFQName = baseEntityType.getBaseType(); }else if(baseEntityType.getBaseType() == null){ break; } } return baseEntityType; }
Example #5
Source File: XmlMetadataDeserializer.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private void setAssociationSetForNavigations() throws EdmException { for(EdmEntitySet edmEntitySet:edmEntitySetList){ List<String> navigations = edmEntitySet.getEntityType().getNavigationPropertyNames(); if(navigations!=null && !navigations.isEmpty()){ for (EdmNavigationProperty navigationProperty : navProperties) { if (navigations.contains(navigationProperty.getName())) { //NOSONAR FullQualifiedName associationName = ((EdmNavigationPropertyImpl) navigationProperty).getRelationshipName(); String toRoleName = ((EdmNavigationPropertyImpl) navigationProperty).getToRole(); EdmAssociationEnd end = associationsMap.get(associationName).getEnd(toRoleName); if (end == null) { throw new EdmException(EdmException.ASSOCIATIONNOTFOUND); } String relation = associationName.toString(); StringBuilder key = new StringBuilder(); key.append(edmEntitySet.getName()); key.append(">>"); key.append(relation); key.append(">>"); key.append(navigationProperty.getFromRole()); ((EdmNavigationPropertyImpl) navigationProperty).setMultiplicity(end.getMultiplicity()); associationSetMap.put(key.toString(), tempAssociationSetMap.get(relation)); } } } } }
Example #6
Source File: XmlMetadataConsumer.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private void validateEntityTypes() throws EntityProviderException { for (Map.Entry<FullQualifiedName, EntityType> entityTypes : entityTypesMap.entrySet()) { if (entityTypes.getValue() != null && entityTypes.getKey() != null) { EntityType entityType = entityTypes.getValue(); if (entityType.getBaseType() != null) { FullQualifiedName baseTypeFQName = entityType.getBaseType(); EntityType baseEntityType; if (!entityTypesMap.containsKey(baseTypeFQName)) { FullQualifiedName fqName = validateEntityTypeWithAlias(baseTypeFQName); baseEntityType = entityTypesMap.get(fqName); } else { baseEntityType = fetchLastBaseType(baseTypeFQName,entityTypesMap); } if (baseEntityType != null && baseEntityType.getKey() == null) { throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT .addContent("Missing key for EntityType " + baseEntityType.getName())); } } else if (entityType.getKey() == null) { throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT .addContent("Missing key for EntityType " + entityType.getName())); } } } }
Example #7
Source File: JPAEdmNameBuilder.java From olingo-odata2 with Apache License 2.0 | 6 votes |
public static void build(final JPAEdmEntitySetView view, final JPAEdmEntityTypeView entityTypeView) { FullQualifiedName fQname = view.getEdmEntitySet().getEntityType(); JPAEdmMappingModelAccess mappingModelAccess = view.getJPAEdmMappingModelAccess(); String entitySetName = null; if (mappingModelAccess != null && mappingModelAccess.isMappingModelExists()) { Mapping mapping = entityTypeView.getEdmEntityType().getMapping(); if (mapping != null) { entitySetName = mappingModelAccess.mapJPAEntitySet(mapping.getInternalName()); } } if (entitySetName == null) { entitySetName = fQname.getName() + ENTITY_SET_SUFFIX; } view.getEdmEntitySet().setName(entitySetName); }
Example #8
Source File: XmlMetadataDeserializer.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private void setBaseTypeForEntityType() throws EdmException { for (Entry<FullQualifiedName, EdmEntityType> entity : entityTypesMap.entrySet()) { EdmEntityTypeImpl entityType = (EdmEntityTypeImpl) entity.getValue(); if (entityType.getBaseTypeName() != null && entity.getValue() .getBaseType() == null) { FullQualifiedName fqname = entityType.getBaseTypeName(); if (entityTypesMap.get(entityType.getBaseTypeName()) != null) { entityType.setEdmBaseType(entityTypesMap.get(fqname)); } else if (aliasNamespaceMap.containsKey(fqname.getNamespace())) { FullQualifiedName changedName = new FullQualifiedName( aliasNamespaceMap.get(fqname.getNamespace()), fqname.getName()); entityType.setEdmBaseType(entityTypesMap.get(changedName)); } else {// Adding dummy basetype which will fail during validation EdmEntityTypeImpl newBaseType = new EdmEntityTypeImpl(); newBaseType.setName(fqname.getName()); newBaseType.setNamespace(fqname.getNamespace()); entityType.setEdmBaseType(newBaseType); break; } } } setBaseTypePropertiesForEntityType(entityBaseTypeMap); }
Example #9
Source File: XmlMetadataDeserializer.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private void setBaseTypeForComplexType() throws EdmException { for (Entry<FullQualifiedName, EdmComplexType> entity : complexTypesMap.entrySet()) { EdmComplexTypeImpl entityType = (EdmComplexTypeImpl) entity.getValue(); if (((EdmComplexTypeImpl) entity.getValue()).getEdmBaseTypeName() != null && entity.getValue().getBaseType() == null) { FullQualifiedName fqname = entityType.getEdmBaseTypeName(); if(complexTypesMap.get(entityType.getEdmBaseTypeName()) != null){ entityType.setEdmBaseType(complexTypesMap.get(fqname)); }else if (aliasNamespaceMap.containsKey(fqname.getNamespace())) { FullQualifiedName changedName = new FullQualifiedName( aliasNamespaceMap.get(fqname.getNamespace()), fqname.getName()); entityType.setEdmBaseType(complexTypesMap.get(changedName)); }else{ //Adding dummy basetype awhich will fail during validation EdmComplexTypeImpl newBaseType = new EdmComplexTypeImpl(); newBaseType.setName(fqname.getName()); newBaseType.setNamespace(fqname.getNamespace()); ((EdmComplexTypeImpl) entity.getValue()).setEdmBaseType(newBaseType); break; } } } setBaseTypePropertiesForComplexType(complexBaseTypeMap); }
Example #10
Source File: EdmNavigationPropertyImplProvTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@BeforeClass public static void setup() throws Exception { edmProvider = mock(EdmProvider.class); EdmImplProv edmImplProv = new EdmImplProv(edmProvider); FullQualifiedName relationship = new FullQualifiedName("namespace", "associationName"); Association association = new Association().setName("associationName"); when(edmProvider.getAssociation(relationship)).thenReturn(association); AssociationEnd end1 = new AssociationEnd().setRole("fromRole"); FullQualifiedName entityName = new FullQualifiedName("namespace", "entityName"); AssociationEnd end2 = new AssociationEnd().setRole("toRole").setMultiplicity(EdmMultiplicity.ONE).setType(entityName); association.setEnd1(end1).setEnd2(end2); EntityType entityType = new EntityType().setName("entityName"); when(edmProvider.getEntityType(entityName)).thenReturn(entityType); NavigationProperty navProperty = new NavigationProperty().setName("navProperty").setFromRole("fromRole").setToRole("toRole").setRelationship( relationship); navPropertyProvider = new EdmNavigationPropertyImplProv(edmImplProv, navProperty); }
Example #11
Source File: AnnotationEdmProviderTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Test public void entityTypeEmployee() throws Exception { // validate employee EntityType employee = aep.getEntityType(new FullQualifiedName(ModelSharedConstants.NAMESPACE_1, "Employee")); assertEquals("Employee", employee.getName()); final List<PropertyRef> employeeKeys = employee.getKey().getKeys(); assertEquals(1, employeeKeys.size()); assertEquals("EmployeeId", employeeKeys.get(0).getName()); assertEquals(6, employee.getProperties().size()); assertEquals(3, employee.getNavigationProperties().size()); Property name = getProperty(employee, "EmployeeName"); assertEquals(Integer.valueOf(20), name.getFacets().getMaxLength()); for (NavigationProperty navigationProperty : employee.getNavigationProperties()) { if (navigationProperty.getName().equals("ne_Manager")) { validateNavProperty(navigationProperty, "ManagerEmployees", "r_Employees", "r_Manager"); } else if (navigationProperty.getName().equals("ne_Team")) { validateNavProperty(navigationProperty, "TeamEmployees", "r_Employees", "r_Team"); } else if (navigationProperty.getName().equals("ne_Room")) { validateNavProperty(navigationProperty, "r_Employees_2_r_Room", "r_Employees", "r_Room"); } else { fail("Got unexpected navigation property with name '" + navigationProperty.getName() + "'."); } } }
Example #12
Source File: AnnotationEdmProviderTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Test public void facetsTest() throws Exception { EntityType employee = aep.getEntityType(new FullQualifiedName(ModelSharedConstants.NAMESPACE_1, "Employee")); assertEquals("Employee", employee.getName()); Property name = getProperty(employee, "EmployeeName"); assertEquals(Integer.valueOf(20), name.getFacets().getMaxLength()); assertNull(name.getFacets().getConcurrencyMode()); assertTrue(name.getFacets().isNullable()); Property id = getProperty(employee, "EmployeeId"); assertFalse(id.getFacets().isNullable()); ComplexType city = aep.getComplexType(new FullQualifiedName(ModelSharedConstants.NAMESPACE_1, "c_City")); Property postalCode = getProperty(city.getProperties(), "PostalCode"); assertEquals(Integer.valueOf(5), postalCode.getFacets().getMaxLength()); EntityType room = aep.getEntityType(new FullQualifiedName(ModelSharedConstants.NAMESPACE_1, "Room")); Property version = getProperty(room, "Version"); assertEquals(Integer.valueOf(0), version.getFacets().getScale()); assertEquals(Integer.valueOf(0), version.getFacets().getPrecision()); assertEquals(EdmConcurrencyMode.Fixed, version.getFacets().getConcurrencyMode()); }
Example #13
Source File: AnnotationEdmProviderTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Test public void complexTypeLocation() throws Exception { // validate employee EntityType employee = aep.getEntityType(new FullQualifiedName(ModelSharedConstants.NAMESPACE_1, "Employee")); final List<Property> properties = employee.getProperties(); Property location = null; for (Property property : properties) { if (property.getName().equals("Location")) { location = property; } } assertNotNull(location); assertEquals("Location", location.getName()); // validate location complex type ComplexType locationType = aep.getComplexType( new FullQualifiedName(ModelSharedConstants.NAMESPACE_1, "c_Location")); assertEquals("c_Location", locationType.getName()); assertEquals(2, locationType.getProperties().size()); assertEquals(false, location.getFacets().isNullable()); }
Example #14
Source File: XmlMetadataDeserializer.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private void setBaseTypePropertiesForComplexType( Map<FullQualifiedName, FullQualifiedName> baseTypeMap) throws EdmException{ changeAliasNamespaces(baseTypeMap); while(!baseTypeMap.isEmpty()){ Iterator<Entry<FullQualifiedName, FullQualifiedName>> iterator = baseTypeMap.entrySet().iterator(); while (iterator.hasNext()) { Entry<FullQualifiedName, FullQualifiedName> baseType = iterator.next(); if(baseTypeMap.get(baseType.getValue()) == null){ EdmComplexType entityType = complexTypesMap.get(baseType.getKey()); List<String> properties = entityType.getPropertyNames(); if(complexTypesMap.get(baseType.getValue())!=null){ //NOSONAR properties.addAll(complexTypesMap.get(baseType.getValue()).getPropertyNames()); } iterator.remove(); } } } }
Example #15
Source File: AnnotationsInMemoryDsTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Test(expected = AnnotationRuntimeException.class) public void unknownEntitySetForEntity() throws Exception { String entitySetName = "Unknown"; FullQualifiedName entityType = new FullQualifiedName(DEFAULT_CONTAINER, entitySetName); EdmEntitySet edmEntitySet = Mockito.mock(EdmEntitySet.class); Mockito.when(edmEntitySet.getName()).thenReturn(entitySetName); EdmEntityType edmEntityType = Mockito.mock(EdmEntityType.class); Mockito.when(edmEntitySet.getEntityType()).thenReturn(edmEntityType); Mockito.when(edmEntityType.getName()).thenReturn(entityType.getName()); Map<String, Object> keys = new HashMap<String, Object>(); keys.put("Id", "1"); // datasource.readData(edmEntitySet, keys); }
Example #16
Source File: EdmxProvider.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Override public ComplexType getComplexType(final FullQualifiedName edmFQName) throws ODataException { for (Schema schema : dataServices.getSchemas()) { if (schema.getNamespace().equals(edmFQName.getNamespace())) { for (ComplexType complexType : schema.getComplexTypes()) { if (complexType.getName().equals(edmFQName.getName())) { return complexType; } } } } return null; }
Example #17
Source File: ODataJPAEdmProvider.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Override public EntityType getEntityType(final FullQualifiedName edmFQName) throws ODataException { String strEdmFQName = null; if (edmFQName != null) { strEdmFQName = edmFQName.toString(); if (entityTypes.containsKey(strEdmFQName)) { return entityTypes.get(strEdmFQName); } else if (schemas == null) { getSchemas(); } String entityTypeNamespace = edmFQName.getNamespace(); String entityTypeName = edmFQName.getName(); for (Schema schema : schemas) { String schemaNamespace = schema.getNamespace(); if (schemaNamespace.equals(entityTypeNamespace)) { if (schema.getEntityTypes() == null) { return null; } for (EntityType et : schema.getEntityTypes()) { if (et.getName().equals(entityTypeName)) { entityTypes.put(strEdmFQName, et); return et; } } } } } return null; }
Example #18
Source File: XmlMetadataConsumer.java From olingo-odata2 with Apache License 2.0 | 5 votes |
private NavigationProperty readNavigationProperty(final XMLStreamReader reader) throws XMLStreamException, EntityProviderException { reader.require(XMLStreamConstants.START_ELEMENT, edmNamespace, XmlMetadataConstants.EDM_NAVIGATION_PROPERTY); NavigationProperty navProperty = new NavigationProperty(); List<AnnotationElement> annotationElements = new ArrayList<AnnotationElement>(); navProperty.setName(reader.getAttributeValue(null, XmlMetadataConstants.EDM_NAME)); String relationship = reader.getAttributeValue(null, XmlMetadataConstants.EDM_NAVIGATION_RELATIONSHIP); if (relationship != null) { FullQualifiedName fqName = extractFQName(relationship); navProperty.setRelationship(fqName); } else { throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE .addContent(XmlMetadataConstants.EDM_NAVIGATION_RELATIONSHIP).addContent( XmlMetadataConstants.EDM_NAVIGATION_PROPERTY)); } navProperty.setFromRole(reader.getAttributeValue(null, XmlMetadataConstants.EDM_NAVIGATION_FROM_ROLE)); navProperty.setToRole(reader.getAttributeValue(null, XmlMetadataConstants.EDM_NAVIGATION_TO_ROLE)); navProperty.setAnnotationAttributes(readAnnotationAttribute(reader)); while (reader.hasNext() && !(reader.isEndElement() && edmNamespace.equals(reader.getNamespaceURI()) && XmlMetadataConstants.EDM_NAVIGATION_PROPERTY.equals(reader.getLocalName()))) { reader.next(); if (reader.isStartElement()) { extractNamespaces(reader); annotationElements.add(readAnnotationElement(reader)); } } if (!annotationElements.isEmpty()) { navProperty.setAnnotationElements(annotationElements); } navProperties.add(navProperty); return navProperty; }
Example #19
Source File: EdmImplProv.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Override protected EdmAssociation createAssociation(final FullQualifiedName fqName) throws ODataException { Association association = edmProvider.getAssociation(fqName); if (association == null) { return null; } return new EdmAssociationImplProv(this, association, fqName.getNamespace()); }
Example #20
Source File: XmlMetadataConsumer.java From olingo-odata2 with Apache License 2.0 | 5 votes |
private FullQualifiedName extractFQName(final String name) throws EntityProviderException { // Looking for the last dot String[] names = name.split("\\" + Edm.DELIMITER + "(?=[^\\" + Edm.DELIMITER + "]+$)"); if (names.length != 2) { throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT .addContent("Attribute should specify a namespace qualified name or an alias qualified name")); } else { return new FullQualifiedName(names[0], names[1]); } }
Example #21
Source File: ODataJPAEdmProviderTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Test public void testGetComplexType() { FullQualifiedName complexTypeName = new FullQualifiedName("salesorderprocessing", "Address"); String nameStr = null; try { nameStr = edmProvider.getComplexType(complexTypeName).getName(); } catch (ODataException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2); } assertEquals("Address", nameStr); }
Example #22
Source File: XmlMetadataConsumer.java From olingo-odata2 with Apache License 2.0 | 5 votes |
private void validateComplexTypes() throws EntityProviderException { for (Map.Entry<FullQualifiedName, ComplexType> complexTypes : complexTypesMap.entrySet()) { if (complexTypes.getValue() != null && complexTypes.getKey() != null) { ComplexType complexType = complexTypes.getValue(); if (complexType.getBaseType() != null) { FullQualifiedName baseTypeFQName = complexType.getBaseType(); if (!complexTypesMap.containsKey(baseTypeFQName)) { validateComplexTypeWithAlias(baseTypeFQName); } } } } }
Example #23
Source File: EdmSchemaMock.java From olingo-odata2 with Apache License 2.0 | 5 votes |
private static List<Association> createAssociations() { List<Association> associations = new ArrayList<Association>(); Association association = new Association(); association.setName(ASSOCIATION_NAME); association.setEnd1(new AssociationEnd().setMultiplicity(EdmMultiplicity.ONE).setRole(ASSOCIATION_ROLE_NAME_ONE) .setType(new FullQualifiedName(NAMESPACE, ENTITY_NAME_ONE))); association.setEnd2(new AssociationEnd().setMultiplicity(EdmMultiplicity.MANY).setRole(ASSOCIATION_ROLE_NAME_TWO) .setType(new FullQualifiedName(NAMESPACE, ENTITY_NAME_TWO))); associations.add(association); return associations; }
Example #24
Source File: MyEdmProvider.java From wildfly-camel with Apache License 2.0 | 5 votes |
@Override public Association getAssociation(FullQualifiedName edmFQName) throws ODataException { if (NAMESPACE.equals(edmFQName.getNamespace())) { if (ASSOCIATION_CAR_MANUFACTURER.getName().equals(edmFQName.getName())) { return new Association().setName(ASSOCIATION_CAR_MANUFACTURER.getName()) .setEnd1(new AssociationEnd().setType(ENTITY_TYPE_1_1).setRole(ROLE_1_1).setMultiplicity(EdmMultiplicity.MANY)) .setEnd2(new AssociationEnd().setType(ENTITY_TYPE_1_2).setRole(ROLE_1_2).setMultiplicity(EdmMultiplicity.ONE)); } } return null; }
Example #25
Source File: AnnotationEdmProviderTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
private void validateNavProperty(final NavigationProperty navigationProperty, final String name, final String relationship, final String fromRole, final String toRole) { if (name != null) { assertEquals(name, navigationProperty.getName()); } FullQualifiedName fqn = new FullQualifiedName(ModelSharedConstants.NAMESPACE_1, relationship); assertEquals("Wrong relationship for navigation property.", fqn, navigationProperty.getRelationship()); assertEquals("Wrong fromRole for navigation property.", fromRole, navigationProperty.getFromRole()); assertEquals("Wrong toRole for navigation property.", toRole, navigationProperty.getToRole()); }
Example #26
Source File: EdmImpl.java From olingo-odata2 with Apache License 2.0 | 5 votes |
private FullQualifiedName getNamespaceForAlias(final String namespaceOrAlias, String name) throws EdmException { String namespace = aliasToNamespaceInfo.get(namespaceOrAlias); if (namespace != null) { //Namespace to alias mapping found return new FullQualifiedName(namespace, name); } else { //No mapping found. Parameter must be the namespace return new FullQualifiedName(namespaceOrAlias, name); } }
Example #27
Source File: AnnotationEdmProviderTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Test public void entityTypePhotoWithTwoKeyProperties() throws Exception { // validate team EntityType photo = aep.getEntityType(new FullQualifiedName(ModelSharedConstants.NAMESPACE_1, "Photo")); assertEquals("Photo", photo.getName()); final List<Property> properties = photo.getProperties(); assertEquals(5, properties.size()); assertTrue(containsProperty(properties, "Name")); assertTrue(containsProperty(properties, "ImageFormat")); assertTrue(containsProperty(properties, "MimeType")); assertTrue(containsProperty(properties, "ImageUrl")); assertTrue(containsProperty(properties, "Image")); assertFalse(photo.isAbstract()); assertTrue(photo.isHasStream()); assertEquals("MimeType",photo.getMapping().getMediaResourceMimeTypeKey()); assertEquals("ImageUrl",photo.getMapping().getMediaResourceSourceKey()); Key photoKey = photo.getKey(); List<PropertyRef> keyReferences = photoKey.getKeys(); assertEquals(2, keyReferences.size()); PropertyRef name = getPropertyRef(keyReferences, "Name"); assertEquals("Name", name.getName()); PropertyRef imageFormat = getPropertyRef(keyReferences, "ImageFormat"); assertEquals("ImageFormat", imageFormat.getName()); // assertEquals(0, photo.getNavigationProperties().size()); assertNull(photo.getNavigationProperties()); }
Example #28
Source File: EdmImplTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Override protected EdmAssociation createAssociation(final FullQualifiedName fqName) throws ODataException { EdmAssociation edmAssociation = mock(EdmAssociation.class); when(edmAssociation.getNamespace()).thenReturn(fqName.getNamespace()); when(edmAssociation.getName()).thenReturn(fqName.getName()); return edmAssociation; }
Example #29
Source File: ODataJPAEdmProviderNegativeTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Test public void testGetAssociationFullQualifiedName() { Association association = null; try { association = edmProvider.getAssociation(new FullQualifiedName("salesorderprocessing", "SalesOrderHeader_SalesOrderItem")); } catch (ODataException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2); } assertNull(association); }
Example #30
Source File: EdmImplTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Override protected EdmEntityType createEntityType(final FullQualifiedName fqName) throws ODataException { EdmEntityType edmEntityType = mock(EdmEntityType.class); when(edmEntityType.getNamespace()).thenReturn(fqName.getNamespace()); when(edmEntityType.getName()).thenReturn(fqName.getName()); return edmEntityType; }