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

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


    when(facets.getMaxLength()).thenReturn(maxLength);
    return facets;
  }

  private EdmFacets getNullableFacets(final Boolean nullable) {
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.isNullable()).thenReturn(nullable);
    return facets;
  }
View Full Code Here


    when(facets.isNullable()).thenReturn(nullable);
    return facets;
  }

  private EdmFacets getPrecisionScaleFacets(final Integer precision, final Integer scale) {
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.getPrecision()).thenReturn(precision);
    when(facets.getScale()).thenReturn(scale);
    return facets;
  }
View Full Code Here

    when(facets.getScale()).thenReturn(scale);
    return facets;
  }

  private EdmFacets getUnicodeFacets(final Boolean unicode) {
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.isUnicode()).thenReturn(unicode);
    when(facets.getMaxLength()).thenReturn(null);
    return facets;
  }
View Full Code Here

  @Test
  public void valueToStringDateTimeSpecial() throws Exception {

    for (int precision = 0; precision < 3; precision++) {
      final EdmSimpleType instance = EdmSimpleTypeKind.DateTime.getEdmSimpleTypeInstance();
      final EdmFacets facets = getPrecisionScaleFacets(precision, null);
      final Calendar date = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
      date.set(Calendar.MILLISECOND, 10 * precision + 1);

      date.set(1954, 7, 4);
      expectErrorInValueToString(instance, date, EdmLiteralKind.DEFAULT, facets,
View Full Code Here

  }

  private static boolean hasConcurrencyControl(final EdmEntityType entityType) throws EdmException {
    boolean concurrency = false;
    for (final String propertyName : entityType.getPropertyNames()) {
      final EdmFacets facets = ((EdmProperty) entityType.getProperty(propertyName)).getFacets();
      if (facets != null && facets.getConcurrencyMode() != null
          && facets.getConcurrencyMode() == EdmConcurrencyMode.Fixed) {
        concurrency = true;
        break;
      }
    }
    return concurrency;
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

    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

    final String xml = "<Age xmlns=\"" + Edm.NAMESPACE_D_2007_08
        + "\" m:null=\"true\" xmlns:m=\"" + Edm.NAMESPACE_M_2007_08 + "\" />";
    XMLStreamReader reader = createReaderForTest(xml, true);
    EdmProperty property =
        (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age");
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.isNullable()).thenReturn(false);
    when(property.getFacets()).thenReturn(facets);

    new XmlPropertyConsumer().readProperty(reader, property, false);
  }
View Full Code Here

    final String xml = "<Location xmlns=\"" + Edm.NAMESPACE_D_2007_08
        + "\" m:null=\"true\" xmlns:m=\"" + Edm.NAMESPACE_M_2007_08 + "\" />";
    XMLStreamReader reader = createReaderForTest(xml, true);
    EdmProperty property =
        (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.isNullable()).thenReturn(false);
    when(property.getFacets()).thenReturn(facets);

    new XmlPropertyConsumer().readProperty(reader, property, false);
  }
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.