当前位置: 首页>>代码示例>>Java>>正文


Java EdmServiceMetadata类代码示例

本文整理汇总了Java中org.apache.olingo.odata2.api.edm.EdmServiceMetadata的典型用法代码示例。如果您正苦于以下问题:Java EdmServiceMetadata类的具体用法?Java EdmServiceMetadata怎么用?Java EdmServiceMetadata使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EdmServiceMetadata类属于org.apache.olingo.odata2.api.edm包,在下文中一共展示了EdmServiceMetadata类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: before

import org.apache.olingo.odata2.api.edm.EdmServiceMetadata; //导入依赖的package包/类
@Before
public void before() throws ODataException {
  Map<String, String> prefixMap = new HashMap<String, String>();
  prefixMap.put("atom", Edm.NAMESPACE_ATOM_2005);
  prefixMap.put("a", Edm.NAMESPACE_APP_2007);
  prefixMap.put("xml", Edm.NAMESPACE_XML_1998);
  prefixMap.put("custom", "http://localhost");
  XMLUnit.setXpathNamespaceContext(new SimpleNamespaceContext(prefixMap));

  schemas = new ArrayList<Schema>();

  EdmProvider edmProvider = mock(EdmProvider.class);
  when(edmProvider.getSchemas()).thenReturn(schemas);

  EdmServiceMetadata edmServiceMetadata = new EdmServiceMetadataImplProv(edmProvider);

  edm = mock(Edm.class);
  when(edm.getServiceMetadata()).thenReturn(edmServiceMetadata);
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:20,代码来源:AtomServiceDocumentProducerTest.java

示例2: serviceDocument

import org.apache.olingo.odata2.api.edm.EdmServiceMetadata; //导入依赖的package包/类
@Test
public void serviceDocument() throws Exception {
  Edm edm = mock(Edm.class);
  EdmServiceMetadata metadata = mock(EdmServiceMetadata.class);
  EdmEntitySetInfo entitySetInfo1 = mock(EdmEntitySetInfo.class);
  when(entitySetInfo1.isDefaultEntityContainer()).thenReturn(true);
  when(entitySetInfo1.getEntitySetName()).thenReturn("EntitySet");
  EdmEntitySetInfo entitySetInfo2 = mock(EdmEntitySetInfo.class);
  when(entitySetInfo2.getEntityContainerName()).thenReturn("Container2");
  when(entitySetInfo2.getEntitySetName()).thenReturn("EntitySet2");
  when(metadata.getEntitySetInfos()).thenReturn(Arrays.asList(entitySetInfo1, entitySetInfo2));
  when(edm.getServiceMetadata()).thenReturn(metadata);
  final ODataResponse response = new JsonEntityProvider().writeServiceDocument(edm, "http://host:80/service/");
  assertNotNull(response);
  assertNotNull(response.getEntity());
  assertNull("EntitypProvider must not set content header", response.getContentHeader());
  assertEquals(ODataServiceVersion.V10, response.getHeader(ODataHttpHeaders.DATASERVICEVERSION));

  final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
  assertNotNull(json);
  assertEquals("{\"d\":{\"EntitySets\":[\"EntitySet\",\"Container2.EntitySet2\"]}}", json);
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:23,代码来源:JsonServiceDocumentProducerTest.java

示例3: twoEntitySetsOneContainerForInfo

import org.apache.olingo.odata2.api.edm.EdmServiceMetadata; //导入依赖的package包/类
@Test
public void twoEntitySetsOneContainerForInfo() throws Exception {
  List<EntitySet> entitySets = new ArrayList<EntitySet>();
  EntitySet entitySet = new EntitySet().setName("Employees");
  entitySets.add(entitySet);
  entitySets.add(entitySet);

  List<EntityContainer> entityContainers = new ArrayList<EntityContainer>();
  EntityContainer container =
      new EntityContainer().setDefaultEntityContainer(true).setName("Container").setEntitySets(entitySets);
  entityContainers.add(container);

  List<Schema> schemas = new ArrayList<Schema>();
  schemas.add(new Schema().setEntityContainers(entityContainers));

  EdmProvider edmProvider = mock(EdmProvider.class);
  when(edmProvider.getSchemas()).thenReturn(schemas);

  EdmServiceMetadata serviceMetadata = new EdmServiceMetadataImplProv(edmProvider);

  List<EdmEntitySetInfo> infos = serviceMetadata.getEntitySetInfos();
  assertNotNull(infos);
  assertEquals(2, infos.size());
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:25,代码来源:EdmServiceMetadataImplProvTest.java

示例4: oneEntitySetsOneContainerTwoSchemadForInfo

import org.apache.olingo.odata2.api.edm.EdmServiceMetadata; //导入依赖的package包/类
@Test
public void oneEntitySetsOneContainerTwoSchemadForInfo() throws Exception {
  List<EntitySet> entitySets = new ArrayList<EntitySet>();
  EntitySet entitySet = new EntitySet().setName("Employees");
  entitySets.add(entitySet);

  List<EntityContainer> entityContainers = new ArrayList<EntityContainer>();
  EntityContainer container =
      new EntityContainer().setDefaultEntityContainer(true).setName("Container").setEntitySets(entitySets);
  entityContainers.add(container);

  List<Schema> schemas = new ArrayList<Schema>();
  schemas.add(new Schema().setEntityContainers(entityContainers));
  schemas.add(new Schema().setEntityContainers(entityContainers));

  EdmProvider edmProvider = mock(EdmProvider.class);
  when(edmProvider.getSchemas()).thenReturn(schemas);

  EdmServiceMetadata serviceMetadata = new EdmServiceMetadataImplProv(edmProvider);

  List<EdmEntitySetInfo> infos = serviceMetadata.getEntitySetInfos();
  assertNotNull(infos);
  assertEquals(2, infos.size());
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:25,代码来源:EdmServiceMetadataImplProvTest.java

示例5: getServiceMetadata

import org.apache.olingo.odata2.api.edm.EdmServiceMetadata; //导入依赖的package包/类
@Override
public EdmServiceMetadata getServiceMetadata()
{
   return new EdmServiceMetadata()
   {
      @Override
      public List<EdmEntitySetInfo> getEntitySetInfos() throws ODataException
      {
         List<EdmEntitySetInfo> eesil = new ArrayList<>();

         for (EdmEntitySetInfo ees: edm.getServiceMetadata().getEntitySetInfos())
         {
            String eesName = ees.getEntitySetName();
            if (Model.getEntitySet(eesName).isTopLevel())
            {
               eesil.add(ees);
            }
         }
         return eesil;
      }

      @Override
      public InputStream getMetadata() throws ODataException
      {
         return edm.getServiceMetadata().getMetadata();
      }

      @Override
      public String getDataServiceVersion() throws ODataException
      {
         return edm.getServiceMetadata().getDataServiceVersion();
      }
   };
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:35,代码来源:EdmWrapper.java

示例6: EdmImpl

import org.apache.olingo.odata2.api.edm.EdmServiceMetadata; //导入依赖的package包/类
public EdmImpl(final EdmServiceMetadata edmServiceMetadata) {
  edmEntityContainers = new HashMap<String, EdmEntityContainer>();
  edmEntityTypes = new HashMap<FullQualifiedName, EdmEntityType>();
  edmComplexTypes = new HashMap<FullQualifiedName, EdmComplexType>();
  edmAssociations = new HashMap<FullQualifiedName, EdmAssociation>();
  this.edmServiceMetadata = edmServiceMetadata;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:8,代码来源:EdmImpl.java

示例7: serviceDocumentEmpty

import org.apache.olingo.odata2.api.edm.EdmServiceMetadata; //导入依赖的package包/类
@Test
public void serviceDocumentEmpty() throws Exception {
  Edm edm = mock(Edm.class);
  EdmServiceMetadata metadata = mock(EdmServiceMetadata.class);
  when(edm.getServiceMetadata()).thenReturn(metadata);
  final ODataResponse response = new JsonEntityProvider().writeServiceDocument(edm, "http://host:80/service/");
  assertNotNull(response);
  assertNotNull(response.getEntity());
  assertNull("EntitypProvider must not set content header", response.getContentHeader());
  assertEquals(ODataServiceVersion.V10, response.getHeader(ODataHttpHeaders.DATASERVICEVERSION));

  final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
  assertNotNull(json);
  assertEquals("{\"d\":{\"EntitySets\":[]}}", json);
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:16,代码来源:JsonServiceDocumentProducerTest.java

示例8: setup

import org.apache.olingo.odata2.api.edm.EdmServiceMetadata; //导入依赖的package包/类
@BeforeClass
public static void setup() throws Exception {
  EdmImplProv edmImplProv = new EdmImplProv(new EdmTestProvider());
  EdmServiceMetadata serviceMetadata = edmImplProv.getServiceMetadata();
  metadata = StringHelper.inputStreamToString(serviceMetadata.getMetadata());
  Map<String, String> prefixMap = new HashMap<String, String>();
  prefixMap.put("a", Edm.NAMESPACE_EDM_2008_09);
  prefixMap.put("edmx", Edm.NAMESPACE_EDMX_2007_06);
  prefixMap.put("m", Edm.NAMESPACE_M_2007_08);
  prefixMap.put("annoPrefix", "http://annoNamespace");

  XMLUnit.setXpathNamespaceContext(new SimpleNamespaceContext(prefixMap));
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:14,代码来源:EdmServiceMetadataImplProvTest.java

示例9: getEntitySetInfosForEmptyEdmProvider

import org.apache.olingo.odata2.api.edm.EdmServiceMetadata; //导入依赖的package包/类
@Test
public void getEntitySetInfosForEmptyEdmProvider() throws Exception {
  EdmProvider edmProvider = mock(EdmProvider.class);
  EdmServiceMetadata serviceMetadata = new EdmServiceMetadataImplProv(edmProvider);

  List<EdmEntitySetInfo> infos = serviceMetadata.getEntitySetInfos();
  assertNotNull(infos);
  assertTrue(infos.isEmpty());
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:10,代码来源:EdmServiceMetadataImplProvTest.java

示例10: getEntitySetInfosForEmptyEdmProviderSchemas

import org.apache.olingo.odata2.api.edm.EdmServiceMetadata; //导入依赖的package包/类
@Test
public void getEntitySetInfosForEmptyEdmProviderSchemas() throws Exception {
  List<Schema> schemas = new ArrayList<Schema>();

  EdmProvider edmProvider = mock(EdmProvider.class);
  when(edmProvider.getSchemas()).thenReturn(schemas);

  EdmServiceMetadata serviceMetadata = new EdmServiceMetadataImplProv(edmProvider);

  List<EdmEntitySetInfo> infos = serviceMetadata.getEntitySetInfos();
  assertNotNull(infos);
  assertTrue(infos.isEmpty());
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:14,代码来源:EdmServiceMetadataImplProvTest.java

示例11: getEntitySetInfosForNewEdmProviderSchemas

import org.apache.olingo.odata2.api.edm.EdmServiceMetadata; //导入依赖的package包/类
/**
 * Check that no NPE can occur with a new created Schema
 *
 * @throws Exception
 */
@Test
public void getEntitySetInfosForNewEdmProviderSchemas() throws Exception {
  List<Schema> schemas = new ArrayList<Schema>();
  schemas.add(new Schema());

  EdmProvider edmProvider = mock(EdmProvider.class);
  when(edmProvider.getSchemas()).thenReturn(schemas);

  EdmServiceMetadata serviceMetadata = new EdmServiceMetadataImplProv(edmProvider);

  List<EdmEntitySetInfo> infos = serviceMetadata.getEntitySetInfos();
  assertNotNull(infos);
  assertTrue(infos.isEmpty());
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:20,代码来源:EdmServiceMetadataImplProvTest.java

示例12: oneEntitySetOneContainerForInfo

import org.apache.olingo.odata2.api.edm.EdmServiceMetadata; //导入依赖的package包/类
@Test
public void oneEntitySetOneContainerForInfo() throws Exception {
  String entitySetUriString = new URI("Employees").toASCIIString();

  List<EntitySet> entitySets = new ArrayList<EntitySet>();
  EntitySet entitySet = new EntitySet().setName("Employees");
  entitySets.add(entitySet);

  List<EntityContainer> entityContainers = new ArrayList<EntityContainer>();
  EntityContainer container =
      new EntityContainer().setDefaultEntityContainer(true).setName("Container").setEntitySets(entitySets);
  entityContainers.add(container);

  List<Schema> schemas = new ArrayList<Schema>();
  schemas.add(new Schema().setEntityContainers(entityContainers));

  EdmProvider edmProvider = mock(EdmProvider.class);
  when(edmProvider.getSchemas()).thenReturn(schemas);

  EdmServiceMetadata serviceMetadata = new EdmServiceMetadataImplProv(edmProvider);

  List<EdmEntitySetInfo> infos = serviceMetadata.getEntitySetInfos();
  assertNotNull(infos);
  assertEquals(1, infos.size());

  assertEquals(infos.get(0).getEntitySetName(), "Employees");
  assertEquals(infos.get(0).getEntityContainerName(), "Container");
  assertEquals(infos.get(0).getEntitySetUri().toASCIIString(), entitySetUriString);
  assertTrue(infos.get(0).isDefaultEntityContainer());
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:31,代码来源:EdmServiceMetadataImplProvTest.java

示例13: twoContainersWithOneEntitySetEachForInfo

import org.apache.olingo.odata2.api.edm.EdmServiceMetadata; //导入依赖的package包/类
@Test
public void twoContainersWithOneEntitySetEachForInfo() throws Exception {
  String entitySetUriString = new URI("Employees").toASCIIString();
  String entitySetUriString2 = new URI("Container2.Employees").toASCIIString();

  List<EntitySet> entitySets = new ArrayList<EntitySet>();
  EntitySet entitySet = new EntitySet().setName("Employees");
  entitySets.add(entitySet);

  List<EntityContainer> entityContainers = new ArrayList<EntityContainer>();
  EntityContainer container =
      new EntityContainer().setDefaultEntityContainer(true).setName("Container").setEntitySets(entitySets);
  entityContainers.add(container);

  EntityContainer container2 =
      new EntityContainer().setDefaultEntityContainer(false).setName("Container2").setEntitySets(entitySets);
  entityContainers.add(container2);

  List<Schema> schemas = new ArrayList<Schema>();
  schemas.add(new Schema().setEntityContainers(entityContainers));

  EdmProvider edmProvider = mock(EdmProvider.class);
  when(edmProvider.getSchemas()).thenReturn(schemas);

  EdmServiceMetadata serviceMetadata = new EdmServiceMetadataImplProv(edmProvider);

  List<EdmEntitySetInfo> infos = serviceMetadata.getEntitySetInfos();
  assertNotNull(infos);
  assertEquals(2, infos.size());

  assertEquals(infos.get(0).getEntitySetName(), "Employees");
  assertEquals(infos.get(0).getEntityContainerName(), "Container");
  assertEquals(infos.get(0).getEntitySetUri().toASCIIString(), entitySetUriString);
  assertTrue(infos.get(0).isDefaultEntityContainer());

  assertEquals(infos.get(1).getEntitySetName(), "Employees");
  assertEquals(infos.get(1).getEntityContainerName(), "Container2");
  assertEquals(infos.get(1).getEntitySetUri().toASCIIString(), entitySetUriString2);
  assertFalse(infos.get(1).isDefaultEntityContainer());
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:41,代码来源:EdmServiceMetadataImplProvTest.java

示例14: dataServiceVersion

import org.apache.olingo.odata2.api.edm.EdmServiceMetadata; //导入依赖的package包/类
@Test
public void dataServiceVersion() throws Exception {
  EdmProvider edmProvider = mock(EdmProvider.class);
  EdmImplProv edmImplProv = new EdmImplProv(edmProvider);

  EdmServiceMetadata serviceMetadata = edmImplProv.getServiceMetadata();
  assertEquals("1.0", serviceMetadata.getDataServiceVersion());
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:9,代码来源:EdmServiceMetadataImplProvTest.java

示例15: readMetadata

import org.apache.olingo.odata2.api.edm.EdmServiceMetadata; //导入依赖的package包/类
/**
 * @see MetadataProcessor
 */
@Override
public ODataResponse readMetadata(final GetMetadataUriInfo uriInfo, final String contentType) throws ODataException {
  final EdmServiceMetadata edmServiceMetadata = getContext().getService().getEntityDataModel().getServiceMetadata();

  return ODataResponse.status(HttpStatusCodes.OK)
      .header(ODataHttpHeaders.DATASERVICEVERSION, edmServiceMetadata.getDataServiceVersion())
      .entity(edmServiceMetadata.getMetadata()).build();
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:12,代码来源:ODataSingleProcessor.java


注:本文中的org.apache.olingo.odata2.api.edm.EdmServiceMetadata类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。