Examples of EdmMapping


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

  @Test
  public void getMappingValueNullMapping() throws Exception {

    SimpleEntity data = new SimpleEntity();
    data.myMappedProperty = "property";
    EdmMapping mapping = null;

    Object value = ava.getMappingValue(data, mapping);

    Assert.assertNull(value);
  }
View Full Code Here

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

  @Test
  public void getMappingValueNullValue() throws Exception {

    SimpleEntity data = new SimpleEntity();
    data.myMappedProperty = null;
    EdmMapping mapping = mockMapping("getMyMappedProperty");

    Object value = ava.getMappingValue(data, mapping);

    Assert.assertNull(value);
  }
View Full Code Here

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

  @Test
  public void setMappingValue() throws Exception {

    SimpleEntity data = new SimpleEntity();
    data.myMappedProperty = "mapped property value";
    EdmMapping mapping = mockMapping("getMyMappedProperty");

    Object value = "Changed mapped property value";
    ava.setMappingValue(data, mapping, value);

    Assert.assertEquals("Changed mapped property value", data.myMappedProperty);
View Full Code Here

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

  @Test
  public void setMappingValueNullValue() throws Exception {

    SimpleEntity data = new SimpleEntity();
    data.myMappedProperty = "mapped property value";
    EdmMapping mapping = mockMapping("getMyMappedProperty");

    Object value = null;
    ava.setMappingValue(data, mapping, value);

    Assert.assertNull(data.myMappedProperty);
View Full Code Here

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

  @Test
  public void setMappingValueNullMapping() throws Exception {

    SimpleEntity data = new SimpleEntity();
    data.myMappedProperty = "mapped property value";
    EdmMapping mapping = null;

    Object value = null;
    ava.setMappingValue(data, mapping, value);

    Assert.assertEquals("mapped property value", data.myMappedProperty);
View Full Code Here

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

  @Test(expected = ODataNotFoundException.class)
  public void invalidMethodName() throws Exception {

    SimpleEntity data = new SimpleEntity();
    data.myMappedProperty = null;
    EdmMapping mapping = mockMapping("MyMappedProperty");

    Object value = ava.getMappingValue(data, mapping);

    Assert.assertNull(value);
  }
View Full Code Here

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

    }
    return property;
  }

  private EdmMapping mockMapping(final String mimeTypeKey) throws EdmException {
    EdmMapping mapping = Mockito.mock(EdmMapping.class);
    Mockito.when(mapping.getMediaResourceMimeTypeKey()).thenReturn(mimeTypeKey);
    return mapping;
  }
View Full Code Here

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

    } catch (EdmSimpleTypeException e1) {
      fail("There is an exception in mocking EdmType object " + e1.getMessage());
    }
    EasyMock.replay(edmType);
    EdmProperty edmProperty = EasyMock.createMock(EdmProperty.class);
    EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
    EasyMock.expect(edmMapping.getInternalName()).andStubReturn("soId");
    EasyMock.expect(edmMapping.getMimeType()).andReturn(null);
    EasyMock.replay(edmMapping);
    try {
      EasyMock.expect(edmProperty.getName()).andStubReturn("ID");
      EasyMock.expect(edmProperty.getType()).andStubReturn(edmType);
      EasyMock.expect(edmProperty.getMapping()).andStubReturn(edmMapping);
View Full Code Here

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

    List<EdmProperty> edmProperties = new ArrayList<EdmProperty>();
    EdmType edmType = EasyMock.createMock(EdmType.class);
    EasyMock.expect(edmType.getKind()).andStubReturn(EdmTypeKind.SIMPLE);
    EasyMock.replay(edmType);
    EdmProperty edmProperty = EasyMock.createMock(EdmProperty.class);
    EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
    EasyMock.expect(edmMapping.getInternalName()).andStubReturn("soId");
    EasyMock.replay(edmMapping);
    try {
      EasyMock.expect(edmProperty.getName()).andStubReturn("ID");
      EasyMock.expect(edmProperty.getType()).andStubReturn(edmType);
      EasyMock.expect(edmProperty.getMapping()).andStubReturn(edmMapping);
View Full Code Here

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

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