Package org.apache.olingo.odata2.api.servicedocument

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


  @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);
    assertEquals(2, workspace.getCollections().size());
    for (Collection collection : workspace.getCollections()) {
      for (Categories categories : collection.getCategories()) {
        assertEquals("http://example.com/cats/forMain.cats", categories.getHref());
      }
    }

    workspace = atomInfo.getWorkspaces().get(1);
    for (Collection collection : workspace.getCollections()) {
      for (Categories categories : collection.getCategories()) {
        assertEquals(Fixed.YES, categories.getFixed());
        for (Category category : categories.getCategoryList()) {
          assertEquals("http://example.org/extra-cats/", category.getScheme());
View Full Code Here


  @Test
  public void testNestedExtensions() throws IOException, EntityProviderException {
    AtomServiceDocumentConsumer svcDocumentParser = new AtomServiceDocumentConsumer();
    ServiceDocument svcDocument = svcDocumentParser.readServiceDokument(createStreamReader("/svcAtomExample.xml"));
    assertNotNull(svcDocument);
    AtomInfo atomInfo = svcDocument.getAtomInfo();
    assertNotNull(atomInfo);
    assertNotNull(atomInfo.getExtesionElements());
    for (ExtensionElement extElement : atomInfo.getExtesionElements()) {
      for (ExtensionElement nestedExtElement : extElement.getElements()) {
        if ("extension2".equals(nestedExtElement.getName())) {
          assertFalse(nestedExtElement.getAttributes().isEmpty());
          assertEquals("attributeValue", nestedExtElement.getAttributes().get(0).getText());
          assertEquals("attr", nestedExtElement.getAttributes().get(0).getName());
View Full Code Here

  @Test
  public void testServiceDocument3() throws IOException, EntityProviderException {
    AtomServiceDocumentConsumer svcDocumentParser = new AtomServiceDocumentConsumer();
    ServiceDocument svcDocument = svcDocumentParser.readServiceDokument(createStreamReader("/serviceDocExample.xml"));
    assertNotNull(svcDocument);
    AtomInfo atomInfo = svcDocument.getAtomInfo();
    assertNotNull(atomInfo);
    for (Workspace workspace : atomInfo.getWorkspaces()) {
      assertEquals("Data", workspace.getTitle().getText());
      assertEquals(9, workspace.getCollections().size());
      for (Collection collection : workspace.getCollections()) {
        assertNotNull(collection.getHref());
        if ("TravelagencyCollection".equals(collection.getHref())) {
View Full Code Here

        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

    } catch (EdmException e) {
      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
    }
    EasyMock.replay(navigationProperty);
    // Mocking the navigation property segments and adding to expand list
    NavigationPropertySegment navigationPropertySegment = EasyMock.createMock(NavigationPropertySegment.class);
    EasyMock.expect(navigationPropertySegment.getNavigationProperty()).andStubReturn(navigationProperty);
    EasyMock.expect(navigationPropertySegment.getTargetEntitySet()).andStubReturn(getTargetEntitySetForExpand());
    EasyMock.replay(navigationPropertySegment);
    navigationPropertyList.add(navigationPropertySegment);
    expandList.add(navigationPropertyList);
    // Mocking EntityUriInfo
    GetEntityUriInfo entityUriInfo = EasyMock.createMock(GetEntityUriInfo.class);
View Full Code Here

    } catch (EdmException e) {
      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
    }
    EasyMock.replay(navigationProperty);
    // Mocking the navigation property segments and adding to expand list
    NavigationPropertySegment navigationPropertySegment = EasyMock.createMock(NavigationPropertySegment.class);
    EasyMock.expect(navigationPropertySegment.getNavigationProperty()).andStubReturn(navigationProperty);
    EasyMock.expect(navigationPropertySegment.getTargetEntitySet()).andStubReturn(getTargetEntitySetForExpand());
    EasyMock.replay(navigationPropertySegment);
    navigationPropertyList.add(navigationPropertySegment);
    expandList.add(navigationPropertyList);
    // Mocking EntityUriInfo
    GetEntitySetUriInfo entitySetUriInfo = EasyMock.createMock(GetEntitySetUriInfo.class);
View Full Code Here

      EasyMock.expect(navigationProperty.getName()).andStubReturn(navPropertyName);
    } catch (EdmException e) {
      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
    }
    EasyMock.replay(navigationProperty);
    NavigationPropertySegment navPropertySegment = EasyMock.createMock(NavigationPropertySegment.class);
    EasyMock.expect(navPropertySegment.getNavigationProperty()).andStubReturn(navigationProperty);
    EasyMock.replay(navPropertySegment);
    return navPropertySegment;
  }
View Full Code Here

    return paging;
  }

  private PathInfo getLocalPathInfo() {
    PathInfo pathInfo = EasyMock.createMock(PathInfo.class);
    EasyMock.expect(pathInfo.getServiceRoot()).andStubReturn(getLocalURI());
    EasyMock.expect(pathInfo.getRequestUri()).andStubReturn(getRequestURI());
    EasyMock.replay(pathInfo);
    return pathInfo;
  }
View Full Code Here

    selectItems.add(getSelectItem());
    return selectItems;
  }

  private SelectItem getSelectItem() {
    SelectItem selectItem = EasyMock.createMock(SelectItem.class);
    EasyMock.expect(selectItem.getProperty()).andStubReturn(getEdmPropertyForSelect());
    List<NavigationPropertySegment> navigationSegmentList = new ArrayList<NavigationPropertySegment>();
    EasyMock.expect(selectItem.getNavigationPropertySegments()).andStubReturn(navigationSegmentList);
    EasyMock.expect(selectItem.isStar()).andReturn(false).anyTimes();
    EasyMock.replay(selectItem);
    return selectItem;
  }
View Full Code Here

  /*
   * This Unit is supposed to test the building of Entity Provider Properties for query with $expand
   */
  @Test
  public void testGetEntityProviderPropertiesQuery() {
    GetEntitySetUriInfo getEntitySetUriInfo = mockEntitySetUriInfoForExpand();
    ODataJPAContext oDataJPAContext = getODataJPAContext();
    // Building the edm entity
    List<Map<String, Object>> edmEntityList = new ArrayList<Map<String, Object>>();
    Map<String, Object> edmEntity = new HashMap<String, Object>();
    edmEntity.put("ID", 1);
View Full Code Here

TOP

Related Classes of org.apache.olingo.odata2.api.servicedocument.AtomInfo

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.