Examples of EdmFacets


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

  }

  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

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

  @Test(expected = EntityProviderException.class)
  public void simplePropertyViolatingValidation() throws Exception {
    EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Room")
        .getProperty("Name");
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.getMaxLength()).thenReturn(10);
    when(property.getFacets()).thenReturn(facets);
    new JsonPropertyConsumer().readPropertyStandalone(prepareReader("{\"Name\":\"TooLongName\"}"), property, null);
  }
View Full Code Here

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

  @Test
  public void simplePropertyIgnoringValidation() throws Exception {
    EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Room")
        .getProperty("Name");
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.getMaxLength()).thenReturn(10);
    when(property.getFacets()).thenReturn(facets);
    final EntityProviderReadProperties readProperties = mock(EntityProviderReadProperties.class);
    final Map<String, Object> resultMap = new JsonPropertyConsumer()
        .readPropertyStandalone(prepareReader("{\"Name\":\"TooLongName\"}"), property, readProperties);
    assertTrue(resultMap.containsKey("Name"));
View Full Code Here

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

  @Test(expected = EntityProviderException.class)
  public void simplePropertyNullValueNotAllowed() throws Exception {
    JsonReader reader = prepareReader("{\"Age\":null}");
    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 JsonPropertyConsumer().readPropertyStandalone(reader, property, null);
  }
View Full Code Here

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

    final String locationProperty = "{\"Location\":null}";
    JsonReader reader = prepareReader(locationProperty);
    EdmProperty property =
        (EdmProperty) MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees").getEntityType()
            .getProperty("Location");
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.isNullable()).thenReturn(false);
    when(property.getFacets()).thenReturn(facets);

    new JsonPropertyConsumer().readPropertyStandalone(reader, property, null);
  }
View Full Code Here

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

  @Test
  public void complexPropertyNullValueNotAllowedButNotValidated() throws Exception {
    final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getDefaultEntityContainer()
        .getEntitySet("Employees").getEntityType().getProperty("Location");
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.isNullable()).thenReturn(false);
    when(property.getFacets()).thenReturn(facets);
    final EntityProviderReadProperties readProperties = mock(EntityProviderReadProperties.class);

    final Map<String, Object> propertyData = new JsonPropertyConsumer()
        .readPropertyStandalone(prepareReader("{\"Location\":null}"), property, readProperties);
View Full Code Here

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

        break;
      }
    }

    final Class<?> typeMappingClass = typeMapping == null ? type.getDefaultType() : (Class<?>) typeMapping;
    final EdmFacets facets = readProperties == null || readProperties.isValidatingFacets() ?
        entityPropertyInfo.getFacets() : null;
    return type.valueOfString((String) value, EdmLiteralKind.JSON, facets, typeMappingClass);
  }
View Full Code Here

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

        if (info.isComplex()) {
          Map<String, Object> defaultValue = new HashMap<String, Object>();
          mergeComplexWithDefaultValues(defaultValue, ecpi);
          complexValue.put(info.getName(), defaultValue);
        } else {
          EdmFacets facets = info.getFacets();
          if (facets != null) {
            complexValue.put(info.getName(), facets.getDefaultValue());
          }
        }
      }
    }
  }
View Full Code Here

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

    assertEquals("Edm.String", EdmString.getInstance().toString());
    assertEquals("Edm.Time", EdmTime.getInstance().toString());
  }

  private EdmFacets getMaxLengthFacets(final Integer maxLength) {
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.getMaxLength()).thenReturn(maxLength);
    return facets;
  }
View Full Code Here

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
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.