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

Examples of org.apache.olingo.odata2.api.edm.provider.DataServices


  @Test
  public void testOtherEdmNamespace() throws XMLStreamException, EntityProviderException {
    int i = 0;
    XmlMetadataConsumer parser = new XmlMetadataConsumer();
    XMLStreamReader reader = createStreamReader(xml2);
    DataServices result = parser.readMetadata(reader, true);
    assertEquals("2.0", result.getDataServiceVersion());
    for (Schema schema : result.getSchemas()) {
      assertEquals(NAMESPACE, schema.getNamespace());
      assertEquals(1, schema.getEntityTypes().size());
      assertEquals("Employee", schema.getEntityTypes().get(0).getName());
      for (PropertyRef propertyRef : schema.getEntityTypes().get(0).getKey().getKeys()) {
        assertEquals("EmployeeId", propertyRef.getName());
View Full Code Here


  @Test
  public void testBaseType() throws XMLStreamException, EntityProviderException {
    int i = 0;
    XmlMetadataConsumer parser = new XmlMetadataConsumer();
    XMLStreamReader reader = createStreamReader(xmlWithBaseType);
    DataServices result = parser.readMetadata(reader, true);
    assertEquals("2.0", result.getDataServiceVersion());
    for (Schema schema : result.getSchemas()) {
      assertEquals(NAMESPACE, schema.getNamespace());
      assertEquals(2, schema.getEntityTypes().size());
      assertEquals("Employee", schema.getEntityTypes().get(0).getName());
      for (PropertyRef propertyRef : schema.getEntityTypes().get(0).getKey().getKeys()) {
        assertEquals("EmployeeId", propertyRef.getName());
View Full Code Here

            + "<ComplexType Name=\"c_Other_Location\" BaseType=\"RS.c_BaseType_for_Location\">" + "</ComplexType>"
            + "</Schema>"
            + "</edmx:DataServices>" + "</edmx:Edmx>";
    XmlMetadataConsumer parser = new XmlMetadataConsumer();
    XMLStreamReader reader = createStreamReader(xml);
    DataServices result = parser.readMetadata(reader, true);
    assertEquals("2.0", result.getDataServiceVersion());
    for (Schema schema : result.getSchemas()) {
      for (ComplexType complexType : schema.getComplexTypes()) {
        if ("c_Location".equals(complexType.getName())) {
          assertNotNull(complexType.getBaseType());
          assertTrue(!complexType.isAbstract());
          assertEquals("c_BaseType_for_Location", complexType.getBaseType().getName());
View Full Code Here

  @Test
  public void testAssociation() throws XMLStreamException, EntityProviderException {
    XmlMetadataConsumer parser = new XmlMetadataConsumer();
    XMLStreamReader reader = createStreamReader(xmlWithAssociation);
    DataServices result = parser.readMetadata(reader, true);
    assertEquals("2.0", result.getDataServiceVersion());
    for (Schema schema : result.getSchemas()) {
      for (EntityType entityType : schema.getEntityTypes()) {
        if ("Manager".equals(entityType.getName())) {
          assertEquals("RefScenario", entityType.getBaseType().getNamespace());
          assertEquals("Employee", entityType.getBaseType().getName());
          for (NavigationProperty navProperty : entityType.getNavigationProperties()) {
View Full Code Here

  public void testTwoSchemas() throws XMLStreamException, EntityProviderException {
    int i = 0;
    String schemasNs[] = { NAMESPACE, NAMESPACE2 };
    XmlMetadataConsumer parser = new XmlMetadataConsumer();
    XMLStreamReader reader = createStreamReader(xmlWithTwoSchemas);
    DataServices result = parser.readMetadata(reader, true);
    assertEquals("2.0", result.getDataServiceVersion());
    assertEquals(2, result.getSchemas().size());
    for (Schema schema : result.getSchemas()) {
      assertEquals(schemasNs[i], schema.getNamespace());
      assertEquals(1, schema.getEntityTypes().size());
      i++;

    }
View Full Code Here

  @Test
  public void testProperties() throws EntityProviderException, XMLStreamException {
    XmlMetadataConsumer parser = new XmlMetadataConsumer();
    XMLStreamReader reader = createStreamReader(xmlWithTwoSchemas);
    DataServices result = parser.readMetadata(reader, true);
    for (Schema schema : result.getSchemas()) {
      for (EntityType entityType : schema.getEntityTypes()) {
        if ("Employee".equals(entityType.getName())) {
          for (Property property : entityType.getProperties()) {
            if (propertyNames[0].equals(property.getName())) {
              assertNotNull(property.getFacets());
View Full Code Here

            + "</EntityType>" + "<EntityContainer Name=\"Container1\" m:IsDefaultEntityContainer=\"true\">"
            + "<EntitySet Name=\"Employees\" EntityType=\"RefScenario.Employee\"/>" + "</EntityContainer>"
            + "</Schema>" + "</edmx:DataServices>" + "</edmx:Edmx>";
    XmlMetadataConsumer parser = new XmlMetadataConsumer();
    XMLStreamReader reader = createStreamReader(xmWithEntityContainer);
    DataServices result = parser.readMetadata(reader, true);
    for (Schema schema : result.getSchemas()) {
      for (EntityContainer container : schema.getEntityContainers()) {
        assertEquals("Container1", container.getName());
        assertEquals(Boolean.TRUE, container.isDefaultEntityContainer());
        for (EntitySet entitySet : container.getEntitySets()) {
          assertEquals("Employees", entitySet.getName());
View Full Code Here

  @Test
  public void testAssociationSet() throws XMLStreamException, EntityProviderException {
    XmlMetadataConsumer parser = new XmlMetadataConsumer();
    XMLStreamReader reader = createStreamReader(xmlWithAssociation);
    DataServices result = parser.readMetadata(reader, true);
    for (Schema schema : result.getSchemas()) {
      for (EntityContainer container : schema.getEntityContainers()) {
        assertEquals(NAMESPACE2, schema.getNamespace());
        assertEquals("Container1", container.getName());
        assertEquals(Boolean.TRUE, container.isDefaultEntityContainer());
        for (AssociationSet assocSet : container.getAssociationSets()) {
View Full Code Here

            "EntitySet=\"Employees\" m:HttpMethod=\"GET\">"
            + "<Parameter Name=\"q\" Type=\"Edm.String\" Nullable=\"true\" />"
            + "</FunctionImport>" + "</EntityContainer>" + "</Schema>" + "</edmx:DataServices>" + "</edmx:Edmx>";
    XmlMetadataConsumer parser = new XmlMetadataConsumer();
    XMLStreamReader reader = createStreamReader(xmWithEntityContainer);
    DataServices result = parser.readMetadata(reader, true);
    for (Schema schema : result.getSchemas()) {
      for (EntityContainer container : schema.getEntityContainers()) {
        assertEquals("Container1", container.getName());
        assertEquals(Boolean.TRUE, container.isDefaultEntityContainer());
        for (FunctionImport functionImport : container.getFunctionImports()) {
          assertEquals("EmployeeSearch", functionImport.getName());
View Full Code Here

            + propertyNames[0] + "\" Type=\"Edm.String\" Nullable=\"false\"/>" + "</EntityType>"
            + "<EntityType Name=\"Manager\" BaseType=\"RS.Employee\" m:HasStream=\"true\">" + "</EntityType>"
            + "</Schema>" + "</edmx:DataServices>" + "</edmx:Edmx>";
    XmlMetadataConsumer parser = new XmlMetadataConsumer();
    XMLStreamReader reader = createStreamReader(xml);
    DataServices result = parser.readMetadata(reader, true);
    for (Schema schema : result.getSchemas()) {
      assertEquals("RS", schema.getAlias());
      for (EntityType entityType : schema.getEntityTypes()) {
        if ("Manager".equals(entityType.getName())) {
          assertEquals("Employee", entityType.getBaseType().getName());
          assertEquals("RS", entityType.getBaseType().getNamespace());
View Full Code Here

TOP

Related Classes of org.apache.olingo.odata2.api.edm.provider.DataServices

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.