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

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


  @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 =
View Full Code Here


    }
    return mockedEdmProperty;
  }

  private EdmFacets getEdmFacetsMockedObj() {
    EdmFacets facets = EasyMock.createMock(EdmFacets.class);
    EasyMock.expect(facets.getConcurrencyMode()).andStubReturn(EdmConcurrencyMode.Fixed);

    EasyMock.replay(facets);
    return facets;
  }
View Full Code Here

            "  </content>" +
            "</entry>";

    final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");
    final EdmProperty property = (EdmProperty) entitySet.getEntityType().getProperty("Version");
    EdmFacets facets = property.getFacets();
    Mockito.when(facets.isNullable()).thenReturn(false);

    InputStream reqContent = createContentAsStream(roomWithValidNamespaces);
    final ODataEntry result =
        new XmlEntityConsumer().readEntry(entitySet, reqContent, EntityProviderReadProperties.init().mergeSemantic(
            false).build());
View Full Code Here

    }
    return mockedEdmProperty;
  }

  private EdmFacets getEdmFacetsMockedObj() {
    EdmFacets facets = EasyMock.createMock(EdmFacets.class);
    EasyMock.expect(facets.getConcurrencyMode()).andStubReturn(EdmConcurrencyMode.Fixed);

    EasyMock.replay(facets);
    return facets;
  }
View Full Code Here

    List<FunctionImport> functionImportList = jpaEdmfunctionImport.getConsistentFunctionImportList();

    assertEquals(functionImportList.size(), 1);

    List<FunctionImportParameter> funcImpParamList = functionImportList.get(0).getParameters();
    EdmFacets facets = funcImpParamList.get(0).getFacets();
    assertNotNull(facets);
    assertEquals(2, facets.getMaxLength().intValue());
    assertEquals(true, facets.isNullable());

    facets = funcImpParamList.get(1).getFacets();
    assertNotNull(facets);
    assertEquals(false, facets.isNullable());
    assertEquals(10, facets.getPrecision().intValue());
    assertEquals(2, facets.getScale().intValue());

  }
View Full Code Here

    List<FunctionImport> functionImportList = jpaEdmfunctionImport.getConsistentFunctionImportList();

    assertEquals(functionImportList.size(), 1);

    List<FunctionImportParameter> funcImpParamList = functionImportList.get(0).getParameters();
    EdmFacets facets = funcImpParamList.get(0).getFacets();
    assertNotNull(facets);
    assertNull(facets.getMaxLength());
    assertEquals(false, facets.isNullable());
    assertNull(facets.getPrecision());
    assertNull(facets.getScale());

  }
View Full Code Here

    List<FunctionImport> functionImportList = jpaEdmfunctionImport.getConsistentFunctionImportList();

    assertEquals(functionImportList.size(), 1);

    List<FunctionImportParameter> funcImpParamList = functionImportList.get(0).getParameters();
    EdmFacets facets = funcImpParamList.get(0).getFacets();
    assertNotNull(facets);
    assertEquals(2, facets.getMaxLength().intValue());
    assertEquals(true, facets.isNullable());

    facets = funcImpParamList.get(1).getFacets();
    assertNotNull(facets);
    assertEquals(false, facets.isNullable());
    assertEquals(10, facets.getPrecision().intValue());
    assertEquals(2, facets.getScale().intValue());

  }
View Full Code Here

    List<FunctionImport> functionImportList = jpaEdmfunctionImport.getConsistentFunctionImportList();

    assertEquals(functionImportList.size(), 1);

    List<FunctionImportParameter> funcImpParamList = functionImportList.get(0).getParameters();
    EdmFacets facets = funcImpParamList.get(0).getFacets();
    assertNotNull(facets);
    assertNull(facets.getMaxLength());
    assertEquals(false, facets.isNullable());
    assertNull(facets.getPrecision());
    assertNull(facets.getScale());

  }
View Full Code Here

            break;

        case URI3:
            // complex property
            final List<EdmProperty> complexPropertyPath = uriInfo.getPropertyPath();
            final EdmProperty complexProperty = complexPropertyPath.get(complexPropertyPath.size() - 1);
            response = (T) EntityProvider.readProperty(getContentType(),
                complexProperty, content, EntityProviderReadProperties.init().build());
            break;

        case URI4:
        case URI5:
            // simple property
            final List<EdmProperty> simplePropertyPath = uriInfo.getPropertyPath();
            final EdmProperty simpleProperty = simplePropertyPath.get(simplePropertyPath.size() - 1);
            if (uriInfo.isValue()) {
                response = (T) EntityProvider.readPropertyValue(simpleProperty, content);
            } else {
                response = (T) EntityProvider.readProperty(getContentType(),
                    simpleProperty, content, EntityProviderReadProperties.init().build());
View Full Code Here

                        case URI4:
                        case URI5:
                            // simple property
                            // get the response content as Object for $value or Map<String, Object> otherwise
                            final List<EdmProperty> simplePropertyPath = uriInfo.getPropertyPath();
                            final EdmProperty simpleProperty = simplePropertyPath.get(simplePropertyPath.size() - 1);
                            if (uriInfo.isValue()) {
                                responseHandler.onResponse(
                                    (T) EntityProvider.readPropertyValue(simpleProperty,
                                        result.getEntity().getContent()));
                            } else {
                                responseHandler.onResponse(
                                    (T) EntityProvider.readProperty(getContentType(), simpleProperty,
                                        result.getEntity().getContent(),
                                        EntityProviderReadProperties.init().build()));
                            }
                            break;

                        case URI3:
                            // complex property
                            // get the response content as Map<String, Object>
                            final List<EdmProperty> complexPropertyPath = uriInfo.getPropertyPath();
                            final EdmProperty complexProperty = complexPropertyPath.get(complexPropertyPath.size() - 1);
                            responseHandler.onResponse((T)EntityProvider.readProperty(getContentType(),
                                                                                      complexProperty, result
                                                                                          .getEntity()
                                                                                          .getContent(),
                                                                                      EntityProviderReadProperties
View Full Code Here

TOP

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

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.