Package org.apache.olingo.odata2.api.edm

Examples of org.apache.olingo.odata2.api.edm.Edm


      uriList = EntityProvider.readLinks(contentType, entitySet, content);
      ODataContext odataContext = context.getODataContext();
      final String serviceRoot = odataContext.getPathInfo().getServiceRoot().toString();
      final int length = serviceRoot.length();
      final Edm edm = odataContext.getService().getEntityDataModel();

      for (String uriString : uriList) {
        final String path = uriString.startsWith(serviceRoot) ? uriString.substring(length) : uriString;

        final PathSegment pathSegment = new PathSegment() {
View Full Code Here


public class EdmxProviderTest {

  @Test
  public void testEntityType() throws EntityProviderException, ODataException, XMLStreamException {
    Edm edm = createEdm();

    assertNotNull(edm);
    FullQualifiedName fqNameEmployee = new FullQualifiedName("RefScenario", "Employee");
    EdmProvider testProvider = new EdmTestProvider();
    EdmImplProv edmImpl = (EdmImplProv) edm;
View Full Code Here

  }

  @Test
  public void testAssociation() throws EntityProviderException, ODataException, XMLStreamException {
    Edm edm = createEdm();
    assertNotNull(edm);

    FullQualifiedName fqNameAssociation = new FullQualifiedName("RefScenario", "BuildingRooms");
    EdmProvider testProvider = new EdmTestProvider();
    EdmImplProv edmImpl = (EdmImplProv) edm;
View Full Code Here

  }

  @Test
  public void testAssociationSet() throws EntityProviderException, ODataException, XMLStreamException {
    EdmProvider testProvider = new EdmTestProvider();
    Edm edm = createEdm();
    assertNotNull(edm);

    FullQualifiedName fqNameAssociation = new FullQualifiedName("RefScenario", "ManagerEmployees");
    EdmImplProv edmImpl = (EdmImplProv) edm;
    AssociationSet associationSet =
View Full Code Here

  }

  @Test
  public void testSchema() throws EntityProviderException, ODataException, XMLStreamException {
    EdmProvider testProvider = new EdmTestProvider();
    Edm edm = createEdm();
    assertNotNull(edm);

    EdmImplProv edmImpl = (EdmImplProv) edm;
    List<Schema> schemas = edmImpl.getEdmProvider().getSchemas();
    List<Schema> testSchemas = testProvider.getSchemas();
View Full Code Here

  }

  @Test
  public void testContainer() throws EntityProviderException, ODataException, XMLStreamException {
    EdmProvider testProvider = new EdmTestProvider();
    Edm edm = createEdm();
    assertNotNull(edm);

    EdmImplProv edmImpl = (EdmImplProv) edm;
    EntityContainerInfo container = edmImpl.getEdmProvider().getEntityContainerInfo("Container2");
    EntityContainerInfo testContainer = testProvider.getEntityContainerInfo("Container2");
View Full Code Here

    assertEquals(testContainer.isDefaultEntityContainer(), container.isDefaultEntityContainer());
  }

  @Test
  public void testEntitySets() throws EntityProviderException, ODataException {
    Edm edm = createEdm();
    assertNotNull(edm);

    List<EdmEntitySet> entitySets = edm.getEntitySets();
    assertEquals(6, entitySets.size());
  }
View Full Code Here

    assertEquals(6, entitySets.size());
  }

  @Test
  public void testFunctionImports() throws EntityProviderException, ODataException {
    Edm edm = createEdm();
    assertNotNull(edm);

    List<EdmFunctionImport> functionImports = edm.getFunctionImports();
    assertEquals(7, functionImports.size());
  }
View Full Code Here

  }

  @Test
  public void serializeETagEncoding() throws IOException, XpathException, SAXException, XMLStreamException,
      FactoryConfigurationError, ODataException {
    Edm edm = MockFacade.getMockEdm();
    EdmTyped roomIdProperty = edm.getEntityType("RefScenario", "Room").getProperty("Id");
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.getConcurrencyMode()).thenReturn(EdmConcurrencyMode.Fixed);
    when(facets.getMaxLength()).thenReturn(3);
    when(((EdmProperty) roomIdProperty).getFacets()).thenReturn(facets);

    roomData.put("Id", "<\">");
    AtomEntityProvider ser = createAtomEntityProvider();
    ODataResponse response =
        ser.writeEntry(edm.getDefaultEntityContainer().getEntitySet("Rooms"), roomData, DEFAULT_PROPERTIES);

    assertNotNull(response);
    assertNotNull(response.getEntity());
    assertNull("EntityProvider should not set content header", response.getContentHeader());
    assertEquals("W/\"<\">.3\"", response.getETag());
View Full Code Here

        // create a dummy entity location by adding a dummy key predicate
        // look for a Container name if available
        String referencedEntityName = referencedEntity.toString();
        final int containerSeparator = referencedEntityName.lastIndexOf('.');
        final EdmEntityContainer entityContainer;
        if (containerSeparator != -1) {
            final String containerName = referencedEntityName.substring(0, containerSeparator);
            referencedEntityName = referencedEntityName.substring(containerSeparator + 1);
            entityContainer = edm.getEntityContainer(containerName);
            if (entityContainer == null) {
                throw new IllegalArgumentException("EDM does not have entity container " + containerName);
            }
        } else {
            entityContainer = edm.getDefaultEntityContainer();
            if (entityContainer == null) {
                throw new IllegalArgumentException("EDM does not have a default entity container"
                    + ", use a fully qualified entity set name");
            }
        }
        final EdmEntitySet entitySet = entityContainer.getEntitySet(referencedEntityName);
        final List<EdmProperty> keyProperties = entitySet.getEntityType().getKeyProperties();

        if (keyProperties.size() == 1) {
            referencedEntity.append("('dummy')");
        } else {
View Full Code Here

TOP

Related Classes of org.apache.olingo.odata2.api.edm.Edm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.