Examples of ServiceDocument


Examples of org.apache.olingo.odata2.api.servicedocument.ServiceDocument

    @Test
    public void testRead() throws Exception {
        final Map<String, Object> headers = new HashMap<String, Object>();

        // read ServiceDocument
        final ServiceDocument document = requestBodyAndHeaders("direct://READSERVICEDOC", null, headers);
        assertNotNull(document);
        assertFalse("ServiceDocument entity sets", document.getEntitySetsInfo().isEmpty());
        LOG.info("Service document has {} entity sets", document.getEntitySetsInfo().size());

        // parameter type is java.util.Map
        final HashMap<String, String> queryParams = new HashMap<String, String>();
        queryParams.put(SystemQueryOption.$top.name(), "5");
        headers.put("CamelOlingo2.queryParams", queryParams);
View Full Code Here

Examples of org.apache.olingo.odata2.api.servicedocument.ServiceDocument

        final TestOlingo2ResponseHandler<ServiceDocument> responseHandler =
            new TestOlingo2ResponseHandler<ServiceDocument>();

        olingoApp.read(null, "", null, responseHandler);

        final ServiceDocument serviceDocument = responseHandler.await();
        final List<Collection> collections = serviceDocument.getAtomInfo().getWorkspaces().get(0).getCollections();
        assertEquals("Service Atom Collections", 3, collections.size());
        LOG.info("Service Atom Collections:  {}", collections);

        final List<EdmEntitySetInfo> entitySetsInfo = serviceDocument.getEntitySetsInfo();
        assertEquals("Service Entity Sets", 3, entitySetsInfo.size());
        LOG.info("Service Document Entries:  {}", entitySetsInfo);
    }
View Full Code Here

Examples of org.apache.olingo.odata2.api.servicedocument.ServiceDocument

  }

  @Test
  public void testAtomServiceDocument() throws EntityProviderException {
    InputStream in = ClassLoader.class.getResourceAsStream("/svcExample.xml");
    ServiceDocument serviceDocument = EntityProvider.readServiceDocument(in, "application/atom+xml");
    assertNotNull(serviceDocument);
    AtomInfo atomInfo = serviceDocument.getAtomInfo();
    assertNotNull(atomInfo);
    for (Workspace workspace : atomInfo.getWorkspaces()) {
      assertEquals(10, workspace.getCollections().size());
      for (Collection collection : workspace.getCollections()) {
        assertNotNull(collection.getExtesionElements().get(0));
View Full Code Here

Examples of org.apache.olingo.odata2.api.servicedocument.ServiceDocument

  }

  @Test
  public void testJsonServiceDocument() throws EntityProviderException {
    InputStream in = ClassLoader.class.getResourceAsStream("/svcDocJson.json");
    ServiceDocument serviceDoc = EntityProvider.readServiceDocument(in, "application/json");
    assertNotNull(serviceDoc);
    assertNull(serviceDoc.getAtomInfo());
    List<EdmEntitySetInfo> entitySetsInfo = serviceDoc.getEntitySetsInfo();
    assertEquals(6, entitySetsInfo.size());
    for (EdmEntitySetInfo entitySetInfo : entitySetsInfo) {
      if (!entitySetInfo.isDefaultEntityContainer()) {
        if ("Container2".equals(entitySetInfo.getEntityContainerName())) {
          assertEquals("Photos", entitySetInfo.getEntitySetName());
View Full Code Here

Examples of org.apache.olingo.odata2.api.servicedocument.ServiceDocument

  }

  @Test
  public void testCompareJsonWithAtom() throws EntityProviderException {
    InputStream inputJson = ClassLoader.class.getResourceAsStream("/svcDocJson.json");
    ServiceDocument serviceDocJson = EntityProvider.readServiceDocument(inputJson, "application/json");
    assertNotNull(serviceDocJson);
    List<EdmEntitySetInfo> entitySetsInfoJson = serviceDocJson.getEntitySetsInfo();

    InputStream inputAtom = ClassLoader.class.getResourceAsStream("/serviceDocument.xml");
    ServiceDocument serviceDocAtom = EntityProvider.readServiceDocument(inputAtom, "application/atom+xml");
    assertNotNull(serviceDocAtom);
    List<EdmEntitySetInfo> entitySetsInfoAtom = serviceDocAtom.getEntitySetsInfo();

    assertEquals(entitySetsInfoJson.size(), entitySetsInfoAtom.size());
    for (int i = 0; i < entitySetsInfoJson.size(); i++) {
      assertEquals(entitySetsInfoJson.get(i).getEntitySetUri(), entitySetsInfoAtom.get(i).getEntitySetUri());
    }
View Full Code Here

Examples of org.apache.olingo.odata2.api.servicedocument.ServiceDocument

  @Test
  public void test() throws EntityProviderException {
    JsonServiceDocumentConsumer parser = new JsonServiceDocumentConsumer();
    InputStream in = ClassLoader.class.getResourceAsStream("/svcDocJson.json");
    ServiceDocument serviceDoc = parser.parseJson(in);
    List<EdmEntitySetInfo> entitySetsInfo = serviceDoc.getEntitySetsInfo();
    assertNotNull(entitySetsInfo);
    assertEquals(6, entitySetsInfo.size());
    for (EdmEntitySetInfo entitySetInfo : entitySetsInfo) {
      if (!entitySetInfo.isDefaultEntityContainer()) {
        if ("Container2".equals(entitySetInfo.getEntityContainerName())) {
View Full Code Here

Examples of org.apache.olingo.odata2.api.servicedocument.ServiceDocument

  private static final String PREFIX = "foo";

  @Test
  public void testServiceDocument() throws IOException, EntityProviderException {
    AtomServiceDocumentConsumer svcDocumentParser = new AtomServiceDocumentConsumer();
    ServiceDocument svcDocument = svcDocumentParser.readServiceDokument(createStreamReader("/svcExample.xml"));
    assertNotNull(svcDocument);
    AtomInfo atomInfo = svcDocument.getAtomInfo();
    assertNotNull(atomInfo);
    assertNotNull(atomInfo.getWorkspaces());
    for (Workspace workspace : atomInfo.getWorkspaces()) {
      assertEquals("Data", workspace.getTitle().getText());
      assertEquals(10, workspace.getCollections().size());
View Full Code Here

Examples of org.apache.olingo.odata2.api.servicedocument.ServiceDocument

  }

  @Test
  public void testExtensionsWithAttributes() throws IOException, EntityProviderException {
    AtomServiceDocumentConsumer svcDocumentParser = new AtomServiceDocumentConsumer();
    ServiceDocument svcDocument = svcDocumentParser.readServiceDokument(createStreamReader("/svcExample.xml"));
    assertNotNull(svcDocument);
    AtomInfo atomInfo = svcDocument.getAtomInfo();
    assertNotNull(atomInfo);
    assertNotNull(atomInfo.getExtesionElements());
    assertEquals(2, atomInfo.getExtesionElements().size());
    for (ExtensionElement extElement : atomInfo.getExtesionElements()) {
      assertEquals("link", extElement.getName());
View Full Code Here

Examples of org.apache.olingo.odata2.api.servicedocument.ServiceDocument

  }

  @Test
  public void testServiceDocument2() throws IOException, EntityProviderException {
    AtomServiceDocumentConsumer svcDocumentParser = new AtomServiceDocumentConsumer();
    ServiceDocument svcDocument = svcDocumentParser.readServiceDokument(createStreamReader("/svcAtomExample.xml"));
    assertNotNull(svcDocument);
    AtomInfo atomInfo = svcDocument.getAtomInfo();
    assertNotNull(atomInfo);

    assertEquals(2, atomInfo.getWorkspaces().size());

    Workspace workspace = atomInfo.getWorkspaces().get(0);
View Full Code Here

Examples of org.apache.olingo.odata2.api.servicedocument.ServiceDocument

  }

  @Test
  public void testCategories() throws IOException, EntityProviderException {
    AtomServiceDocumentConsumer svcDocumentParser = new AtomServiceDocumentConsumer();
    ServiceDocument svcDocument = svcDocumentParser.readServiceDokument(createStreamReader("/svcAtomExample.xml"));
    assertNotNull(svcDocument);
    AtomInfo atomInfo = svcDocument.getAtomInfo();
    assertNotNull(atomInfo);

    assertEquals(2, atomInfo.getWorkspaces().size());

    Workspace workspace = atomInfo.getWorkspaces().get(0);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.