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/05/23 12:42:18 UTC
git commit: [OLINGO-266] first client base FIT test (service document)
Repository: olingo-odata4
Updated Branches:
refs/heads/olingo-266-ref [created] b40ae95b7
[OLINGO-266] first client base FIT test (service document)
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/b40ae95b
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/b40ae95b
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/b40ae95b
Branch: refs/heads/olingo-266-ref
Commit: b40ae95b7fffd570df88183a7d7a397964e7b5e6
Parents: 44e0c64
Author: Stephan Klevenz <st...@sap.com>
Authored: Fri May 23 12:42:08 2014 +0200
Committer: Stephan Klevenz <st...@sap.com>
Committed: Fri May 23 12:42:08 2014 +0200
----------------------------------------------------------------------
.../apache/olingo/fit/tecsvc/BasicITCase.java | 60 ++++++++++++++++++++
.../apache/olingo/fit/tecsvc/PingITCase.java | 14 ++---
2 files changed, 66 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b40ae95b/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
new file mode 100644
index 0000000..8a610b5
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/BasicITCase.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.tecsvc;
+
+import static org.junit.Assert.assertNotNull;
+
+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.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.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class BasicITCase {
+
+ private static final String BASE_URI = "http://localhost:9080/tecsvc/odata.svc";
+
+ private ODataClient odata;
+
+ @Before
+ public void before() {
+ odata = ODataClientFactory.getV4();
+ }
+
+ @Test
+ public void readServiceDocument() {
+ ODataServiceDocumentRequest request = odata.getRetrieveRequestFactory().getServiceDocumentRequest(BASE_URI + "/");
+ assertNotNull(request);
+ ODataServiceDocument serviceDocument = request.execute().getBody();
+ assertNotNull(serviceDocument);
+ }
+
+ @Test
+ @Ignore
+ public void readMetadata() {
+ EdmMetadataRequest request = odata.getRetrieveRequestFactory().getMetadataRequest(BASE_URI + "/$metadata");
+ assertNotNull(request);
+ Edm edm = request.execute().getBody();
+ assertNotNull(edm);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b40ae95b/fit/src/test/java/org/apache/olingo/fit/tecsvc/PingITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/PingITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/PingITCase.java
index c13de43..3b9bbf4 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/PingITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/PingITCase.java
@@ -23,14 +23,12 @@ import static org.junit.Assert.assertEquals;
import java.net.HttpURLConnection;
import java.net.URL;
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.junit.Test;
public class PingITCase {
- private static final String REF_SERVICE_REDIRECT = "http://localhost:9080/tecsvc/odata.svc";
- private static final String REF_SERVICE = REF_SERVICE_REDIRECT + "/";
+ private static final String REF_SERVICE = "http://localhost:9080/tecsvc/odata.svc/";
+ private static final String REDIRECT_URL = "http://localhost:9080/tecsvc/odata.svc";
@Test
public void ping() throws Exception {
@@ -46,15 +44,15 @@ public class PingITCase {
@Test
public void redirect() throws Exception {
- URL url = new URL(REF_SERVICE_REDIRECT);
+
+ URL url = new URL(REDIRECT_URL);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.connect();
int code = connection.getResponseCode();
-
- assertEquals(HttpStatusCode.TEMPORARY_REDIRECT, code);
- assertEquals("/", connection.getHeaderField(HttpHeader.LOCATION));
+ assertEquals(200, code);
}
+
}