You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2013/12/23 13:31:02 UTC
[1/2] git commit: [OLINGO-87] Create base test classes and service
document test
Updated Branches:
refs/heads/master d9a7f2db4 -> 1ce2c8776
[OLINGO-87] Create base test classes and service document test
Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/78da059d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/78da059d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/78da059d
Branch: refs/heads/master
Commit: 78da059d588a2d7fdae9b280ed5a6a7f1f324b0a
Parents: d9a7f2d
Author: Michael Bolz <mi...@apache.org>
Authored: Mon Dec 23 11:01:58 2013 +0100
Committer: Michael Bolz <mi...@apache.org>
Committed: Mon Dec 23 13:28:15 2013 +0100
----------------------------------------------------------------------
.../annotation-processor-webref/pom.xml | 6 +
.../processor/ref/AbstractRefTest.java | 195 +++++++++++++++++++
.../processor/ref/AbstractRefXmlTest.java | 89 +++++++++
.../processor/ref/ServiceJsonTest.java | 71 +++++++
.../processor/ref/ServiceXmlTest.java | 123 ++++++++++++
5 files changed, 484 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/78da059d/odata2-annotation-processor/annotation-processor-webref/pom.xml
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-webref/pom.xml b/odata2-annotation-processor/annotation-processor-webref/pom.xml
index 9f31106..a6cc569 100644
--- a/odata2-annotation-processor/annotation-processor-webref/pom.xml
+++ b/odata2-annotation-processor/annotation-processor-webref/pom.xml
@@ -98,6 +98,12 @@ the License. -->
<artifactId>slf4j-log4j12</artifactId>
<version>${version.slf4j}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>olingo-odata2-testutil-incubating</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<profiles>
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/78da059d/odata2-annotation-processor/annotation-processor-webref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/AbstractRefTest.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-webref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/AbstractRefTest.java b/odata2-annotation-processor/annotation-processor-webref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/AbstractRefTest.java
new file mode 100644
index 0000000..6ddbff4
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-webref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/AbstractRefTest.java
@@ -0,0 +1,195 @@
+/*******************************************************************************
+ * 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.odata2.annotation.processor.ref;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.net.URI;
+
+import org.apache.http.HttpEntityEnclosingRequest;
+import org.apache.http.HttpHeaders;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPatch;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.client.methods.HttpRequestBase;
+import org.apache.http.entity.StringEntity;
+import org.apache.olingo.odata2.annotation.processor.api.AnnotationServiceFactory;
+import org.apache.olingo.odata2.api.ODataService;
+import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
+import org.apache.olingo.odata2.api.commons.ODataHttpMethod;
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.testutil.fit.AbstractFitTest;
+import org.apache.olingo.odata2.testutil.helper.StringHelper;
+
+/**
+ * Abstract base class for tests employing the reference scenario.
+ *
+ */
+public class AbstractRefTest extends AbstractFitTest {
+
+ protected static final String IMAGE_JPEG = "image/jpeg";
+ protected static final String IMAGE_GIF = "image/gif";
+
+ final static String MODEL_PACKAGE = "org.apache.olingo.odata2.annotation.processor.ref.model";
+
+ @Override
+ protected ODataService createService() throws ODataException {
+ return AnnotationServiceFactory.createAnnotationService(MODEL_PACKAGE);
+ }
+
+ protected HttpResponse callUri(
+ final ODataHttpMethod httpMethod, final String uri,
+ final String additionalHeader, final String additionalHeaderValue,
+ final String requestBody, final String requestContentType,
+ final HttpStatusCodes expectedStatusCode) throws Exception {
+
+ HttpRequestBase request =
+ httpMethod == ODataHttpMethod.GET ? new HttpGet() :
+ httpMethod == ODataHttpMethod.DELETE ? new HttpDelete() :
+ httpMethod == ODataHttpMethod.POST ? new HttpPost() :
+ httpMethod == ODataHttpMethod.PUT ? new HttpPut() : new HttpPatch();
+ request.setURI(URI.create(getEndpoint() + uri));
+ if (additionalHeader != null) {
+ request.addHeader(additionalHeader, additionalHeaderValue);
+ }
+ if (requestBody != null) {
+ ((HttpEntityEnclosingRequest) request).setEntity(new StringEntity(requestBody));
+ request.setHeader(HttpHeaders.CONTENT_TYPE, requestContentType);
+ }
+
+ final HttpResponse response = getHttpClient().execute(request);
+
+ assertNotNull(response);
+ assertEquals(expectedStatusCode.getStatusCode(), response.getStatusLine().getStatusCode());
+
+ if (expectedStatusCode == HttpStatusCodes.OK) {
+ assertNotNull(response.getEntity());
+ assertNotNull(response.getEntity().getContent());
+ } else if (expectedStatusCode == HttpStatusCodes.CREATED) {
+ assertNotNull(response.getEntity());
+ assertNotNull(response.getEntity().getContent());
+ assertNotNull(response.getFirstHeader(HttpHeaders.LOCATION));
+ } else if (expectedStatusCode == HttpStatusCodes.NO_CONTENT) {
+ assertTrue(response.getEntity() == null || response.getEntity().getContent() == null);
+ }
+
+ return response;
+ }
+
+ protected HttpResponse callUri(final String uri, final String additionalHeader, final String additionalHeaderValue,
+ final HttpStatusCodes expectedStatusCode) throws Exception {
+ return callUri(ODataHttpMethod.GET, uri, additionalHeader, additionalHeaderValue, null, null, expectedStatusCode);
+ }
+
+ protected HttpResponse callUri(final String uri, final String additionalHeader, final String additionalHeaderValue)
+ throws Exception {
+ return callUri(ODataHttpMethod.GET, uri, additionalHeader, additionalHeaderValue, null, null, HttpStatusCodes.OK);
+ }
+
+ protected HttpResponse callUri(final String uri, final HttpStatusCodes expectedStatusCode) throws Exception {
+ return callUri(uri, null, null, expectedStatusCode);
+ }
+
+ protected HttpResponse callUri(final String uri) throws Exception {
+ return callUri(uri, HttpStatusCodes.OK);
+ }
+
+ protected void checkUri(final String uri) throws Exception {
+ assertNotNull(getBody(callUri(uri)));
+ }
+
+ protected void badRequest(final String uri) throws Exception {
+ final HttpResponse response = callUri(uri, HttpStatusCodes.BAD_REQUEST);
+ assertNotNull(getBody(response));
+ }
+
+ protected void notFound(final String uri) throws Exception {
+ final HttpResponse response = callUri(uri, HttpStatusCodes.NOT_FOUND);
+ assertNotNull(getBody(response));
+ }
+
+ protected void deleteUri(final String uri, final HttpStatusCodes expectedStatusCode)
+ throws Exception, AssertionError {
+ final HttpResponse response = callUri(ODataHttpMethod.DELETE, uri, null, null, null, null, expectedStatusCode);
+ if (expectedStatusCode != HttpStatusCodes.NO_CONTENT) {
+ response.getEntity().getContent().close();
+ }
+ }
+
+ protected void deleteUriOk(final String uri) throws Exception {
+ deleteUri(uri, HttpStatusCodes.NO_CONTENT);
+ }
+
+ protected HttpResponse postUri(final String uri, final String requestBody, final String requestContentType,
+ final HttpStatusCodes expectedStatusCode) throws Exception {
+ return callUri(ODataHttpMethod.POST, uri, null, null, requestBody, requestContentType, expectedStatusCode);
+ }
+
+ protected HttpResponse postUri(final String uri, final String requestBody, final String requestContentType,
+ final String additionalHeader, final String additionalHeaderValue, final HttpStatusCodes expectedStatusCode)
+ throws Exception {
+ return callUri(ODataHttpMethod.POST, uri, additionalHeader, additionalHeaderValue, requestBody, requestContentType,
+ expectedStatusCode);
+ }
+
+ protected void putUri(final String uri,
+ final String requestBody, final String requestContentType,
+ final HttpStatusCodes expectedStatusCode) throws Exception {
+ final HttpResponse response =
+ callUri(ODataHttpMethod.PUT, uri, null, null, requestBody, requestContentType, expectedStatusCode);
+ if (expectedStatusCode != HttpStatusCodes.NO_CONTENT) {
+ response.getEntity().getContent().close();
+ }
+ }
+
+ protected void putUri(final String uri, final String acceptHeader,
+ final String requestBody, final String requestContentType,
+ final HttpStatusCodes expectedStatusCode) throws Exception {
+ final HttpResponse response =
+ callUri(ODataHttpMethod.PUT, uri,
+ org.apache.olingo.odata2.api.commons.HttpHeaders.ACCEPT, acceptHeader, requestBody, requestContentType,
+ expectedStatusCode);
+ if (expectedStatusCode != HttpStatusCodes.NO_CONTENT) {
+ response.getEntity().getContent().close();
+ }
+ }
+
+ protected String getBody(final HttpResponse response) throws Exception {
+ assertNotNull(response);
+ assertNotNull(response.getEntity());
+ assertNotNull(response.getEntity().getContent());
+ return StringHelper.inputStreamToString(response.getEntity().getContent());
+ }
+
+ protected void checkMediaType(final HttpResponse response, final String expectedMediaType) {
+ assertEquals(expectedMediaType, response.getFirstHeader(HttpHeaders.CONTENT_TYPE).getValue());
+ }
+
+ protected void checkEtag(final HttpResponse response, final String expectedEtag) {
+ assertNotNull(response.getFirstHeader(HttpHeaders.ETAG));
+ final String entityTag = response.getFirstHeader(HttpHeaders.ETAG).getValue();
+ assertNotNull(entityTag);
+ assertEquals(expectedEtag, entityTag);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/78da059d/odata2-annotation-processor/annotation-processor-webref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/AbstractRefXmlTest.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-webref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/AbstractRefXmlTest.java b/odata2-annotation-processor/annotation-processor-webref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/AbstractRefXmlTest.java
new file mode 100644
index 0000000..aefd16b
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-webref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/AbstractRefXmlTest.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * 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.odata2.annotation.processor.ref;
+
+import static org.custommonkey.xmlunit.XMLAssert.assertXpathExists;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.http.HttpResponse;
+import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
+import org.apache.olingo.odata2.api.edm.Edm;
+import org.custommonkey.xmlunit.SimpleNamespaceContext;
+import org.custommonkey.xmlunit.XMLUnit;
+import org.custommonkey.xmlunit.exceptions.XpathException;
+import org.junit.Before;
+import org.xml.sax.SAXException;
+
+/**
+ * Abstract base class for tests employing the reference scenario reading or writing XML.
+ *
+ */
+public class AbstractRefXmlTest extends AbstractRefTest {
+ @Before
+ public void setXmlNamespacePrefixes() {
+ Map<String, String> prefixMap = new HashMap<String, String>();
+ prefixMap.put(Edm.PREFIX_ATOM, Edm.NAMESPACE_ATOM_2005);
+ prefixMap.put(Edm.PREFIX_APP, Edm.NAMESPACE_APP_2007);
+ prefixMap.put(Edm.PREFIX_D, Edm.NAMESPACE_D_2007_08);
+ prefixMap.put(Edm.PREFIX_M, Edm.NAMESPACE_M_2007_08);
+ prefixMap.put(Edm.PREFIX_EDM, Edm.NAMESPACE_EDM_2008_09);
+ prefixMap.put(Edm.PREFIX_EDMX, Edm.NAMESPACE_EDMX_2007_06);
+ prefixMap.put(Edm.PREFIX_XML, Edm.NAMESPACE_XML_1998);
+ XMLUnit.setXpathNamespaceContext(new SimpleNamespaceContext(prefixMap));
+ }
+
+ @Override
+ protected void badRequest(final String uri) throws Exception {
+ final HttpResponse response = callUri(uri, HttpStatusCodes.BAD_REQUEST);
+ validateXmlError(getBody(response));
+ }
+
+ @Override
+ protected void notFound(final String uri) throws Exception {
+ final HttpResponse response = callUri(uri, HttpStatusCodes.NOT_FOUND);
+ validateXmlError(getBody(response));
+ }
+
+ protected void validateXmlError(final String xml) throws XpathException, IOException, SAXException {
+ assertXpathExists("/m:error", xml);
+ assertXpathExists("/m:error/m:code", xml);
+ assertXpathExists("/m:error/m:message[@xml:lang=\"en\"]", xml);
+ }
+
+ protected String readFile(final String filename) throws IOException {
+ InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(filename);
+ if (in == null) {
+ throw new IOException("Requested file '" + filename + "' was not found.");
+ }
+
+ byte[] tmp = new byte[8192];
+ int count = in.read(tmp);
+ StringBuffer b = new StringBuffer();
+ while (count >= 0) {
+ b.append(new String(tmp, 0, count));
+ count = in.read(tmp);
+ }
+
+ return b.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/78da059d/odata2-annotation-processor/annotation-processor-webref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/ServiceJsonTest.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-webref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/ServiceJsonTest.java b/odata2-annotation-processor/annotation-processor-webref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/ServiceJsonTest.java
new file mode 100644
index 0000000..9c0a049
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-webref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/ServiceJsonTest.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * 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.odata2.annotation.processor.ref;
+
+import static org.custommonkey.xmlunit.XMLAssert.assertXpathExists;
+import static org.junit.Assert.assertEquals;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.http.HttpResponse;
+import org.apache.olingo.odata2.api.commons.HttpContentType;
+import org.apache.olingo.odata2.api.commons.HttpHeaders;
+import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
+import org.apache.olingo.odata2.api.edm.Edm;
+import org.custommonkey.xmlunit.SimpleNamespaceContext;
+import org.custommonkey.xmlunit.XMLUnit;
+import org.junit.Test;
+
+/**
+ * Tests employing the reference scenario reading the service document in JSON format.
+ *
+ */
+public class ServiceJsonTest extends AbstractRefTest {
+ @Test
+ public void serviceDocumentDollarFormatJson() throws Exception {
+ final HttpResponse response = callUri("?$format=json");
+ // checkMediaType(response, HttpContentType.APPLICATION_JSON);
+ assertEquals("{\"d\":{\"EntitySets\":["
+ + "\"Buildings\",\"Employees\",\"Managers\",\"Photos\",\"Rooms\",\"Teams\"]}}",
+ getBody(response));
+ }
+
+ @Test
+ public void serviceDocumentAcceptHeaderJson() throws Exception {
+ final HttpResponse response = callUri("", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON);
+ assertEquals("{\"d\":{\"EntitySets\":["
+ + "\"Buildings\",\"Employees\",\"Managers\",\"Photos\",\"Rooms\",\"Teams\"]}}",
+ getBody(response));
+ }
+
+ @Test
+ public void serviceDocumentAcceptHeaderInvalidCharset() throws Exception {
+ final HttpResponse response =
+ callUri("", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_XML + "; charset=iso-latin-1",
+ HttpStatusCodes.NOT_ACCEPTABLE);
+ final String body = getBody(response);
+ Map<String, String> prefixMap = new HashMap<String, String>();
+ prefixMap.put("a", Edm.NAMESPACE_M_2007_08);
+ XMLUnit.setXpathNamespaceContext(new SimpleNamespaceContext(prefixMap));
+ assertXpathExists("/a:error", body);
+ assertXpathExists("/a:error/a:code", body);
+ assertXpathExists("/a:error/a:message", body);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/78da059d/odata2-annotation-processor/annotation-processor-webref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/ServiceXmlTest.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-webref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/ServiceXmlTest.java b/odata2-annotation-processor/annotation-processor-webref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/ServiceXmlTest.java
new file mode 100644
index 0000000..4d49883
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-webref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/ServiceXmlTest.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * 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.odata2.annotation.processor.ref;
+
+import static org.custommonkey.xmlunit.XMLAssert.assertXpathEvaluatesTo;
+import static org.custommonkey.xmlunit.XMLAssert.assertXpathExists;
+
+import java.io.IOException;
+
+import org.apache.http.HttpResponse;
+import org.apache.olingo.odata2.api.commons.HttpContentType;
+import org.apache.olingo.odata2.api.commons.HttpHeaders;
+import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
+import org.custommonkey.xmlunit.exceptions.XpathException;
+import org.junit.Test;
+import org.xml.sax.SAXException;
+
+/**
+ * Tests employing the reference scenario reading the service document in XML format
+ */
+public class ServiceXmlTest extends AbstractRefXmlTest {
+
+ @Test
+ public void serviceDocument() throws Exception {
+ final HttpResponse response = callUri("/");
+ checkMediaType(response, HttpContentType.APPLICATION_ATOM_SVC_UTF8);
+ final String body = getBody(response);
+
+ assertXpathEvaluatesTo("Employees", "/app:service/app:workspace/app:collection[@href=\"Employees\"]", body);
+ assertXpathEvaluatesTo("Teams", "/app:service/app:workspace/app:collection[@href=\"Teams\"]", body);
+ assertXpathEvaluatesTo("Rooms", "/app:service/app:workspace/app:collection[@href=\"Rooms\"]", body);
+ assertXpathEvaluatesTo("Managers", "/app:service/app:workspace/app:collection[@href=\"Managers\"]", body);
+ assertXpathEvaluatesTo("Buildings", "/app:service/app:workspace/app:collection[@href=\"Buildings\"]", body);
+ assertXpathEvaluatesTo("Photos", "/app:service/app:workspace/app:collection[@href=\"Photos\"]", body);
+
+ notFound("invalid.svc");
+ }
+
+ @Test
+ public void serviceDocumentDefault() throws Exception {
+ final HttpResponse response = callUri("");
+ checkMediaType(response, HttpContentType.APPLICATION_ATOM_SVC_UTF8);
+ validateXmlServiceDocument(getBody(response));
+ }
+
+ @Test
+ public void serviceDocumentDollarFormatAtom() throws Exception {
+ HttpResponse response = callUri("?$format=atom");
+ checkMediaType(response, HttpContentType.APPLICATION_ATOM_SVC_UTF8);
+ validateXmlServiceDocument(getBody(response));
+ }
+
+ @Test
+ public void serviceDocumentDollarFormatXml() throws Exception {
+ HttpResponse response = callUri("?$format=xml");
+ checkMediaType(response, HttpContentType.APPLICATION_XML_UTF8);
+ validateXmlServiceDocument(getBody(response));
+ }
+
+ @Test
+ public void serviceDocumentAcceptHeaderAtom() throws Exception {
+ final HttpResponse response =
+ callUri("", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_ATOM_XML, HttpStatusCodes.NOT_ACCEPTABLE);
+ checkMediaType(response, HttpContentType.APPLICATION_XML);
+ validateXmlError(getBody(response));
+ }
+
+ @Test
+ public void serviceDocumentAcceptHeaderUtf8Atom() throws Exception {
+ final HttpResponse response =
+ callUri("", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_ATOM_XML_UTF8, HttpStatusCodes.NOT_ACCEPTABLE);
+ checkMediaType(response, HttpContentType.APPLICATION_XML);
+ validateXmlError(getBody(response));
+ }
+
+ @Test
+ public void serviceDocumentAcceptHeaderXml() throws Exception {
+ HttpResponse response = callUri("", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_XML);
+ checkMediaType(response, HttpContentType.APPLICATION_XML_UTF8);
+ validateXmlServiceDocument(getBody(response));
+ }
+
+ @Test
+ public void serviceDocumentAcceptHeaderUtf8Xml() throws Exception {
+ HttpResponse response = callUri("", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_XML_UTF8);
+ checkMediaType(response, HttpContentType.APPLICATION_XML_UTF8);
+ validateXmlServiceDocument(getBody(response));
+ }
+
+ private void validateXmlServiceDocument(final String payload) throws IOException, SAXException, XpathException {
+ assertXpathExists("/app:service", payload);
+ assertXpathExists("/app:service/app:workspace", payload);
+ assertXpathExists("/app:service/app:workspace/atom:title", payload);
+ assertXpathExists("/app:service/app:workspace/app:collection[@href=\"Employees\"]", payload);
+ assertXpathExists("/app:service/app:workspace/app:collection[@href=\"Employees\"]/atom:title", payload);
+ assertXpathExists("/app:service/app:workspace/app:collection[@href=\"Teams\"]", payload);
+ assertXpathExists("/app:service/app:workspace/app:collection[@href=\"Teams\"]/atom:title", payload);
+ assertXpathExists("/app:service/app:workspace/app:collection[@href=\"Rooms\"]", payload);
+ assertXpathExists("/app:service/app:workspace/app:collection[@href=\"Rooms\"]/atom:title", payload);
+ assertXpathExists("/app:service/app:workspace/app:collection[@href=\"Managers\"]", payload);
+ assertXpathExists("/app:service/app:workspace/app:collection[@href=\"Managers\"]/atom:title", payload);
+ assertXpathExists("/app:service/app:workspace/app:collection[@href=\"Buildings\"]", payload);
+ assertXpathExists("/app:service/app:workspace/app:collection[@href=\"Buildings\"]/atom:title", payload);
+ assertXpathExists("/app:service/app:workspace/app:collection[@href=\"Photos\"]", payload);
+ assertXpathExists("/app:service/app:workspace/app:collection[@href=\"Photos\"]/atom:title", payload);
+ }
+}
[2/2] git commit: [OLINGO-86] Created all positive tests for DS
Posted by mi...@apache.org.
[OLINGO-86] Created all positive tests for DS
Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/1ce2c877
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/1ce2c877
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/1ce2c877
Branch: refs/heads/master
Commit: 1ce2c8776a688d056fc35f3096f777041aaa6aa9
Parents: 78da059
Author: Michael Bolz <mi...@apache.org>
Authored: Mon Dec 23 13:29:08 2013 +0100
Committer: Michael Bolz <mi...@apache.org>
Committed: Mon Dec 23 13:29:08 2013 +0100
----------------------------------------------------------------------
.../processor/core/util/AnnotationHelper.java | 26 +-
.../datasource/AnnotationsInMemoryDsTest.java | 60 ++++-
.../core/util/AnnotationHelperTest.java | 270 +++++++++++++++++++
3 files changed, 348 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1ce2c877/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelper.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelper.java b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelper.java
index 807b6fe..54ffb49 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelper.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelper.java
@@ -63,6 +63,11 @@ public class AnnotationHelper {
Map<String, Object> firstKeyFields = getValueForAnnotatedFields(firstInstance, EdmKey.class);
Map<String, Object> secondKeyFields = getValueForAnnotatedFields(secondInstance, EdmKey.class);
+ if(firstKeyFields.isEmpty() && secondKeyFields.isEmpty()) {
+ throw new ODataRuntimeException("Both object instances does not have EdmKey fields defined ["
+ + "firstClass=" + firstInstance.getClass().getName()
+ + " secondClass=" + secondInstance.getClass().getName() + "].");
+ }
return keyValuesMatch(firstKeyFields, secondKeyFields);
}
@@ -82,6 +87,8 @@ public class AnnotationHelper {
private boolean keyValuesMatch(final Map<String, Object> firstKeyValues, final Map<String, Object> secondKeyValues) {
if (firstKeyValues.size() != secondKeyValues.size()) {
return false;
+ } else if(firstKeyValues.isEmpty()) {
+ throw new ODataRuntimeException("No keys given for key value matching.");
} else {
Set<Map.Entry<String, Object>> entries = firstKeyValues.entrySet();
for (Map.Entry<String, Object> entry : entries) {
@@ -498,8 +505,7 @@ public class AnnotationHelper {
for (Field field : fields) {
if (field.getAnnotation(annotation) != null) {
Object value = getFieldValue(instance, field);
- final EdmProperty property = field.getAnnotation(EdmProperty.class);
- final String name = property == null || property.name().isEmpty() ? field.getName() : property.name();
+ final String name = extractPropertyName(field);
fieldName2Value.put(name, value);
}
}
@@ -513,6 +519,15 @@ public class AnnotationHelper {
return fieldName2Value;
}
+ private String extractPropertyName(Field field) {
+ final EdmProperty property = field.getAnnotation(EdmProperty.class);
+ if(property == null || property.name().isEmpty()) {
+ return getCanonicalName(field);
+ } else {
+ return property.name();
+ }
+ }
+
public void setValueForAnnotatedField(final Object instance, final Class<? extends Annotation> annotation,
final Object value)
throws ODataAnnotationException {
@@ -641,7 +656,7 @@ public class AnnotationHelper {
}
}
- public Object convert(final Field field, final String propertyValue) {
+ private Object convert(final Field field, final String propertyValue) {
Class<?> fieldClass = field.getType();
try {
EdmProperty property = field.getAnnotation(EdmProperty.class);
@@ -649,8 +664,9 @@ public class AnnotationHelper {
return type.getEdmSimpleTypeInstance().valueOfString(propertyValue,
EdmLiteralKind.DEFAULT, null, fieldClass);
} catch (EdmSimpleTypeException ex) {
- throw new ODataRuntimeException("Conversion failed for string property with error: "
- + ex.getMessage(), ex);
+ throw new ODataRuntimeException("Conversion failed for string property ["
+ + propertyValue + "] on field ["
+ + field + "] with error: " + ex.getMessage(), ex);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1ce2c877/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationsInMemoryDsTest.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationsInMemoryDsTest.java b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationsInMemoryDsTest.java
index b9ebcb3..cff39b9 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationsInMemoryDsTest.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationsInMemoryDsTest.java
@@ -25,9 +25,6 @@ import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-import org.apache.olingo.odata2.annotation.processor.core.datasource.AnnotationInMemoryDs;
-import org.apache.olingo.odata2.annotation.processor.core.datasource.DataSource;
-import org.apache.olingo.odata2.annotation.processor.core.datasource.DataStore;
import org.apache.olingo.odata2.annotation.processor.core.datasource.DataSource.BinaryData;
import org.apache.olingo.odata2.annotation.processor.core.edm.AnnotationEdmProvider;
import org.apache.olingo.odata2.annotation.processor.core.model.Building;
@@ -307,6 +304,26 @@ public class AnnotationsInMemoryDsTest {
}
}
+ @Test(expected=ODataRuntimeException.class)
+ public void readUnknownEntity() throws Exception {
+ EdmEntitySet unknownEntitySet = Mockito.mock(EdmEntitySet.class);
+ Mockito.when(unknownEntitySet.getName()).thenReturn("UnknownEntity");
+ Map<String, Object> keys = new HashMap<String, Object>();
+ keys.put("Id", "1");
+
+ // execute
+ datasource.readData(unknownEntitySet, keys);
+ }
+
+ @Test(expected=ODataRuntimeException.class)
+ public void readUnknownEntities() throws Exception {
+ EdmEntitySet unknownEntitySet = Mockito.mock(EdmEntitySet.class);
+ Mockito.when(unknownEntitySet.getName()).thenReturn("UnknownEntity");
+
+ // execute
+ datasource.readData(unknownEntitySet);
+ }
+
@Test
public void readEntities() throws Exception {
EdmEntitySet roomsEntitySet = createMockedEdmEntitySet("Rooms");
@@ -608,6 +625,43 @@ public class AnnotationsInMemoryDsTest {
}
+ @Test
+ public void writeRelations() throws Exception {
+ DataStore<Building> buildingStore = DataStore.createInMemory(Building.class, true);
+ DataStore<Room> roomStore = DataStore.createInMemory(Room.class, true);
+
+ EdmEntitySet buildingsEntitySet = createMockedEdmEntitySet("Buildings");
+ EdmEntitySet roomsEntitySet = createMockedEdmEntitySet("Rooms");
+
+ Building building = new Building();
+ building.setName("Common Building");
+ Building created = buildingStore.create(building);
+
+ Room room = new Room(42, "Room with Number");
+ room.setSeats(123);;
+ room.setVersion(4711);
+ roomStore.create(room);
+
+ Map<String, Object> targetEntityKeyValues = new HashMap<String, Object>();
+ targetEntityKeyValues.put("Id", 42);
+
+ // execute
+ datasource.writeRelation(buildingsEntitySet, building, roomsEntitySet, targetEntityKeyValues);
+
+ // validate
+ Building readBuilding = buildingStore.read(created);
+ Room readRoom = roomStore.read(new Room(42, ""));
+
+ List<Room> readRooms = readBuilding.getRooms();
+ Assert.assertEquals(1, readRooms.size());
+ Assert.assertEquals(readRoom, readRooms.get(0));
+
+ Assert.assertEquals("42", readRoom.getId());
+ Assert.assertEquals(123, readRoom.getSeats());
+ Assert.assertEquals(4711, readRoom.getVersion());
+ Assert.assertEquals(readBuilding, readRoom.getBuilding());
+ }
+
private EdmEntitySet createMockedEdmEntitySet(final String entitySetName) throws ODataException {
return createMockedEdmEntitySet(edmProvider, entitySetName);
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1ce2c877/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelperTest.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelperTest.java b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelperTest.java
new file mode 100644
index 0000000..2e95f82
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelperTest.java
@@ -0,0 +1,270 @@
+/*
+ * Copyright 2013 The Apache Software Foundation.
+ *
+ * Licensed 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.odata2.annotation.processor.core.util;
+
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.Assert;
+
+import org.apache.olingo.odata2.annotation.processor.core.model.Location;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
+import org.apache.olingo.odata2.api.annotation.edm.EdmKey;
+import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty;
+import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
+import org.apache.olingo.odata2.api.annotation.edm.EdmType;
+import org.apache.olingo.odata2.api.edm.FullQualifiedName;
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.core.exception.ODataRuntimeException;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class AnnotationHelperTest {
+
+ private final AnnotationHelper annotationHelper;
+
+ public AnnotationHelperTest() {
+ annotationHelper = new AnnotationHelper();
+ }
+
+ @Test
+ public void keyMatchMapPositive() throws ODataException {
+ SimpleEntity firstInstance = new SimpleEntity(42l, "Another Name");
+ Map<String, Object> keyName2Value = new HashMap<String, Object>();
+ keyName2Value.put("Id", Long.valueOf(42));
+
+ boolean result = annotationHelper.keyMatch(firstInstance, keyName2Value);
+
+ Assert.assertTrue(result);
+ }
+
+ @Test
+ public void keyMatchMapNegativeWrongClass() throws ODataException {
+ SimpleEntity firstInstance = new SimpleEntity(42l, "Another Name");
+ Map<String, Object> keyName2Value = new HashMap<String, Object>();
+ keyName2Value.put("Id", 42);
+
+ boolean result = annotationHelper.keyMatch(firstInstance, keyName2Value);
+
+ Assert.assertFalse(result);
+ }
+
+ @Test
+ public void keyMatchMapNegativeDifferentValues() throws ODataException {
+ SimpleEntity firstInstance = new SimpleEntity(99l, "Another Name");
+ Map<String, Object> keyName2Value = new HashMap<String, Object>();
+ keyName2Value.put("Id", 42);
+
+ boolean result = annotationHelper.keyMatch(firstInstance, keyName2Value);
+
+ Assert.assertFalse(result);
+ }
+
+ @Test
+ public void keyMatchMapNegativeDifferentValueCount() throws ODataException {
+ SimpleEntity firstInstance = new SimpleEntity(99l, "Another Name");
+ Map<String, Object> keyName2Value = new HashMap<String, Object>();
+
+ boolean result = annotationHelper.keyMatch(firstInstance, keyName2Value);
+
+ Assert.assertFalse(result);
+ }
+
+ @Test
+ public void keyMatchPositive() throws ODataException {
+ SimpleEntity firstInstance = new SimpleEntity(42l, "A Name");
+ SimpleEntity secondInstance = new SimpleEntity(42l, "Another Name");
+
+ boolean result = annotationHelper.keyMatch(firstInstance, secondInstance);
+
+ Assert.assertTrue(result);
+ }
+
+ @Test
+ public void keyMatchPositiveWithNull() throws ODataException {
+ SimpleEntity firstInstance = new SimpleEntity();
+ SimpleEntity secondInstance = new SimpleEntity();
+
+ boolean result = annotationHelper.keyMatch(firstInstance, secondInstance);
+
+ Assert.assertTrue(result);
+ }
+
+ @Test
+ public void keyMatchNegative() throws ODataException {
+ SimpleEntity firstInstance = new SimpleEntity(99l, "A Name");
+ SimpleEntity secondInstance = new SimpleEntity(42l, "A Name");
+
+ boolean result = annotationHelper.keyMatch(firstInstance, secondInstance);
+
+ Assert.assertFalse(result);
+ }
+
+ @Test
+ public void keyMatchNegativeWithNull() throws ODataException {
+ SimpleEntity firstInstance = new SimpleEntity();
+ SimpleEntity secondInstance = new SimpleEntity(42l, "A Name");
+
+ boolean result = annotationHelper.keyMatch(firstInstance, secondInstance);
+
+ Assert.assertFalse(result);
+ }
+
+ @Test
+ public void keyMatchNegativeWithNullInstance() throws ODataException {
+ SimpleEntity firstInstance = null;
+ SimpleEntity secondInstance = new SimpleEntity(42l, "A Name");
+
+ boolean result = annotationHelper.keyMatch(firstInstance, secondInstance);
+ Assert.assertFalse(result);
+
+ result = annotationHelper.keyMatch(secondInstance, firstInstance);
+ Assert.assertFalse(result);
+ }
+
+ @Test
+ public void keyMatchNegativeOneNotAnnotated() throws ODataException {
+ NotAnnotatedBean firstInstance = new NotAnnotatedBean();
+ SimpleEntity secondInstance = new SimpleEntity(42l, "A Name");
+
+ boolean result = annotationHelper.keyMatch(firstInstance, secondInstance);
+ Assert.assertFalse(result);
+
+ boolean result2 = annotationHelper.keyMatch(secondInstance, firstInstance);
+ Assert.assertFalse(result2);
+ }
+
+ @Test(expected = ODataRuntimeException.class)
+ public void keyMatchNegativeNotAnnotated() throws ODataException {
+ NotAnnotatedBean firstInstance = new NotAnnotatedBean();
+ NotAnnotatedBean secondInstance = new NotAnnotatedBean();
+
+ boolean result = annotationHelper.keyMatch(firstInstance, secondInstance);
+
+ Assert.assertFalse(result);
+ }
+
+ @Test
+ public void extractEntitTypeNameViaNavigation() throws Exception {
+ Field field = NavigationAnnotated.class.getDeclaredField("navigationPropertySimpleEntity");
+ EdmNavigationProperty enp = field.getAnnotation(EdmNavigationProperty.class);
+
+ String name = annotationHelper.extractEntitTypeName(enp, SimpleEntity.class);
+
+ Assert.assertEquals("SimpleEntity", name);
+ }
+
+ @Test
+ public void extractEntitTypeNameViaNavigationField() throws Exception {
+ Field field = NavigationAnnotated.class.getDeclaredField("navigationPropertyDefault");
+ EdmNavigationProperty enp = field.getAnnotation(EdmNavigationProperty.class);
+
+ String name = annotationHelper.extractEntitTypeName(enp, field);
+
+ Assert.assertEquals("SimpleEntity", name);
+ }
+
+ @Test
+ public void getFieldTypeForPropertyNullInstance() throws Exception {
+ Object result = annotationHelper.getFieldTypeForProperty(null, "");
+ Assert.assertNull(result);
+ }
+
+ @Test
+ public void getValueForPropertyNullInstance() throws Exception {
+ Object result = annotationHelper.getValueForProperty(null, "");
+ Assert.assertNull(result);
+ }
+
+ @Test
+ public void setValueForPropertyNullInstance() throws Exception {
+ annotationHelper.setValueForProperty(null, "", null);
+ }
+
+ @Test
+ public void extractEntitySetNameObject() {
+ Assert.assertNull(annotationHelper.extractEntitySetName(Object.class));
+ }
+
+ @Test
+ public void extractComplexTypeFqnObject() {
+ Assert.assertNull(annotationHelper.extractComplexTypeFqn(Object.class));
+ }
+
+ @Test
+ public void extractComplexTypeFqn() {
+ FullQualifiedName fqn = annotationHelper.extractComplexTypeFqn(Location.class);
+ Assert.assertEquals("RefScenario", fqn.getNamespace());
+ Assert.assertEquals("c_Location", fqn.getName());
+ }
+
+ @Test
+ public void convert() throws Exception {
+ ConversionProperty cp = new ConversionProperty();
+ annotationHelper.setValueForProperty(cp, "StringProp", "42");
+ annotationHelper.setValueForProperty(cp, "IntegerProp", "420");
+ annotationHelper.setValueForProperty(cp, "LongProp", "4200");
+ annotationHelper.setValueForProperty(cp, "FloatProp", "43");
+ annotationHelper.setValueForProperty(cp, "DoubleProp", "42.00");
+ annotationHelper.setValueForProperty(cp, "ByteProp", "1");
+
+ Assert.assertEquals("42", cp.stringProp);
+ Assert.assertEquals(Integer.valueOf(420), cp.integerProp);
+ Assert.assertEquals(Long.valueOf("4200"), cp.longProp);
+ Assert.assertEquals(new Float(43), cp.floatProp);
+ Assert.assertEquals(new Double(42.00), cp.doubleProp);
+ Assert.assertEquals(Byte.valueOf("1"), cp.byteProp);
+ }
+
+ @EdmEntityType
+ private class SimpleEntity {
+ @EdmKey
+ @EdmProperty
+ Long id;
+ @EdmProperty
+ String name;
+
+ public SimpleEntity() {}
+
+ public SimpleEntity(Long id, String name) {
+ this.id = id;
+ this.name = name;
+ }
+ }
+
+ private class NavigationAnnotated {
+ @EdmNavigationProperty(toType = SimpleEntity.class)
+ SimpleEntity navigationPropertySimpleEntity;
+ @EdmNavigationProperty
+ SimpleEntity navigationPropertyDefault;
+ }
+
+ private class ConversionProperty {
+ @EdmProperty(type=EdmType.STRING) String stringProp;
+ @EdmProperty(type=EdmType.INT32) Integer integerProp;
+ @EdmProperty(type=EdmType.INT64) Long longProp;
+ @EdmProperty(type=EdmType.DECIMAL) Float floatProp;
+ @EdmProperty(type=EdmType.DOUBLE) Double doubleProp;
+ @EdmProperty(type=EdmType.BYTE) Byte byteProp;
+ }
+
+ private class NotAnnotatedBean {
+ private String name;
+ }
+}