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

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


*/
public class JsonServiceDocumentProducerTest extends BaseTest {

  @Test
  public void serviceDocumentEmpty() throws Exception {
    Edm edm = mock(Edm.class);
    EdmServiceMetadata metadata = mock(EdmServiceMetadata.class);
    when(edm.getServiceMetadata()).thenReturn(metadata);
    final ODataResponse response = new JsonEntityProvider().writeServiceDocument(edm, "http://host:80/service/");
    assertNotNull(response);
    assertNotNull(response.getEntity());
    assertNull("EntitypProvider must not set content header", response.getContentHeader());
    assertEquals(ODataServiceVersion.V10, response.getHeader(ODataHttpHeaders.DATASERVICEVERSION));
View Full Code Here


    assertEquals("{\"d\":{\"EntitySets\":[]}}", json);
  }

  @Test
  public void serviceDocument() throws Exception {
    Edm edm = mock(Edm.class);
    EdmServiceMetadata metadata = mock(EdmServiceMetadata.class);
    EdmEntitySetInfo entitySetInfo1 = mock(EdmEntitySetInfo.class);
    when(entitySetInfo1.getEntitySetUri()).thenReturn(URI.create("EntitySet"));
    EdmEntitySetInfo entitySetInfo2 = mock(EdmEntitySetInfo.class);
    when(entitySetInfo2.getEntitySetUri()).thenReturn(URI.create("Container2.EntitySet2"));
    when(metadata.getEntitySetInfos()).thenReturn(Arrays.asList(entitySetInfo1, entitySetInfo2));
    when(edm.getServiceMetadata()).thenReturn(metadata);
    final ODataResponse response = new JsonEntityProvider().writeServiceDocument(edm, "http://host:80/service/");
    assertNotNull(response);
    assertNotNull(response.getEntity());
    assertNull("EntitypProvider must not set content header", response.getContentHeader());
    assertEquals(ODataServiceVersion.V10, response.getHeader(ODataHttpHeaders.DATASERVICEVERSION));
View Full Code Here

  @Test
  public void dummy() throws Exception {}

  @Test
  public void testEdm() throws Exception {
    Edm edm = client.getEdm();
    assertNotNull(edm);
    assertNotNull(edm.getDefaultEntityContainer());
  }
View Full Code Here

public class EdmxProviderTest {

  @Test
  public void getElementsWithAlias() throws Exception {
    Edm edm = createEdm();
    assertNotNull(edm);

    assertNotNull(edm.getEntityType("Self", "Employee"));
    assertNotNull(edm.getEntityType("Self", "Room"));
    assertNotNull(edm.getEntityType("Self", "Manager"));
    assertNotNull(edm.getEntityType("Self", "Team"));
    assertNotNull(edm.getEntityType("Self", "Building"));

    assertNotNull(edm.getAssociation("Self", "BuildingRooms"));
    assertNotNull(edm.getAssociation("Self", "ManagerEmployees"));
    assertNotNull(edm.getAssociation("Self", "TeamEmployees"));
    assertNotNull(edm.getAssociation("Self", "RoomEmployees"));

    assertNotNull(edm.getComplexType("Self", "c_Location"));
    assertNotNull(edm.getComplexType("Self", "c_City"));
  }
View Full Code Here

    assertNotNull(edm.getComplexType("Self", "c_City"));
  }

  @Test
  public void annotationsAtSimpleProperty() throws Exception {
    Edm edm = createEdm();
    assertNotNull(edm);
    EdmProperty property = (EdmProperty) edm.getEntityType("Self", "Employee").getProperty("EmployeeName");
    assertNotNull(property);

    EdmAnnotations annotations = property.getAnnotations();
    assertNotNull(annotations);
    List<EdmAnnotationAttribute> annotationAttributes = annotations.getAnnotationAttributes();
View Full Code Here

    assertNull(annotationElements.get(0).getChildElements());
  }

  @Test
  public void nullAnnotationsAtEntityType() throws Exception {
    Edm edm = createEdm();
    assertNotNull(edm);
    EdmAnnotations annotations = edm.getEntityType("Self", "Employee").getAnnotations();
    checkNullAnnotations(annotations);
  }
View Full Code Here

    checkNullAnnotations(annotations);
  }

  @Test
  public void nullAnnotationsAtComplexType() throws Exception {
    Edm edm = createEdm();
    assertNotNull(edm);
    EdmAnnotations annotations = edm.getComplexType("Self", "c_Location").getAnnotations();
    checkNullAnnotations(annotations);
  }
View Full Code Here

    checkNullAnnotations(annotations);
  }

  @Test
  public void nullAnnotationsAtSimpleProperty() throws Exception {
    Edm edm = createEdm();
    assertNotNull(edm);
    EdmProperty property = (EdmProperty) edm.getEntityType("Self", "Employee").getProperty("RoomId");
    EdmAnnotations annotations = property.getAnnotations();
    checkNullAnnotations(annotations);
  }
View Full Code Here

    checkNullAnnotations(annotations);
  }

  @Test
  public void nullAnnotationsAtComplexProperty() throws Exception {
    Edm edm = createEdm();
    assertNotNull(edm);
    EdmProperty property = (EdmProperty) edm.getEntityType("Self", "Employee").getProperty("Location");
    EdmAnnotations annotations = property.getAnnotations();
    checkNullAnnotations(annotations);
  }
View Full Code Here

    checkNullAnnotations(annotations);
  }

  @Test
  public void nullAnnotationsAtAssociation() throws Exception {
    Edm edm = createEdm();
    assertNotNull(edm);
    EdmAnnotations annotations = edm.getAssociation("Self", "BuildingRooms").getAnnotations();
    checkNullAnnotations(annotations);
  }
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.