Examples of EdmStructuralType


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

  private void write(final Map<String, Object> oDataEntryProperties,
      final boolean isCreate)
      throws ODataJPARuntimeException {
    try {

      EdmStructuralType structuralType = null;
      final List<String> keyNames = oDataEntityType.getKeyPropertyNames();

      if (isCreate) {
        jpaEntity = instantiateJPAEntity();
      } else if (jpaEntity == null) {
View Full Code Here

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

    for (String edmPropertyName : edmComplexType.getPropertyNames()) {
      EdmTyped edmTyped = (EdmTyped) edmComplexType.getProperty(edmPropertyName);
      accessModifier = accessModifiers.get(edmPropertyName);
      if (edmTyped.getType().getKind().toString().equals(EdmTypeKind.COMPLEX.toString())) {
        EdmStructuralType structualType = (EdmStructuralType) edmTyped.getType();
        setComplexProperty(accessModifier, embeddableObject, structualType, (HashMap<String, Object>) propertyValue
            .get(edmPropertyName));
      } else {
        setProperty(accessModifier, embeddableObject, propertyValue.get(edmPropertyName), (EdmSimpleType) edmTyped
            .getType());
View Full Code Here

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

  @Test
  public void testparse2EdmPropertyValueMap() {
    JPAEntityParser resultParser = new JPAEntityParser();
    Object jpaEntity = new demoItem("abc", 10);
    EdmStructuralType structuralType = EasyMock.createMock(EdmStructuralType.class);
    EdmProperty edmTyped = EasyMock.createMock(EdmProperty.class);
    EdmType edmType = EasyMock.createMock(EdmType.class);
    EdmProperty edmTyped01 = EasyMock.createMock(EdmProperty.class);
    EdmType edmType01 = EasyMock.createMock(EdmType.class);
    EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
    EdmMapping edmMapping01 = EasyMock.createMock(EdmMapping.class);

    try {
      EasyMock.expect(edmType.getKind()).andStubReturn(EdmTypeKind.SIMPLE);
      EasyMock.expect(edmTyped.getName()).andStubReturn("identifier");
      EasyMock.replay(edmType);
      EasyMock.expect(edmMapping.getInternalName()).andStubReturn("id");
      EasyMock.replay(edmMapping);
      EasyMock.expect(edmTyped.getType()).andStubReturn(edmType);
      EasyMock.expect(edmTyped.getMapping()).andStubReturn(edmMapping);
      EasyMock.replay(edmTyped);
      EasyMock.expect(structuralType.getProperty("identifier")).andStubReturn(edmTyped);

      EasyMock.expect(edmType01.getKind()).andStubReturn(EdmTypeKind.SIMPLE);
      EasyMock.expect(edmTyped01.getName()).andStubReturn("Value");
      EasyMock.replay(edmType01);
      EasyMock.expect(edmMapping01.getInternalName()).andStubReturn("value");
      EasyMock.replay(edmMapping01);
      EasyMock.expect(edmTyped01.getType()).andStubReturn(edmType01);
      EasyMock.expect(edmTyped01.getMapping()).andStubReturn(edmMapping01);
      EasyMock.replay(edmTyped01);
      EasyMock.expect(structuralType.getProperty("value")).andStubReturn(edmTyped01);

      List<String> propNames = new ArrayList<String>();
      propNames.add("identifier");
      propNames.add("value");
      EasyMock.expect(structuralType.getPropertyNames()).andReturn(propNames);
      EasyMock.replay(structuralType);

    } catch (EdmException e) {
      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
    }
View Full Code Here

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

  @Test
  public void testparse2EdmPropertyValueMapEdmExcep() {
    JPAEntityParser resultParser = new JPAEntityParser();
    Object jpaEntity = new demoItem("abc", 10);
    EdmStructuralType structuralType = EasyMock
        .createMock(EdmStructuralType.class);
    EdmProperty edmTyped = EasyMock.createMock(EdmProperty.class);
    EdmType edmType = EasyMock.createMock(EdmType.class);
    EdmProperty edmTyped01 = EasyMock.createMock(EdmProperty.class);
    EdmType edmType01 = EasyMock.createMock(EdmType.class);
    EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
    EdmMapping edmMapping01 = EasyMock.createMock(EdmMapping.class);

    try {
      EasyMock.expect(edmType.getKind())
          .andStubReturn(EdmTypeKind.SIMPLE);
      EasyMock.expect(edmType.getName()).andReturn("identifier");
      EasyMock.replay(edmType);
      EasyMock.expect(edmMapping.getInternalName()).andStubReturn("id");
      EasyMock.replay(edmMapping);
      EasyMock.expect(edmTyped.getType()).andStubThrow(
          new EdmException(null));
      EasyMock.expect(edmTyped.getMapping()).andStubReturn(edmMapping);
      EasyMock.expect(edmTyped.getName()).andReturn("identifier").anyTimes();
      EasyMock.replay(edmTyped);
      EasyMock.expect(structuralType.getProperty("identifier"))
          .andStubReturn(edmTyped);

      EasyMock.expect(edmType01.getKind()).andStubReturn(
          EdmTypeKind.SIMPLE);
      EasyMock.expect(edmType01.getName()).andStubReturn("value");
      EasyMock.replay(edmType01);
      EasyMock.expect(edmMapping01.getInternalName()).andStubReturn(
          "value");
      EasyMock.replay(edmMapping01);
      EasyMock.expect(edmTyped01.getName()).andReturn("value").anyTimes();
      EasyMock.expect(edmTyped01.getType()).andStubReturn(edmType01);
      EasyMock.expect(edmTyped01.getMapping())
          .andStubReturn(edmMapping01);
      EasyMock.replay(edmTyped01);
      EasyMock.expect(structuralType.getProperty("value")).andStubReturn(
          edmTyped01);

      List<String> propNames = new ArrayList<String>();
      propNames.add("identifier");
      propNames.add("value");
      EasyMock.expect(structuralType.getPropertyNames()).andReturn(
          propNames);
      EasyMock.replay(structuralType);

    } catch (EdmException e) {
      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
View Full Code Here

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

    // Mocking EdmProperties
    EdmProperty edmProperty1 = EasyMock.createMock(EdmProperty.class);
    EdmProperty edmProperty2 = EasyMock.createMock(EdmProperty.class);
    EdmProperty edmComplexProperty = EasyMock.createMock(EdmProperty.class);
    EdmType edmType1 = EasyMock.createMock(EdmType.class);
    EdmStructuralType edmType2 = EasyMock.createMock(EdmStructuralType.class);
    EdmType edmComplexType = EasyMock.createMock(EdmType.class);
    EdmMapping mapping1 = EasyMock.createMock(EdmMapping.class);
    EdmMapping mapping2 = EasyMock.createMock(EdmMapping.class);
    EdmMapping complexMapping = EasyMock.createMock(EdmMapping.class);
    try {
      EasyMock.expect(edmType1.getKind()).andStubReturn(EdmTypeKind.SIMPLE);
      EasyMock.replay(edmType1);
      EasyMock.expect(mapping1.getInternalName()).andStubReturn("id");
      EasyMock.replay(mapping1);
      EasyMock.expect(edmProperty1.getName()).andStubReturn("Id");
      EasyMock.expect(edmProperty1.getMapping()).andStubReturn(mapping1);
      EasyMock.expect(edmProperty1.getType()).andStubReturn(edmType1);
      EasyMock.replay(edmProperty1);
      // Mocking the complex properties
      EasyMock.expect(edmComplexType.getKind()).andStubReturn(EdmTypeKind.SIMPLE);
      EasyMock.replay(edmComplexType);
      EasyMock.expect(complexMapping.getInternalName()).andStubReturn("order");
      EasyMock.replay(complexMapping);
      EasyMock.expect(edmComplexProperty.getName()).andStubReturn("OrderName");
      EasyMock.expect(edmComplexProperty.getMapping()).andStubReturn(complexMapping);
      EasyMock.expect(edmComplexProperty.getType()).andStubReturn(edmComplexType);
      EasyMock.replay(edmComplexProperty);
      EasyMock.expect(edmType2.getKind()).andStubReturn(EdmTypeKind.COMPLEX);
      EasyMock.expect(edmType2.getProperty("OrderName")).andStubReturn(edmComplexProperty);
      List<String> propertyNames = new ArrayList<String>();
      propertyNames.add("OrderName");
      EasyMock.expect(edmType2.getPropertyNames()).andStubReturn(propertyNames);
      EasyMock.replay(edmType2);
      EasyMock.expect(mapping2.getInternalName()).andStubReturn("relatedEntity");
      EasyMock.replay(mapping2);
      EasyMock.expect(edmProperty2.getName()).andStubReturn("Order");
      EasyMock.expect(edmProperty2.getMapping()).andStubReturn(mapping2);
View Full Code Here

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

  @Test
  public void testGetGetterEdmException() {
    JPAEntityParser resultParser = new JPAEntityParser();
    Object jpaEntity = new demoItem("abc", 10);
    EdmStructuralType structuralType = EasyMock.createMock(EdmStructuralType.class);
    try {
      EasyMock.expect(structuralType.getPropertyNames()).andStubThrow(new EdmException(null));
      EasyMock.replay(structuralType);
      Method getGetters =
          resultParser.getClass().getDeclaredMethod("getGetters", Object.class, EdmStructuralType.class);
      getGetters.setAccessible(true);
      try {
View Full Code Here

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

  }

  @Test
  public void testForNullJPAEntity() {
    JPAEntityParser resultParser = new JPAEntityParser();
    EdmStructuralType structuralType = EasyMock.createMock(EdmStructuralType.class);
    Object map;
    try {
      map = resultParser.parse2EdmPropertyValueMap(null, structuralType);
      assertNull(map);
    } catch (ODataJPARuntimeException e) {
View Full Code Here

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

  private void write(final Map<String, Object> oDataEntryProperties,
      final boolean isCreate)
      throws ODataJPARuntimeException {
    try {

      EdmStructuralType structuralType = null;
      final List<String> keyNames = oDataEntityType.getKeyPropertyNames();

      if (isCreate) {
        jpaEntity = instantiateJPAEntity();
      } else if (jpaEntity == null) {
View Full Code Here

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

    for (String edmPropertyName : edmComplexType.getPropertyNames()) {
      EdmTyped edmTyped = (EdmTyped) edmComplexType.getProperty(edmPropertyName);
      accessModifier = accessModifiers.get(edmPropertyName);
      if (edmTyped.getType().getKind().toString().equals(EdmTypeKind.COMPLEX.toString())) {
        EdmStructuralType structualType = (EdmStructuralType) edmTyped.getType();
        setComplexProperty(accessModifier, embeddableObject, structualType, (HashMap<String, Object>) propertyValue
            .get(edmPropertyName));
      } else {
        setProperty(accessModifier, embeddableObject, propertyValue.get(edmPropertyName));
      }
View Full Code Here

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

  @SuppressWarnings("unchecked")
  private void write(final Map<String, Object> oDataEntryProperties, final boolean isCreate)
      throws ODataJPARuntimeException {
    try {

      EdmStructuralType structuralType = null;
      final List<String> keyNames = oDataEntityType.getKeyPropertyNames();

      if (isCreate) {
        jpaEntity = instantiateJPAEntity();
      } else if (jpaEntity == null) {
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.