當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。