You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by il...@apache.org on 2014/02/20 11:47:53 UTC
[3/3] git commit: More white noise: format, final and some TODO
More white noise: format, final and some TODO
Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/commit/e6728fdd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/tree/e6728fdd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/diff/e6728fdd
Branch: refs/heads/olingo169
Commit: e6728fdd9f9e31d7a864a3d563168b3cfb3c9669
Parents: 3cee922
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Feb 20 11:47:11 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Feb 20 11:47:11 2014 +0100
----------------------------------------------------------------------
.../olingo/odata4/client/api/ODataClient.java | 44 ++++++
.../olingo/odata4/client/api/ODataConsumer.java | 45 -------
.../api/deserializer/AnnotationProperty.java | 1 +
.../api/deserializer/ClientException.java | 36 +++++
.../api/deserializer/ConsumerException.java | 36 -----
.../client/api/deserializer/Property.java | 1 +
.../odata4/client/api/deserializer/Reader.java | 8 +-
.../odata4/client/api/deserializer/Value.java | 1 +
odata4-lib/odata4-client-core/pom.xml | 118 ++++++++--------
.../odata4/client/core/ODataClientImpl.java | 25 ++++
.../odata4/client/core/ODataConsumerImpl.java | 25 ----
.../deserializer/AnnotationPropertyImpl.java | 1 +
.../core/deserializer/ComplexValueImpl.java | 12 +-
.../client/core/deserializer/EntityImpl.java | 32 ++---
.../core/deserializer/EntitySetBuilder.java | 38 +++---
.../client/core/deserializer/EntitySetImpl.java | 11 +-
.../client/core/deserializer/JsonReader.java | 28 ++--
.../deserializer/NavigationPropertyImpl.java | 12 +-
.../core/deserializer/PropertyCollection.java | 19 ++-
.../deserializer/PropertyCollectionBuilder.java | 134 ++++++++++---------
.../deserializer/StructuralPropertyImpl.java | 6 +-
.../odata4/client/core/ODataClientTest.java | 33 +++++
.../odata4/client/core/ODataConsumerTest.java | 33 -----
.../deserializer/JsonReaderPerformance.java | 2 -
.../core/deserializer/JsonReaderTest.java | 21 ++-
.../client/core/testutil/StringHelper.java | 22 ++-
26 files changed, 391 insertions(+), 353 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e6728fdd/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/ODataClient.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/ODataClient.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/ODataClient.java
new file mode 100644
index 0000000..8ee2146
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/ODataClient.java
@@ -0,0 +1,44 @@
+/*
+ * 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.odata4.client.api;
+
+//TODO: Exceptionhandling
+public abstract class ODataClient {
+
+ private static final String IMPLEMENTATION = "org.apache.olingo.odata4.client.core.ODataClientImpl";
+
+ public static ODataClient create() {
+ ODataClient instance;
+
+ try {
+ final Class<?> clazz = Class.forName(ODataClient.IMPLEMENTATION);
+
+ /*
+ * We explicitly do not use the singleton pattern to keep the server state free
+ * and avoid class loading issues also during hot deployment.
+ */
+ final Object object = clazz.newInstance();
+ instance = (ODataClient) object;
+
+ } catch (final Exception e) {
+ throw new RuntimeException(e);
+ }
+ return instance;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e6728fdd/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/ODataConsumer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/ODataConsumer.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/ODataConsumer.java
deleted file mode 100644
index 31a6f76..0000000
--- a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/ODataConsumer.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.odata4.client.api;
-
-
-//TODO: Exceptionhandling
-public abstract class ODataConsumer {
-
- private static final String IMPLEMENTATION = "org.apache.olingo.odata4.client.core.ODataConsumerImpl";
-
- public static ODataConsumer create() {
- ODataConsumer instance;
-
- try {
- final Class<?> clazz = Class.forName(ODataConsumer.IMPLEMENTATION);
-
- /*
- * We explicitly do not use the singleton pattern to keep the server state free
- * and avoid class loading issues also during hot deployment.
- */
- final Object object = clazz.newInstance();
- instance = (ODataConsumer) object;
-
- } catch (final Exception e) {
- throw new RuntimeException(e);
- }
- return instance;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e6728fdd/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/AnnotationProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/AnnotationProperty.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/AnnotationProperty.java
index 1b330dd..47f641d 100644
--- a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/AnnotationProperty.java
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/AnnotationProperty.java
@@ -19,5 +19,6 @@
package org.apache.olingo.odata4.client.api.deserializer;
public interface AnnotationProperty extends Property {
+
String getValue();
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e6728fdd/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/ClientException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/ClientException.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/ClientException.java
new file mode 100644
index 0000000..04e0714
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/ClientException.java
@@ -0,0 +1,36 @@
+/*
+ * 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.odata4.client.api.deserializer;
+
+public class ClientException extends Exception {
+
+ private static final long serialVersionUID = 5148670827051750921L;
+
+ public ClientException() {
+ super();
+ }
+
+ public ClientException(final String message) {
+ super(message);
+ }
+
+ public ClientException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e6728fdd/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/ConsumerException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/ConsumerException.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/ConsumerException.java
deleted file mode 100644
index 49052d8..0000000
--- a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/ConsumerException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.odata4.client.api.deserializer;
-
-public class ConsumerException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
- public ConsumerException() {
- super();
- }
-
- public ConsumerException(final String message) {
- super(message);
- }
-
- public ConsumerException(final String message, final Throwable cause) {
- super(message, cause);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e6728fdd/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Property.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Property.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Property.java
index 4d69c27..45c063f 100644
--- a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Property.java
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Property.java
@@ -19,5 +19,6 @@
package org.apache.olingo.odata4.client.api.deserializer;
public interface Property {
+
String getName();
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e6728fdd/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Reader.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Reader.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Reader.java
index 54306ea..af526bc 100644
--- a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Reader.java
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Reader.java
@@ -22,9 +22,9 @@ import java.io.InputStream;
public interface Reader {
- public abstract EntitySet readEntitySet(InputStream in) throws ConsumerException;
+ EntitySet readEntitySet(InputStream in) throws ClientException;
- public abstract Entity readEntity(InputStream in) throws ConsumerException;
+ Entity readEntity(InputStream in) throws ClientException;
- public abstract Property readProperty(InputStream in) throws ConsumerException;
-}
\ No newline at end of file
+ Property readProperty(InputStream in) throws ClientException;
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e6728fdd/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Value.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Value.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Value.java
index aec70ee..70e23e9 100644
--- a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Value.java
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Value.java
@@ -19,6 +19,7 @@
package org.apache.olingo.odata4.client.api.deserializer;
public interface Value {
+
boolean isComplex();
Object getContent();
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e6728fdd/odata4-lib/odata4-client-core/pom.xml
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/pom.xml b/odata4-lib/odata4-client-core/pom.xml
index e3395f4..1a4a4b2 100644
--- a/odata4-lib/odata4-client-core/pom.xml
+++ b/odata4-lib/odata4-client-core/pom.xml
@@ -1,59 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- 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. -->
+<!--
+
+ 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.
+
+-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
- <artifactId>olingo-odata4-client-core-incubating</artifactId>
- <packaging>jar</packaging>
- <name>${project.artifactId}</name>
+ <artifactId>olingo-odata4-client-core-incubating</artifactId>
+ <packaging>jar</packaging>
+ <name>${project.artifactId}</name>
- <parent>
- <groupId>org.apache.olingo</groupId>
- <artifactId>olingo-odata4-lib-incubating</artifactId>
- <version>0.1.0-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
+ <parent>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>olingo-odata4-lib-incubating</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
- <dependencies>
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>olingo-odata4-client-api-incubating</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>olingo-odata4-commons-core-incubating</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>olingo-odata4-client-api-incubating</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>olingo-odata4-commons-core-incubating</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ </dependency>
+ </dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e6728fdd/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataClientImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataClientImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataClientImpl.java
new file mode 100644
index 0000000..9af91b3
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataClientImpl.java
@@ -0,0 +1,25 @@
+/*
+ * 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.odata4.client.core;
+
+import org.apache.olingo.odata4.client.api.ODataClient;
+
+public class ODataClientImpl extends ODataClient {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e6728fdd/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataConsumerImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataConsumerImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataConsumerImpl.java
deleted file mode 100644
index 3b97245..0000000
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataConsumerImpl.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.odata4.client.core;
-
-import org.apache.olingo.odata4.client.api.ODataConsumer;
-
-public class ODataConsumerImpl extends ODataConsumer {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e6728fdd/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/AnnotationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/AnnotationPropertyImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/AnnotationPropertyImpl.java
index 29ea631..1afc996 100644
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/AnnotationPropertyImpl.java
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/AnnotationPropertyImpl.java
@@ -23,6 +23,7 @@ import org.apache.olingo.odata4.client.api.deserializer.AnnotationProperty;
public class AnnotationPropertyImpl implements AnnotationProperty {
private final String name;
+
private final String value;
public AnnotationPropertyImpl(final String name, final String value) {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e6728fdd/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/ComplexValueImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/ComplexValueImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/ComplexValueImpl.java
index e344b0e..3312591 100644
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/ComplexValueImpl.java
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/ComplexValueImpl.java
@@ -29,17 +29,19 @@ import org.apache.olingo.odata4.client.api.deserializer.Value;
public class ComplexValueImpl extends PropertyCollection implements ComplexValue {
- public ComplexValueImpl() {}
+ public ComplexValueImpl() {
+ }
public ComplexValueImpl(final Map<String, AnnotationProperty> annotationProperties,
- final Map<String, NavigationProperty> navigationProperties,
- final Map<String, StructuralProperty> structuralProperties) {
+ final Map<String, NavigationProperty> navigationProperties,
+ final Map<String, StructuralProperty> structuralProperties) {
+
super(annotationProperties, navigationProperties, structuralProperties);
}
@Override
public Value getValue(final String name) {
- StructuralProperty property = structuralProperties.get(name);
+ final StructuralProperty property = structuralProperties.get(name);
if (property == null) {
return null;
}
@@ -75,6 +77,6 @@ public class ComplexValueImpl extends PropertyCollection implements ComplexValue
@Override
public String toString() {
return "ComplexValueImpl [annotations=" + annotationProperties + ", navigationProperties=" + navigationProperties
- + ", properties=" + structuralProperties + "]";
+ + ", properties=" + structuralProperties + "]";
}
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e6728fdd/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntityImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntityImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntityImpl.java
index 4c09062..abd5d4b 100644
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntityImpl.java
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntityImpl.java
@@ -28,11 +28,13 @@ import org.apache.olingo.odata4.client.api.deserializer.StructuralProperty;
public class EntityImpl extends PropertyCollection implements Entity {
- public EntityImpl() {}
+ public EntityImpl() {
+ }
public EntityImpl(final Map<String, AnnotationProperty> annotationProperties,
- final Map<String, NavigationProperty> navigationProperties,
- final Map<String, StructuralProperty> structuralProperties) {
+ final Map<String, NavigationProperty> navigationProperties,
+ final Map<String, StructuralProperty> structuralProperties) {
+
super(annotationProperties, navigationProperties, structuralProperties);
}
@@ -88,7 +90,7 @@ public class EntityImpl extends PropertyCollection implements Entity {
@Override
public Object getPropertyContent(final String name) {
- StructuralProperty property = structuralProperties.get(name);
+ final StructuralProperty property = structuralProperties.get(name);
if (property != null) {
return property.getValue().getContent();
}
@@ -97,28 +99,28 @@ public class EntityImpl extends PropertyCollection implements Entity {
@Override
public Property getProperty(final String name) {
- Property p = structuralProperties.get(name);
- if (p == null) {
- p = annotationProperties.get(name);
+ Property property = structuralProperties.get(name);
+ if (property == null) {
+ property = annotationProperties.get(name);
}
- if (p == null) {
- p = navigationProperties.get(name);
+ if (property == null) {
+ property = navigationProperties.get(name);
}
- return p;
+ return property;
}
@SuppressWarnings("unchecked")
@Override
public <T extends Property> T getProperty(final String name, final Class<T> clazz) {
- Property p = getProperty(name);
- return (T) p;
+ final Property property = getProperty(name);
+ return (T) property;
}
private String getAnnotationValue(final String key) {
- AnnotationProperty prop = annotationProperties.get(key);
- if (prop == null) {
+ final AnnotationProperty property = annotationProperties.get(key);
+ if (property == null) {
return null;
}
- return prop.getValue();
+ return property.getValue();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e6728fdd/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntitySetBuilder.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntitySetBuilder.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntitySetBuilder.java
index 0960799..8d4faad 100644
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntitySetBuilder.java
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntitySetBuilder.java
@@ -39,27 +39,31 @@ public class EntitySetBuilder {
}
private EntitySet parseEntitySet(final JsonParser jp) throws JsonParseException, IOException {
- EntitySetImpl entitySet = new EntitySetImpl();
+ final EntitySetImpl entitySet = new EntitySetImpl();
boolean arrayStarted = false;
while (jp.nextToken() != null) {
- JsonToken token = jp.getCurrentToken();
+ final JsonToken token = jp.getCurrentToken();
switch (token) {
- case START_ARRAY:
- PropertyCollectionBuilder builder = new PropertyCollectionBuilder(jp, entitySet);
- entitySet.setPropertyCollectionBuilder(builder);
- arrayStarted = true;
- break;
- case START_OBJECT:
- if (arrayStarted) {
- return entitySet;
- }
- break;
- case VALUE_NUMBER_INT:
- case VALUE_STRING:
- entitySet.addAnnotation(jp.getCurrentName(), jp.getValueAsString());
- default:
- break;
+ case START_ARRAY:
+ final PropertyCollectionBuilder builder = new PropertyCollectionBuilder(jp, entitySet);
+ entitySet.setPropertyCollectionBuilder(builder);
+ arrayStarted = true;
+ break;
+
+ case START_OBJECT:
+ if (arrayStarted) {
+ return entitySet;
+ }
+ break;
+
+ case VALUE_NUMBER_INT:
+ case VALUE_STRING:
+ entitySet.addAnnotation(jp.getCurrentName(), jp.getValueAsString());
+ break;
+
+ default:
+ break;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e6728fdd/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntitySetImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntitySetImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntitySetImpl.java
index 53be2b4..1c9dd66 100644
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntitySetImpl.java
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntitySetImpl.java
@@ -31,9 +31,13 @@ import com.fasterxml.jackson.core.JsonParseException;
public class EntitySetImpl implements EntitySet, Iterator<Entity> {
private String odataContext;
+
private Long odataCount;
+
private String odataNextLink;
+
private String odataDeltaLink;
+
private List<Entity> entities = null;
private PropertyCollectionBuilder propertyCollectionsBuilder;
@@ -91,7 +95,9 @@ public class EntitySetImpl implements EntitySet, Iterator<Entity> {
public boolean hasNext() {
try {
return propertyCollectionsBuilder.hasNext();
- } catch (JsonParseException e) {} catch (IOException e) {}
+ } catch (JsonParseException e) {
+ } catch (IOException e) {
+ }
return false;
}
@@ -104,7 +110,8 @@ public class EntitySetImpl implements EntitySet, Iterator<Entity> {
}
@Override
- public void remove() {}
+ public void remove() {
+ }
@Override
public Iterator<Entity> iterator() {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e6728fdd/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/JsonReader.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/JsonReader.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/JsonReader.java
index 80ce834..1cbe6c1 100644
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/JsonReader.java
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/JsonReader.java
@@ -22,7 +22,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
-import org.apache.olingo.odata4.client.api.deserializer.ConsumerException;
+import org.apache.olingo.odata4.client.api.deserializer.ClientException;
import org.apache.olingo.odata4.client.api.deserializer.Entity;
import org.apache.olingo.odata4.client.api.deserializer.EntitySet;
import org.apache.olingo.odata4.client.api.deserializer.Property;
@@ -36,36 +36,36 @@ import com.fasterxml.jackson.core.JsonParser;
public class JsonReader implements Reader {
@Override
- public EntitySet readEntitySet(final InputStream in) throws ConsumerException {
+ public EntitySet readEntitySet(final InputStream in) throws ClientException {
- JsonFactory jsonFactory = new JsonFactory();
+ final JsonFactory jsonFactory = new JsonFactory();
// or, for data binding, org.codehaus.jackson.mapper.MappingJsonFactory
try {
JsonParser jp = jsonFactory.createParser(in);
EntitySetBuilder entitySet = new EntitySetBuilder(jp);
return entitySet.buildEntitySet();
} catch (JsonParseException e) {
- throw new ConsumerException("JSON Parsing failed.", e);
+ throw new ClientException("JSON Parsing failed.", e);
} catch (IOException e) {
- throw new ConsumerException("JSON Parsing failed.", e);
+ throw new ClientException("JSON Parsing failed.", e);
}
}
@Override
- public Entity readEntity(final InputStream in) throws ConsumerException {
+ public Entity readEntity(final InputStream in) throws ClientException {
Entity entity = null;
- JsonFactory jsonFactory = new JsonFactory();
+ final JsonFactory jsonFactory = new JsonFactory();
// or, for data binding, org.codehaus.jackson.mapper.MappingJsonFactory
try {
- JsonParser jp = jsonFactory.createParser(in);
- PropertyCollectionBuilder builder = new PropertyCollectionBuilder(jp);
+ final JsonParser jp = jsonFactory.createParser(in);
+ final PropertyCollectionBuilder builder = new PropertyCollectionBuilder(jp);
builder.parseNext();
entity = builder.buildEntity();
} catch (JsonParseException e) {
- throw new ConsumerException("JSON Parsing failed.", e);
+ throw new ClientException("JSON Parsing failed.", e);
} catch (IOException e) {
- throw new ConsumerException("JSON Parsing failed.", e);
+ throw new ClientException("JSON Parsing failed.", e);
}
return entity;
@@ -77,10 +77,10 @@ public class JsonReader implements Reader {
* @see org.apache.olingo.core.consumer.Reader#parseProperty(java.io.InputStream)
*/
@Override
- public Property readProperty(final InputStream in) throws ConsumerException {
- Entity entity = readEntity(in);
+ public Property readProperty(final InputStream in) throws ClientException {
+ final Entity entity = readEntity(in);
- Map<String, StructuralProperty> properties = entity.getStructuralProperties();
+ final Map<String, StructuralProperty> properties = entity.getStructuralProperties();
if (properties.size() == 1) {
return properties.values().iterator().next();
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e6728fdd/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/NavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/NavigationPropertyImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/NavigationPropertyImpl.java
index b049ca0..c16dafb 100644
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/NavigationPropertyImpl.java
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/NavigationPropertyImpl.java
@@ -23,7 +23,9 @@ import org.apache.olingo.odata4.client.api.deserializer.NavigationProperty;
public class NavigationPropertyImpl implements NavigationProperty {
private final String name;
+
private String associationLink;
+
private String navigationLink;
public NavigationPropertyImpl(final String name) {
@@ -51,8 +53,8 @@ public class NavigationPropertyImpl implements NavigationProperty {
}
public void updateLink(final String name, final String link) {
- String regexNavigationLink = ".*@odata.navigationLink$";
- String regexAssociationLink = ".*@odata.associationLink$";
+ final String regexNavigationLink = ".*@odata.navigationLink$";
+ final String regexAssociationLink = ".*@odata.associationLink$";
if (name.matches(regexNavigationLink)) {
navigationLink = link;
} else if (name.matches(regexAssociationLink)) {
@@ -61,12 +63,12 @@ public class NavigationPropertyImpl implements NavigationProperty {
}
private String parseName(final String nameToParse) {
- String[] split = nameToParse.split("@");
+ final String[] split = nameToParse.split("@");
if (split.length == 2) {
return split[0];
} else {
throw new IllegalArgumentException("Got OData Navigation with unparseable format '"
- + nameToParse + "'.");
+ + nameToParse + "'.");
}
}
@@ -82,6 +84,6 @@ public class NavigationPropertyImpl implements NavigationProperty {
@Override
public String toString() {
return "NavigationPropertyImpl [name=" + name + ", associationLink=" + associationLink
- + ", navigationLink=" + navigationLink + "]";
+ + ", navigationLink=" + navigationLink + "]";
}
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e6728fdd/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollection.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollection.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollection.java
index 07904c4..0784ea4 100644
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollection.java
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollection.java
@@ -30,24 +30,29 @@ import org.apache.olingo.odata4.client.api.deserializer.Property;
import org.apache.olingo.odata4.client.api.deserializer.StructuralProperty;
abstract class PropertyCollection {
+
protected Map<String, AnnotationProperty> annotationProperties = new HashMap<String, AnnotationProperty>();
+
protected Map<String, NavigationProperty> navigationProperties = new HashMap<String, NavigationProperty>();
+
protected Map<String, StructuralProperty> structuralProperties = new HashMap<String, StructuralProperty>();
- public PropertyCollection() {}
+ public PropertyCollection() {
+ }
protected PropertyCollection(final Map<String, AnnotationProperty> annotationProperties,
- final Map<String, NavigationProperty> navigationProperties,
- final Map<String, StructuralProperty> structuralProperties) {
+ final Map<String, NavigationProperty> navigationProperties,
+ final Map<String, StructuralProperty> structuralProperties) {
+
this.annotationProperties = annotationProperties;
this.navigationProperties = navigationProperties;
this.structuralProperties = structuralProperties;
}
public List<Property> getProperties() {
- int initialCapacity = annotationProperties.size() + navigationProperties.size() + structuralProperties.size();
+ final int initialCapacity = annotationProperties.size() + navigationProperties.size() + structuralProperties.size();
- List<Property> properties = new ArrayList<Property>(initialCapacity);
+ final List<Property> properties = new ArrayList<Property>(initialCapacity);
properties.addAll(annotationProperties.values());
properties.addAll(navigationProperties.values());
properties.addAll(structuralProperties.values());
@@ -73,11 +78,11 @@ abstract class PropertyCollection {
}
if (property instanceof NavigationPropertyImpl) {
- NavigationPropertyImpl navProperty = (NavigationPropertyImpl) navigationProperties.get(property.getName());
+ final NavigationPropertyImpl navProperty = (NavigationPropertyImpl) navigationProperties.get(property.getName());
if (navProperty == null) {
navigationProperties.put(property.getName(), (NavigationPropertyImpl) property);
} else {
- NavigationProperty temp = (NavigationProperty) property;
+ final NavigationProperty temp = (NavigationProperty) property;
navProperty.updateLink(temp);
}
} else if (property instanceof AnnotationPropertyImpl) {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e6728fdd/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollectionBuilder.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollectionBuilder.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollectionBuilder.java
index d98fc18..90733b2 100644
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollectionBuilder.java
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollectionBuilder.java
@@ -36,14 +36,19 @@ import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
public class PropertyCollectionBuilder extends PropertyCollection {
+
private JsonParser parser;
+
private EntitySetImpl enclosingEntitySet;
+ private PropertyCollectionBuilder next = null;
+
public PropertyCollectionBuilder(final JsonParser parser) {
this.parser = parser;
}
- private PropertyCollectionBuilder() {};
+ private PropertyCollectionBuilder() {
+ }
public PropertyCollectionBuilder(final JsonParser jp, final EntitySetImpl entitySet) {
this(jp);
@@ -51,15 +56,15 @@ public class PropertyCollectionBuilder extends PropertyCollection {
}
public Entity buildEntity() {
- Entity v = new EntityImpl(annotationProperties, navigationProperties, structuralProperties);
+ final Entity entity = new EntityImpl(annotationProperties, navigationProperties, structuralProperties);
resetProperties();
- return v;
+ return entity;
}
public ComplexValue buildComplexValue() {
- ComplexValue v = new ComplexValueImpl(annotationProperties, navigationProperties, structuralProperties);
+ final ComplexValue value = new ComplexValueImpl(annotationProperties, navigationProperties, structuralProperties);
resetProperties();
- return v;
+ return value;
}
private void resetProperties() {
@@ -68,8 +73,6 @@ public class PropertyCollectionBuilder extends PropertyCollection {
structuralProperties = new HashMap<String, StructuralProperty>();
}
- private PropertyCollectionBuilder next = null;
-
public boolean hasNext() throws JsonParseException, IOException {
if (parser.isClosed()) {
return false;
@@ -92,6 +95,7 @@ public class PropertyCollectionBuilder extends PropertyCollection {
return true;
}
} catch (JsonParseException e) {
+ // TODO: SLF4J Logging!
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
@@ -101,7 +105,7 @@ public class PropertyCollectionBuilder extends PropertyCollection {
}
/**
- *
+ *
* @param jp
* @param builder
* @return
@@ -109,7 +113,8 @@ public class PropertyCollectionBuilder extends PropertyCollection {
* @throws JsonParseException
*/
private PropertyCollectionBuilder parseNextObject(final JsonParser jp, final PropertyCollectionBuilder builder)
- throws JsonParseException, IOException {
+ throws JsonParseException, IOException {
+
boolean endReached = readToStartObjectOrEnd(jp);
if (endReached) {
return null;
@@ -120,55 +125,55 @@ public class PropertyCollectionBuilder extends PropertyCollection {
List<Value> values = null;
while (jp.nextToken() != null) {
- JsonToken token = jp.getCurrentToken();
+ final JsonToken token = jp.getCurrentToken();
switch (token) {
- case START_OBJECT:
- if (currentFieldName != null) {
- ComplexValue cvp = parseNextObject(jp, new PropertyCollectionBuilder()).buildComplexValue();
+ case START_OBJECT:
+ if (currentFieldName != null) {
+ final ComplexValue cvp = parseNextObject(jp, new PropertyCollectionBuilder()).buildComplexValue();
+ if (values == null) {
+ builder.addProperty(new StructuralPropertyImpl(currentFieldName, cvp));
+ } else {
+ values.add(cvp);
+ }
+ }
+ break;
+ case END_OBJECT:
+ return builder;
+ case START_ARRAY:
+ values = new ArrayList<Value>();
+ break;
+ case END_ARRAY:
+ if (values != null) {
+ builder.addProperty(new StructuralPropertyImpl(currentFieldName, values));
+ values = null;
+ }
+ break;
+ case FIELD_NAME:
+ currentFieldName = jp.getCurrentName();
+ break;
+ case NOT_AVAILABLE:
+ break;
+ case VALUE_EMBEDDED_OBJECT:
+ break;
+ case VALUE_NULL:
+ Property nullProperty = createProperty(jp.getCurrentName(), null);
+ builder.addProperty(nullProperty);
+ break;
+ case VALUE_FALSE:
+ case VALUE_NUMBER_FLOAT:
+ case VALUE_NUMBER_INT:
+ case VALUE_STRING:
+ case VALUE_TRUE:
if (values == null) {
- builder.addProperty(new StructuralPropertyImpl(currentFieldName, cvp));
+ Property property = createProperty(jp.getCurrentName(), jp.getValueAsString());
+ builder.addProperty(property);
} else {
- values.add(cvp);
+ PrimitiveValue value = new PrimitiveValue(jp.getValueAsString());
+ values.add(value);
}
- }
- break;
- case END_OBJECT:
- return builder;
- case START_ARRAY:
- values = new ArrayList<Value>();
- break;
- case END_ARRAY:
- if (values != null) {
- builder.addProperty(new StructuralPropertyImpl(currentFieldName, values));
- values = null;
- }
- break;
- case FIELD_NAME:
- currentFieldName = jp.getCurrentName();
- break;
- case NOT_AVAILABLE:
- break;
- case VALUE_EMBEDDED_OBJECT:
- break;
- case VALUE_NULL:
- Property nullProperty = createProperty(jp.getCurrentName(), null);
- builder.addProperty(nullProperty);
- break;
- case VALUE_FALSE:
- case VALUE_NUMBER_FLOAT:
- case VALUE_NUMBER_INT:
- case VALUE_STRING:
- case VALUE_TRUE:
- if (values == null) {
- Property property = createProperty(jp.getCurrentName(), jp.getValueAsString());
- builder.addProperty(property);
- } else {
- PrimitiveValue value = new PrimitiveValue(jp.getValueAsString());
- values.add(value);
- }
- break;
- default:
- break;
+ break;
+ default:
+ break;
}
}
@@ -176,20 +181,21 @@ public class PropertyCollectionBuilder extends PropertyCollection {
}
private boolean readToStartObjectOrEnd(final JsonParser jp) throws IOException, JsonParseException {
- JsonToken endToken = JsonToken.START_OBJECT;
+ final JsonToken endToken = JsonToken.START_OBJECT;
JsonToken token = jp.getCurrentToken() == null ? jp.nextToken() : jp.getCurrentToken();
while (token != null && token != endToken) {
if (enclosingEntitySet != null) {
switch (token) {
- case VALUE_FALSE:
- case VALUE_NUMBER_FLOAT:
- case VALUE_NUMBER_INT:
- case VALUE_TRUE:
- case VALUE_STRING:
- enclosingEntitySet.addAnnotation(jp.getCurrentName(), jp.getValueAsString());
- break;
- default:
- break;
+ case VALUE_FALSE:
+ case VALUE_NUMBER_FLOAT:
+ case VALUE_NUMBER_INT:
+ case VALUE_TRUE:
+ case VALUE_STRING:
+ enclosingEntitySet.addAnnotation(jp.getCurrentName(), jp.getValueAsString());
+ break;
+
+ default:
+ break;
}
}
//
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e6728fdd/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/StructuralPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/StructuralPropertyImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/StructuralPropertyImpl.java
index 7e38ab5..8e4f62e 100644
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/StructuralPropertyImpl.java
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/StructuralPropertyImpl.java
@@ -28,7 +28,9 @@ import org.apache.olingo.odata4.client.api.deserializer.Value;
public class StructuralPropertyImpl implements StructuralProperty {
private final List<Value> values;
+
private final String name;
+
private final boolean containsCollection;
public StructuralPropertyImpl(final String name, final Value value) {
@@ -36,7 +38,7 @@ public class StructuralPropertyImpl implements StructuralProperty {
}
public StructuralPropertyImpl(final String name, final List<Value> values) {
- // XXX: ugly -> refactore
+ // XXX: ugly -> refactor
this(name, true, values.toArray(new Value[0]));
}
@@ -76,6 +78,6 @@ public class StructuralPropertyImpl implements StructuralProperty {
@Override
public String toString() {
return "StructuralPropertyImpl [name=" + name + ", containsCollection=" + containsCollection
- + ", values=" + values + "]";
+ + ", values=" + values + "]";
}
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e6728fdd/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/ODataClientTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/ODataClientTest.java b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/ODataClientTest.java
new file mode 100644
index 0000000..814435b
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/ODataClientTest.java
@@ -0,0 +1,33 @@
+/*
+ * 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.odata4.client.core;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.apache.olingo.odata4.client.api.ODataClient;
+import org.junit.Test;
+
+public class ODataClientTest {
+
+ @Test
+ public void before() {
+ ODataClient client = ODataClient.create();
+ assertNotNull(client);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e6728fdd/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/ODataConsumerTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/ODataConsumerTest.java b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/ODataConsumerTest.java
deleted file mode 100644
index 11feb9c..0000000
--- a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/ODataConsumerTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.odata4.client.core;
-
-import static org.junit.Assert.assertNotNull;
-
-import org.apache.olingo.odata4.client.api.ODataConsumer;
-import org.junit.Test;
-
-public class ODataConsumerTest {
-
- @Test
- public void before() {
- ODataConsumer consumer = ODataConsumer.create();
- assertNotNull(consumer);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e6728fdd/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/deserializer/JsonReaderPerformance.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/deserializer/JsonReaderPerformance.java b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/deserializer/JsonReaderPerformance.java
index 073c10f..ff4d6c3 100644
--- a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/deserializer/JsonReaderPerformance.java
+++ b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/deserializer/JsonReaderPerformance.java
@@ -29,7 +29,6 @@ import org.apache.olingo.odata4.client.api.deserializer.ComplexValue;
import org.apache.olingo.odata4.client.api.deserializer.Property;
import org.apache.olingo.odata4.client.api.deserializer.StructuralProperty;
import org.apache.olingo.odata4.client.api.deserializer.Value;
-import org.apache.olingo.odata4.client.core.deserializer.JsonReader;
import org.apache.olingo.odata4.client.core.testutil.StringHelper;
import org.junit.Test;
@@ -55,7 +54,6 @@ public class JsonReaderPerformance {
// long duration = endTime - startTime;
// System.out.println("Duration: " + duration + " ms");
// System.out.println("Duration per run: " + (duration / (float) runs) + " ms");
-
testComplexProperty(complex);
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e6728fdd/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/deserializer/JsonReaderTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/deserializer/JsonReaderTest.java b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/deserializer/JsonReaderTest.java
index fca91c7..353ee1a 100644
--- a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/deserializer/JsonReaderTest.java
+++ b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/deserializer/JsonReaderTest.java
@@ -29,8 +29,6 @@ import java.util.Collection;
import java.util.Iterator;
import java.util.List;
-import junit.framework.Assert;
-
import org.apache.olingo.odata4.client.api.deserializer.ComplexValue;
import org.apache.olingo.odata4.client.api.deserializer.Entity;
import org.apache.olingo.odata4.client.api.deserializer.EntitySet;
@@ -38,7 +36,6 @@ import org.apache.olingo.odata4.client.api.deserializer.Property;
import org.apache.olingo.odata4.client.api.deserializer.Reader;
import org.apache.olingo.odata4.client.api.deserializer.StructuralProperty;
import org.apache.olingo.odata4.client.api.deserializer.Value;
-import org.apache.olingo.odata4.client.core.deserializer.JsonReader;
import org.junit.Test;
public class JsonReaderTest {
@@ -48,7 +45,7 @@ public class JsonReaderTest {
Reader consumer = new JsonReader();
EntitySet entitySet = consumer.readEntitySet(
- JsonReaderTest.class.getResourceAsStream("/fullEntitySet.json"));
+ JsonReaderTest.class.getResourceAsStream("/fullEntitySet.json"));
List<Entity> entities = entitySet.getEntities();
validateEntitySet(entitySet);
@@ -243,8 +240,8 @@ public class JsonReaderTest {
InputStream content = JsonReaderTest.class.getResourceAsStream("/setOfComplexProperties.json");
Property property = consumer.readProperty(content);
- Assert.assertEquals("PhoneNumbers", property.getName());
- Assert.assertTrue(property instanceof StructuralProperty);
+ assertEquals("PhoneNumbers", property.getName());
+ assertTrue(property instanceof StructuralProperty);
StructuralProperty structuralProperty = (StructuralProperty) property;
assertTrue(structuralProperty.containsCollection());
@@ -262,7 +259,7 @@ public class JsonReaderTest {
assertEquals("Cell", phoneNumberTwo.getValue("Type").getContent());
assertEquals("Sprint", phoneNumberTwo.getValue("Carrier").getContent());
assertEquals("#Model.CellPhoneNumber",
- phoneNumberTwo.getAnnotationProperties().get("odata.type").getValue());
+ phoneNumberTwo.getAnnotationProperties().get("odata.type").getValue());
// ComplexValue complex = consumer.parseComplexValue(content);
//
@@ -283,12 +280,12 @@ public class JsonReaderTest {
assertNotNull(entity.getNavigationProperties());
assertTrue(entity.getNavigationProperties().containsKey("Orders"));
assertEquals("Customers('ALFKI')/Orders",
- entity.getNavigationProperties().get("Orders").getNavigationLink());
+ entity.getNavigationProperties().get("Orders").getNavigationLink());
assertNotNull(entity.getNavigationProperties());
assertTrue(entity.getNavigationProperties().containsKey("Orders"));
assertEquals("Customers('ALFKI')/Orders/$ref",
- entity.getNavigationProperties().get("Orders").getAssociationLink());
+ entity.getNavigationProperties().get("Orders").getAssociationLink());
assertNotNull(entity.getPropertyContent("ID"));
assertEquals("ALFKI", entity.getPropertyContent("ID"));
@@ -314,7 +311,7 @@ public class JsonReaderTest {
assertNotNull(entity.getNavigationProperties());
assertTrue(entity.getNavigationProperties().containsKey("Orders"));
assertEquals("Customers('MUSKI')/Orders/$ref",
- entity.getNavigationProperties().get("Orders").getAssociationLink());
+ entity.getNavigationProperties().get("Orders").getAssociationLink());
assertNotNull(entity.getPropertyContent("ID"));
assertEquals("MUSKI", entity.getPropertyContent("ID"));
@@ -345,12 +342,12 @@ public class JsonReaderTest {
assertNotNull(complex.getNavigationProperties());
assertTrue(complex.getNavigationProperties().containsKey("Country"));
assertEquals("Customers('ALFKI')/Address/Country",
- complex.getNavigationProperties().get("Country").getNavigationLink());
+ complex.getNavigationProperties().get("Country").getNavigationLink());
assertNotNull(complex.getNavigationProperties());
assertTrue(complex.getNavigationProperties().containsKey("Country"));
assertEquals("Customers('ALFKI')/Address/Country/$ref",
- complex.getNavigationProperties().get("Country").getAssociationLink());
+ complex.getNavigationProperties().get("Country").getAssociationLink());
}
private void validateEntitySet(final EntitySet entitySet) {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e6728fdd/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/testutil/StringHelper.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/testutil/StringHelper.java b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/testutil/StringHelper.java
index bd785fe..90b7479 100644
--- a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/testutil/StringHelper.java
+++ b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/testutil/StringHelper.java
@@ -26,9 +26,7 @@ import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
-/**
- * @author SAP AG
- */
+// TODO: remove this class in favor of StringUtils, IOUtils, ...
public class StringHelper {
public static String inputStreamToString(final InputStream in, final boolean preserveLineBreaks) throws IOException {
@@ -56,7 +54,7 @@ public class StringHelper {
/**
* Encapsulate given content in an {@link InputStream} with charset <code>UTF-8</code>.
- *
+ *
* @param content to encapsulate content
* @return content as stream
*/
@@ -71,20 +69,20 @@ public class StringHelper {
/**
* Encapsulate given content in an {@link InputStream} with given charset.
- *
+ *
* @param content to encapsulate content
* @param charset to be used charset
* @return content as stream
* @throws UnsupportedEncodingException if charset is not supported
*/
public static InputStream encapsulate(final String content, final String charset)
- throws UnsupportedEncodingException {
+ throws UnsupportedEncodingException {
return new ByteArrayInputStream(content.getBytes(charset));
}
/**
* Generate a string with given length containing random upper case characters ([A-Z]).
- *
+ *
* @param len length of to generated string
* @return random upper case characters ([A-Z]).
*/
@@ -94,17 +92,17 @@ public class StringHelper {
/**
* Generate a string with given length containing random upper case characters ([A-Z]).
- *
+ *
* @param len length of to generated string
* @return random upper case characters ([A-Z]).
*/
public static String generateData(final int len) {
- StringBuilder b = new StringBuilder(len);
+ final StringBuilder builder = new StringBuilder(len);
for (int j = 0; j < len; j++) {
- char c = (char) (Math.random() * 26 + 65);
- b.append(c);
+ final char c = (char) (Math.random() * 26 + 65);
+ builder.append(c);
}
- return b.toString();
+ return builder.toString();
}
}