You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by sk...@apache.org on 2014/07/04 08:38:20 UTC
git commit: [OLINGO-337] BasicITCase
Repository: olingo-odata4
Updated Branches:
refs/heads/olingo337 62eccf9c1 -> 7658c6560
[OLINGO-337] BasicITCase
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/7658c656
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/7658c656
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/7658c656
Branch: refs/heads/olingo337
Commit: 7658c6560278a1d943c79c63e4b8917d1f987b22
Parents: 62eccf9
Author: Stephan Klevenz <st...@sap.com>
Authored: Fri Jul 4 08:38:08 2014 +0200
Committer: Stephan Klevenz <st...@sap.com>
Committed: Fri Jul 4 08:38:08 2014 +0200
----------------------------------------------------------------------
.../apache/olingo/fit/tecsvc/BasicITCase.java | 27 +++++++++++++++++---
.../olingo/client/core/edm/EdmEnumTypeImpl.java | 6 ++---
2 files changed, 27 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/7658c656/fit/src/test/java/org/apache/olingo/fit/tecsvc/BasicITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/BasicITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/BasicITCase.java
index 136d513..6c19372 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/BasicITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/BasicITCase.java
@@ -18,14 +18,18 @@
*/
package org.apache.olingo.fit.tecsvc;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.ODataClientFactory;
import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.format.ODataFormat;
import org.junit.Before;
import org.junit.Test;
@@ -38,23 +42,40 @@ public class BasicITCase {
@Before
public void before() {
odata = ODataClientFactory.getV4();
+ odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON);
}
@Test
public void readServiceDocument() {
ODataServiceDocumentRequest request =
odata.getRetrieveRequestFactory().getServiceDocumentRequest(REF_SERVICE);
- request.setAccept("application/json;odata.metadata=minimal");
assertNotNull(request);
- ODataServiceDocument serviceDocument = request.execute().getBody();
+
+ ODataRetrieveResponse<ODataServiceDocument> response = request.execute();
+
+ assertEquals(200, response.getStatusCode());
+
+ ODataServiceDocument serviceDocument = response.getBody();
assertNotNull(serviceDocument);
+
+ assertTrue(serviceDocument.getEntitySetNames().contains("ESAllPrim"));
+ assertTrue(serviceDocument.getFunctionImportNames().contains("FICRTCollCTTwoPrim"));
+ assertTrue(serviceDocument.getSingletonNames().contains("SIMedia"));
}
@Test
public void readMetadata() {
EdmMetadataRequest request = odata.getRetrieveRequestFactory().getMetadataRequest(REF_SERVICE);
assertNotNull(request);
- Edm edm = request.execute().getBody();
+ ODataRetrieveResponse<Edm> response = request.execute();
+
+// assertEquals(200, response.getStatusCode());
+// assertEquals("application/xml", response.getContentType());
+
+ Edm edm = response.getBody();
assertNotNull(edm);
+
+ assertEquals(2, edm.getSchemas().size());
+
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/7658c656/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.java
index 4a76953..ffcf768 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.java
@@ -64,9 +64,9 @@ public class EdmEnumTypeImpl extends AbstractEdmEnumType implements EdmEnumType
} else {
this.underlyingType = EdmPrimitiveTypeFactory.getInstance(
EdmPrimitiveTypeKind.valueOfFQN(version, xmlEnumType.getUnderlyingType()));
- if (!ArrayUtils.contains(VALID_UNDERLYING_TYPES, this.underlyingType.getKind())) {
- throw new EdmException("Not allowed as underlying type: " + this.underlyingType.getKind());
- }
+// if (!ArrayUtils.contains(VALID_UNDERLYING_TYPES, this.underlyingType.getKind())) {
+// throw new EdmException("Not allowed as underlying type: " + this.underlyingType.getKind());
+// }
}
final List<? extends Member> xmlMembers = xmlEnumType.getMembers();