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

Examples of org.apache.olingo.odata2.api.edm.provider.EntityContainerInfo


        switch (uriInfo.getUriType()) {
        case URI4:
        case URI5:
            // simple property
            final List<EdmProperty> simplePropertyPath = uriInfo.getPropertyPath();
            final EdmProperty simpleProperty = simplePropertyPath.get(simplePropertyPath.size() - 1);
            responseContentType = simpleProperty.getMimeType();
            if (uriInfo.isValue()) {
                response = EntityProvider.writePropertyValue(simpleProperty, content);
                responseContentType = ContentType.TEXT_PLAIN_CS_UTF_8.toString();
            } else {
                response = EntityProvider.writeProperty(getContentType(), simpleProperty, content);
            }
            break;

        case URI3:
            // complex property
            final List<EdmProperty> complexPropertyPath = uriInfo.getPropertyPath();
            final EdmProperty complexProperty = complexPropertyPath.get(complexPropertyPath.size() - 1);
            response = EntityProvider.writeProperty(responseContentType, complexProperty, content);
            break;

        case URI7A:
            // $links with 0..1 cardinality property
View Full Code Here


    assertEquals(6, employee.getProperties().size());
    assertEquals(3, employee.getNavigationProperties().size());

    List<Schema> schemas = localAep.getSchemas();
    assertEquals(1, schemas.size());
    EntityContainerInfo info = localAep.getEntityContainerInfo(ModelSharedConstants.CONTAINER_1);
    assertTrue(info.isDefaultEntityContainer());
  }
View Full Code Here

  public void annotationProviderBasic() throws Exception {
    assertNotNull(aep);

    List<Schema> schemas = aep.getSchemas();
    assertEquals(1, schemas.size());
    EntityContainerInfo info = aep.getEntityContainerInfo(ModelSharedConstants.CONTAINER_1);
    assertTrue(info.isDefaultEntityContainer());

    FunctionImport funImp = aep.getFunctionImport(ModelSharedConstants.CONTAINER_1, "NoImport");
    assertNull(funImp);

    final FullQualifiedName associationFqn = new FullQualifiedName(
View Full Code Here

  public void annotationProviderGetDefaultContainer() throws Exception {
    assertNotNull(aep);

    List<Schema> schemas = aep.getSchemas();
    assertEquals(1, schemas.size());
    EntityContainerInfo info = aep.getEntityContainerInfo(null);
    assertTrue(info.isDefaultEntityContainer());
    assertEquals(ModelSharedConstants.CONTAINER_1, info.getName());
  }
View Full Code Here

  }

  @Override
  public EntityContainerInfo getEntityContainerInfo(final String name) throws ODataException {
    if ((name == null) || ENTITY_CONTAINER_1.equals(name)) {
      return new EntityContainerInfo().setName(ENTITY_CONTAINER_1).setDefaultEntityContainer(true);
    } else if (ENTITY_CONTAINER_2.equals(name)) {
      return new EntityContainerInfo().setName(name).setDefaultEntityContainer(false);
    }

    return null;
  }
View Full Code Here

  @BeforeClass
  public static void getEdmEntityContainerImpl() throws Exception {
    EdmProvider edmProvider = mock(EdmProvider.class);
    EdmImplProv edmImplProv = new EdmImplProv(edmProvider);

    EntityContainerInfo containerInfo = new EntityContainerInfo().setName("Container");
    when(edmProvider.getEntityContainerInfo("Container")).thenReturn(containerInfo);
    edmEntityContainer = new EdmEntityContainerImplProv(edmImplProv, containerInfo);

    EntitySet fooEntitySet = new EntitySet().setName("fooEntitySet");
    when(edmProvider.getEntitySet("Container", "fooEntitySet")).thenReturn(fooEntitySet);
View Full Code Here

    when(entityContainer.getAssociationSets()).thenReturn(associationSets);
    List<EntitySet> entitySets = new ArrayList<EntitySet>();
    when(entityContainer.getEntitySets()).thenReturn(entitySets);

    when(edmProvider.getEntityContainerInfo(containerParentName))
        .thenReturn(new EntityContainerInfo().setName(containerParentName));
    EntityContainerInfo entityContainerInfo =
        new EntityContainerInfo().setName(containerName).setExtendz(containerParentName);

    EntitySet entitySetFooFromParent = new EntitySet().setName("fooFromParent");
    entitySetsParent.add(entitySetFooFromParent);
    when(edmProvider.getEntitySet(containerParentName, "fooFromParent")).thenReturn(entitySetFooFromParent);
View Full Code Here

  public void defaultContainerNameGeneration() throws ODataException {
    @SuppressWarnings({ "unchecked", "rawtypes" })
    AnnotationEdmProvider localAep =
        new AnnotationEdmProvider((Collection) Arrays.asList(GeneratedNamesTestClass.class));

    EntityContainerInfo containerInfo = localAep.getEntityContainerInfo(null);
    assertNotNull(containerInfo);
    assertEquals("DefaultContainer", containerInfo.getName());
  }
View Full Code Here

  @Test
  public void defaultContainerNameDefined() throws ODataException {
    @SuppressWarnings({ "unchecked", "rawtypes" })
    AnnotationEdmProvider localAep = new AnnotationEdmProvider((Collection) Arrays.asList(DefinedNamesTestClass.class));

    EntityContainerInfo containerInfo = localAep.getEntityContainerInfo(null);
    assertNotNull(containerInfo);
    assertEquals("MyTestContainer", containerInfo.getName());
  }
View Full Code Here

  }

  @Override
  public EntityContainerInfo getEntityContainerInfo(final String name) throws ODataException {
    if (name == null || ENTITY_CONTAINER_1.equals(name)) {
      return new EntityContainerInfo().setName(ENTITY_CONTAINER_1).setDefaultEntityContainer(true);
    } else if (ENTITY_CONTAINER_2.equals(name)) {
      return new EntityContainerInfo().setName(name).setDefaultEntityContainer(false);
    }

    return null;
  }
View Full Code Here

TOP

Related Classes of org.apache.olingo.odata2.api.edm.provider.EntityContainerInfo

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.