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/03/07 10:09:32 UTC
[43/57] [abbrv] [OLINGO-186] client-side implementation of commons
Edm interfaces completed: some refactoring on server-side performed to
extract common abstract implementation
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/LabeledElementReference.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/LabeledElementReference.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/LabeledElementReference.java
new file mode 100644
index 0000000..e24a04e
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/LabeledElementReference.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.edm.xml.v4.annotation;
+
+public class LabeledElementReference extends AbstractElOrAttrConstruct {
+
+ private static final long serialVersionUID = 3649068436729494270L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/NavigationPropertyPath.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/NavigationPropertyPath.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/NavigationPropertyPath.java
new file mode 100644
index 0000000..c3685f4
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/NavigationPropertyPath.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.edm.xml.v4.annotation;
+
+public class NavigationPropertyPath extends AbstractElOrAttrConstruct {
+
+ private static final long serialVersionUID = -8066400142504963043L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/Null.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/Null.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/Null.java
new file mode 100644
index 0000000..419413b
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/Null.java
@@ -0,0 +1,28 @@
+/*
+ * 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.edm.xml.v4.annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+@JsonDeserialize(using = NullDeserializer.class)
+public class Null extends AnnotatedDynExprConstruct {
+
+ private static final long serialVersionUID = -3611384710172781951L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/NullDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/NullDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/NullDeserializer.java
new file mode 100644
index 0000000..dc78b6a
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/NullDeserializer.java
@@ -0,0 +1,49 @@
+/*
+ * 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.edm.xml.v4.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.olingo.odata4.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.odata4.client.core.edm.xml.v4.AnnotationImpl;
+
+public class NullDeserializer extends AbstractEdmDeserializer<Null> {
+
+ @Override
+ protected Null doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final Null _null = new Null();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Annotation".equals(jp.getCurrentName())) {
+ _null.setAnnotation(jp.readValueAs(AnnotationImpl.class));
+ }
+ }
+ }
+
+ return _null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/Path.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/Path.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/Path.java
new file mode 100644
index 0000000..a5e4f9f
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/Path.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.edm.xml.v4.annotation;
+
+public class Path extends AbstractElOrAttrConstruct {
+
+ private static final long serialVersionUID = -2551058493469292082L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/PropertyPath.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/PropertyPath.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/PropertyPath.java
new file mode 100644
index 0000000..df924fe
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/PropertyPath.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.edm.xml.v4.annotation;
+
+public class PropertyPath extends AbstractElOrAttrConstruct {
+
+ private static final long serialVersionUID = 2328584735437885159L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/PropertyValue.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/PropertyValue.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/PropertyValue.java
new file mode 100644
index 0000000..6afb0d4
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/PropertyValue.java
@@ -0,0 +1,49 @@
+/*
+ * 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.edm.xml.v4.annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.apache.olingo.odata4.client.api.edm.xml.v4.annotation.ExprConstruct;
+
+@JsonDeserialize(using = PropertyValueDeserializer.class)
+public class PropertyValue extends AnnotatedDynExprConstruct {
+
+ private static final long serialVersionUID = 3081968466425707461L;
+
+ private String property;
+
+ private ExprConstruct value;
+
+ public String getProperty() {
+ return property;
+ }
+
+ public void setProperty(final String property) {
+ this.property = property;
+ }
+
+ public ExprConstruct getValue() {
+ return value;
+ }
+
+ public void setValue(final ExprConstruct value) {
+ this.value = value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/PropertyValueDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/PropertyValueDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/PropertyValueDeserializer.java
new file mode 100644
index 0000000..0871e55
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/PropertyValueDeserializer.java
@@ -0,0 +1,55 @@
+/*
+ * 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.edm.xml.v4.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.olingo.odata4.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.odata4.client.core.edm.xml.v4.AnnotationImpl;
+
+public class PropertyValueDeserializer extends AbstractEdmDeserializer<PropertyValue> {
+
+ @Override
+ protected PropertyValue doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final PropertyValue propValue = new PropertyValue();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Property".equals(jp.getCurrentName())) {
+ propValue.setProperty(jp.nextTextValue());
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ propValue.setAnnotation(jp.readValueAs(AnnotationImpl.class));
+ } else if (isAnnotationConstExprConstruct(jp)) {
+ propValue.setValue(parseAnnotationConstExprConstruct(jp));
+ } else {
+ propValue.setValue(jp.readValueAs(DynExprConstructImpl.class));
+ }
+ }
+ }
+
+ return propValue;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/Record.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/Record.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/Record.java
new file mode 100644
index 0000000..ee7d332
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/Record.java
@@ -0,0 +1,46 @@
+/*
+ * 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.edm.xml.v4.annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.ArrayList;
+import java.util.List;
+
+@JsonDeserialize(using = RecordDeserializer.class)
+public class Record extends AnnotatedDynExprConstruct {
+
+ private static final long serialVersionUID = -2886526224721870304L;
+
+ private String type;
+
+ private final List<PropertyValue> propertyValues = new ArrayList<PropertyValue>();
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ public List<PropertyValue> getPropertyValues() {
+ return propertyValues;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/RecordDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/RecordDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/RecordDeserializer.java
new file mode 100644
index 0000000..f4a6cf1
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/RecordDeserializer.java
@@ -0,0 +1,53 @@
+/*
+ * 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.edm.xml.v4.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.olingo.odata4.client.core.op.impl.AbstractEdmDeserializer;
+import org.apache.olingo.odata4.client.core.edm.xml.v4.AnnotationImpl;
+
+public class RecordDeserializer extends AbstractEdmDeserializer<Record> {
+
+ @Override
+ protected Record doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final Record record = new Record();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Tyoe".equals(jp.getCurrentName())) {
+ record.setType(jp.nextTextValue());
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ record.setAnnotation(jp.readValueAs(AnnotationImpl.class));
+ } else {
+ record.getPropertyValues().add(jp.readValueAs(PropertyValue.class));
+ }
+ }
+ }
+
+ return record;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/UrlRef.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/UrlRef.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/UrlRef.java
new file mode 100644
index 0000000..f710fa4
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/UrlRef.java
@@ -0,0 +1,39 @@
+/*
+ * 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.edm.xml.v4.annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.apache.olingo.odata4.client.api.edm.xml.v4.annotation.ExprConstruct;
+
+@JsonDeserialize(using = UrlRefDeserializer.class)
+public class UrlRef extends DynExprConstructImpl {
+
+ private static final long serialVersionUID = 3755101394647430897L;
+
+ private ExprConstruct value;
+
+ public ExprConstruct getValue() {
+ return value;
+ }
+
+ public void setValue(final ExprConstruct value) {
+ this.value = value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/UrlRefDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/UrlRefDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/UrlRefDeserializer.java
new file mode 100644
index 0000000..e3d9f61
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/xml/v4/annotation/UrlRefDeserializer.java
@@ -0,0 +1,50 @@
+/*
+ * 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.edm.xml.v4.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.olingo.odata4.client.core.op.impl.AbstractEdmDeserializer;
+
+public class UrlRefDeserializer extends AbstractEdmDeserializer<UrlRef> {
+
+ @Override
+ protected UrlRef doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final UrlRef urlref = new UrlRef();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if (isAnnotationConstExprConstruct(jp)) {
+ urlref.setValue(parseAnnotationConstExprConstruct(jp));
+ } else {
+ urlref.setValue(jp.readValueAs( DynExprConstructImpl.class));
+ }
+ }
+ }
+
+ return urlref;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/AbstractEdmDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/AbstractEdmDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/AbstractEdmDeserializer.java
index bd8c3e9..2a3aa80 100644
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/AbstractEdmDeserializer.java
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/AbstractEdmDeserializer.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser;
import java.io.IOException;
import org.apache.olingo.odata4.client.api.ODataClient;
import org.apache.olingo.odata4.client.core.edm.xml.v4.ReturnTypeImpl;
-import org.apache.olingo.odata4.client.core.edm.v4.annotation.ConstExprConstructImpl;
+import org.apache.olingo.odata4.client.core.edm.xml.v4.annotation.ConstExprConstructImpl;
public abstract class AbstractEdmDeserializer<T> extends JsonDeserializer<T> {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/v3/ODataDeserializerImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/v3/ODataDeserializerImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/v3/ODataDeserializerImpl.java
index 36b90b2..9096099 100644
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/v3/ODataDeserializerImpl.java
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/v3/ODataDeserializerImpl.java
@@ -22,6 +22,7 @@ import java.io.InputStream;
import org.apache.olingo.odata4.client.api.ODataClient;
import org.apache.olingo.odata4.client.core.op.impl.AbstractODataDeserializer;
import org.apache.olingo.odata4.client.core.edm.xml.v3.EdmxImpl;
+import org.apache.olingo.odata4.client.core.edm.xml.v3.XMLMetadataImpl;
public class ODataDeserializerImpl extends AbstractODataDeserializer {
@@ -32,9 +33,9 @@ public class ODataDeserializerImpl extends AbstractODataDeserializer {
}
@Override
- public EdmxImpl toMetadata(final InputStream input) {
+ public XMLMetadataImpl toMetadata(final InputStream input) {
try {
- return getXmlMapper().readValue(input, EdmxImpl.class);
+ return new XMLMetadataImpl(getXmlMapper().readValue(input, EdmxImpl.class));
} catch (Exception e) {
throw new IllegalArgumentException("Could not parse as Edmx document", e);
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/v3/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/v3/ODataReaderImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/v3/ODataReaderImpl.java
index 83f0494..5b1c6cc 100644
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/v3/ODataReaderImpl.java
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/v3/ODataReaderImpl.java
@@ -20,8 +20,9 @@ package org.apache.olingo.odata4.client.core.op.impl.v3;
import java.io.InputStream;
import org.apache.olingo.odata4.client.core.ODataV3Client;
+import org.apache.olingo.odata4.client.core.edm.EdmClientImpl;
import org.apache.olingo.odata4.client.core.op.impl.AbstractODataReader;
-import org.apache.olingo.odata4.client.core.edm.v3.EdmMetadataImpl;
+import org.apache.olingo.odata4.commons.api.edm.Edm;
public class ODataReaderImpl extends AbstractODataReader {
@@ -32,8 +33,8 @@ public class ODataReaderImpl extends AbstractODataReader {
}
@Override
- public EdmMetadataImpl readMetadata(final InputStream input) {
- return new EdmMetadataImpl(client, input);
+ public Edm readMetadata(final InputStream input) {
+ return new EdmClientImpl(client.getDeserializer().toMetadata(input));
}
// @Override
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/v4/ODataDeserializerImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/v4/ODataDeserializerImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/v4/ODataDeserializerImpl.java
index b97b69b..83c1aea 100644
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/v4/ODataDeserializerImpl.java
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/v4/ODataDeserializerImpl.java
@@ -22,6 +22,7 @@ import java.io.InputStream;
import org.apache.olingo.odata4.client.api.ODataClient;
import org.apache.olingo.odata4.client.core.op.impl.AbstractODataDeserializer;
import org.apache.olingo.odata4.client.core.edm.xml.v4.EdmxImpl;
+import org.apache.olingo.odata4.client.core.edm.xml.v4.XMLMetadataImpl;
public class ODataDeserializerImpl extends AbstractODataDeserializer {
@@ -32,9 +33,9 @@ public class ODataDeserializerImpl extends AbstractODataDeserializer {
}
@Override
- public EdmxImpl toMetadata(final InputStream input) {
+ public XMLMetadataImpl toMetadata(final InputStream input) {
try {
- return getXmlMapper().readValue(input, EdmxImpl.class);
+ return new XMLMetadataImpl(getXmlMapper().readValue(input, EdmxImpl.class));
} catch (Exception e) {
throw new IllegalArgumentException("Could not parse as Edmx document", e);
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/v4/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/v4/ODataReaderImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/v4/ODataReaderImpl.java
index 11b7112..35209c2 100644
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/v4/ODataReaderImpl.java
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/op/impl/v4/ODataReaderImpl.java
@@ -20,8 +20,9 @@ package org.apache.olingo.odata4.client.core.op.impl.v4;
import java.io.InputStream;
import org.apache.olingo.odata4.client.core.ODataV4Client;
+import org.apache.olingo.odata4.client.core.edm.EdmClientImpl;
import org.apache.olingo.odata4.client.core.op.impl.AbstractODataReader;
-import org.apache.olingo.odata4.client.core.edm.v4.EdmMetadataImpl;
+import org.apache.olingo.odata4.commons.api.edm.Edm;
public class ODataReaderImpl extends AbstractODataReader {
@@ -32,8 +33,8 @@ public class ODataReaderImpl extends AbstractODataReader {
}
@Override
- public EdmMetadataImpl readMetadata(final InputStream input) {
- return new EdmMetadataImpl(client, input);
+ public Edm readMetadata(final InputStream input) {
+ return new EdmClientImpl(client.getDeserializer().toMetadata(input));
}
// @Override
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/v3/MetadataTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/v3/MetadataTest.java b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/v3/MetadataTest.java
index b23cb72..97f855c 100644
--- a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/v3/MetadataTest.java
+++ b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/v3/MetadataTest.java
@@ -29,12 +29,12 @@ import org.apache.olingo.odata4.client.api.http.HttpMethod;
import org.apache.olingo.odata4.client.core.AbstractTest;
import org.apache.olingo.odata4.client.core.ODataV3Client;
import org.apache.olingo.odata4.client.core.edm.xml.v3.ComplexTypeImpl;
-import org.apache.olingo.odata4.client.core.edm.v3.EdmMetadataImpl;
import org.apache.olingo.odata4.client.core.edm.v3.EdmTypeImpl;
import org.apache.olingo.odata4.client.core.edm.xml.v3.EntityContainerImpl;
import org.apache.olingo.odata4.client.core.edm.xml.v3.EntityTypeImpl;
import org.apache.olingo.odata4.client.core.edm.xml.v3.FunctionImportImpl;
import org.apache.olingo.odata4.client.core.edm.xml.v3.SchemaImpl;
+import org.apache.olingo.odata4.client.core.edm.xml.v3.XMLMetadataImpl;
import org.junit.Test;
public class MetadataTest extends AbstractTest {
@@ -46,8 +46,8 @@ public class MetadataTest extends AbstractTest {
@Test
public void parse() {
- final EdmMetadataImpl metadata = getClient().getReader().
- readMetadata(getClass().getResourceAsStream("metadata.xml"));
+ final XMLMetadataImpl metadata = getClient().getDeserializer().
+ toMetadata(getClass().getResourceAsStream("metadata.xml"));
assertNotNull(metadata);
final EdmTypeImpl orderCollection = new EdmTypeImpl(metadata,
@@ -98,8 +98,8 @@ public class MetadataTest extends AbstractTest {
@Test
public void multipleSchemas() {
- final EdmMetadataImpl metadata = getClient().getReader().
- readMetadata(getClass().getResourceAsStream("northwind-metadata.xml"));
+ final XMLMetadataImpl metadata = getClient().getDeserializer().
+ toMetadata(getClass().getResourceAsStream("northwind-metadata.xml"));
assertNotNull(metadata);
final SchemaImpl first = metadata.getSchema("NorthwindModel");
@@ -115,8 +115,8 @@ public class MetadataTest extends AbstractTest {
@Test
public void entityType() {
- final EdmMetadataImpl metadata = getClient().getReader().
- readMetadata(getClass().getResourceAsStream("metadata.xml"));
+ final XMLMetadataImpl metadata = getClient().getDeserializer().
+ toMetadata(getClass().getResourceAsStream("metadata.xml"));
assertNotNull(metadata);
final EntityContainerImpl container = metadata.getSchema(0).getEntityContainers().get(0);
@@ -133,8 +133,8 @@ public class MetadataTest extends AbstractTest {
@Test
public void complexType() {
- final EdmMetadataImpl metadata = getClient().getReader().
- readMetadata(getClass().getResourceAsStream("metadata.xml"));
+ final XMLMetadataImpl metadata = getClient().getDeserializer().
+ toMetadata(getClass().getResourceAsStream("metadata.xml"));
assertNotNull(metadata);
final EntityContainerImpl container = metadata.getSchema(0).getEntityContainers().get(0);
@@ -148,8 +148,8 @@ public class MetadataTest extends AbstractTest {
@Test
public void functionImport() {
- final EdmMetadataImpl metadata = getClient().getReader().
- readMetadata(getClass().getResourceAsStream("metadata.xml"));
+ final XMLMetadataImpl metadata = getClient().getDeserializer().
+ toMetadata(getClass().getResourceAsStream("metadata.xml"));
assertNotNull(metadata);
final EntityContainerImpl container = metadata.getSchema(0).getEntityContainers().get(0);
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/v4/MetadataTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/v4/MetadataTest.java b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/v4/MetadataTest.java
index 38709ed..fba34da 100644
--- a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/v4/MetadataTest.java
+++ b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/v4/MetadataTest.java
@@ -19,34 +19,42 @@
package org.apache.olingo.odata4.client.core.v4;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import java.util.List;
-import org.apache.olingo.odata4.client.api.data.EdmSimpleType;
import org.apache.olingo.odata4.client.core.AbstractTest;
import org.apache.olingo.odata4.client.core.ODataV4Client;
-import org.apache.olingo.odata4.client.core.edm.xml.v4.FunctionImportImpl;
-import org.apache.olingo.odata4.client.core.edm.xml.v4.ActionImpl;
+import org.apache.olingo.odata4.client.core.edm.v4.EdmTypeImpl;
+import org.apache.olingo.odata4.client.core.edm.xml.v4.XMLMetadataImpl;
import org.apache.olingo.odata4.client.core.edm.xml.v4.AnnotationImpl;
import org.apache.olingo.odata4.client.core.edm.xml.v4.AnnotationsImpl;
import org.apache.olingo.odata4.client.core.edm.xml.v4.ComplexTypeImpl;
-import org.apache.olingo.odata4.client.core.edm.v4.EdmMetadataImpl;
-import org.apache.olingo.odata4.client.core.edm.v4.EdmTypeImpl;
import org.apache.olingo.odata4.client.core.edm.xml.v4.EntityContainerImpl;
-import org.apache.olingo.odata4.client.core.edm.xml.v4.EntitySetImpl;
import org.apache.olingo.odata4.client.core.edm.xml.v4.EntityTypeImpl;
-import org.apache.olingo.odata4.client.core.edm.xml.v4.EnumTypeImpl;
import org.apache.olingo.odata4.client.core.edm.xml.v4.FunctionImpl;
+import org.apache.olingo.odata4.client.core.edm.xml.v4.FunctionImportImpl;
import org.apache.olingo.odata4.client.core.edm.xml.v4.SchemaImpl;
import org.apache.olingo.odata4.client.core.edm.xml.v4.SingletonImpl;
-import org.apache.olingo.odata4.client.core.edm.v4.annotation.Apply;
-import org.apache.olingo.odata4.client.core.edm.v4.annotation.Collection;
-import org.apache.olingo.odata4.client.core.edm.v4.annotation.ConstExprConstructImpl;
-import org.apache.olingo.odata4.client.core.edm.v4.annotation.Path;
+import org.apache.olingo.odata4.client.core.edm.xml.v4.annotation.Apply;
+import org.apache.olingo.odata4.client.core.edm.xml.v4.annotation.Collection;
+import org.apache.olingo.odata4.client.core.edm.xml.v4.annotation.ConstExprConstructImpl;
+import org.apache.olingo.odata4.client.core.edm.xml.v4.annotation.Path;
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmAction;
+import org.apache.olingo.odata4.commons.api.edm.EdmComplexType;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+import org.apache.olingo.odata4.commons.api.edm.EdmEnumType;
+import org.apache.olingo.odata4.commons.api.edm.EdmFunction;
+import org.apache.olingo.odata4.commons.api.edm.EdmFunctionImport;
+import org.apache.olingo.odata4.commons.api.edm.EdmFunctionImportInfo;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.commons.api.edm.constants.EdmTypeKind;
import org.apache.olingo.odata4.commons.api.edm.constants.StoreGeneratedPattern;
+import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
public class MetadataTest extends AbstractTest {
@@ -58,73 +66,70 @@ public class MetadataTest extends AbstractTest {
@Test
public void parse() {
- final EdmMetadataImpl metadata = getClient().getReader().
+ final Edm edm = getClient().getReader().
readMetadata(getClass().getResourceAsStream("metadata.xml"));
- assertNotNull(metadata);
+ assertNotNull(edm);
// 1. Enum
- final EnumTypeImpl responseEnumType = metadata.getSchema(0).getEnumType("ResponseType");
+ final EdmEnumType responseEnumType = edm.getEnumType(
+ new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "ResponseType"));
assertNotNull(responseEnumType);
- assertEquals(6, responseEnumType.getMembers().size());
- assertEquals(3, responseEnumType.getMember("Accepted").getValue().intValue());
- assertEquals("Accepted", responseEnumType.getMember(3).getName());
-
- final EdmTypeImpl responseType = new EdmTypeImpl(metadata,
- "Microsoft.Exchange.Services.OData.Model.ResponseType");
- assertNotNull(responseType);
- assertFalse(responseType.isCollection());
- assertFalse(responseType.isSimpleType());
- assertTrue(responseType.isEnumType());
- assertFalse(responseType.isComplexType());
- assertFalse(responseType.isEntityType());
+ assertEquals(6, responseEnumType.getMemberNames().size());
+ assertEquals("3", responseEnumType.getMember("Accepted").getValue());
+ assertEquals(EdmTypeKind.ENUM, responseEnumType.getKind());
// 2. Complex
- final ComplexTypeImpl responseStatus = metadata.getSchema(0).getComplexType("ResponseStatus");
+ final EdmComplexType responseStatus = edm.getComplexType(
+ new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "ResponseStatus"));
assertNotNull(responseStatus);
- assertTrue(responseStatus.getNavigationProperties().isEmpty());
- assertEquals(EdmSimpleType.DateTimeOffset,
- EdmSimpleType.fromValue(responseStatus.getProperty("Time").getType()));
+ assertTrue(responseStatus.getNavigationPropertyNames().isEmpty());
+ assertEquals("Recipient", responseStatus.getBaseType().getName());
+ assertEquals(EdmPrimitiveTypeKind.DateTimeOffset.getEdmPrimitiveTypeInstance(),
+ responseStatus.getProperty("Time").getType());
// 3. Entity
- final EntityTypeImpl user = metadata.getSchema(0).getEntityType("User");
+ final EdmEntityType user = edm.getEntityType(
+ new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "User"));
assertNotNull(user);
- assertEquals("Microsoft.Exchange.Services.OData.Model.Entity", user.getBaseType());
- assertFalse(user.getProperties().isEmpty());
- assertFalse(user.getNavigationProperties().isEmpty());
- assertEquals("Microsoft.Exchange.Services.OData.Model.Folder", user.getNavigationProperty("Inbox").getType());
+ final EdmEntityType entity = edm.getEntityType(
+ new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "Entity"));
+ assertEquals(entity, user.getBaseType());
+ assertFalse(user.getPropertyNames().isEmpty());
+ assertFalse(user.getNavigationPropertyNames().isEmpty());
+ final EdmEntityType folder = edm.getEntityType(
+ new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "Folder"));
+ assertEquals(folder, user.getNavigationProperty("Inbox").getType());
// 4. Action
- final List<ActionImpl> moves = metadata.getSchema(0).getActions("Move");
- assertFalse(moves.isEmpty());
- ActionImpl move = null;
- for (ActionImpl action : moves) {
- if ("Microsoft.Exchange.Services.OData.Model.EmailMessage".equals(action.getReturnType().getType())) {
- move = action;
- }
- }
+ final EdmAction move = edm.getAction(
+ new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "Move"),
+ new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "Folder"),
+ false);
assertNotNull(move);
assertTrue(move.isBound());
- assertEquals("bindingParameter", move.getEntitySetPath());
- assertEquals(2, move.getParameters().size());
- assertEquals("Microsoft.Exchange.Services.OData.Model.EmailMessage", move.getParameters().get(0).getType());
+ assertEquals(2, move.getParameterNames().size());
+ assertEquals(
+ EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance(), move.getParameter("DestinationId").getType());
// 5. EntityContainer
- final EntityContainerImpl container = metadata.getSchema(0).getEntityContainer();
+ final EdmEntityContainer container = edm.getEntityContainer(
+ new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "EntityContainer"));
assertNotNull(container);
- final EntitySetImpl users = container.getEntitySet("Users");
+ final EdmEntitySet users = container.getEntitySet("Users");
assertNotNull(users);
- assertEquals(metadata.getSchema(0).getNamespace() + "." + user.getName(), users.getEntityType());
- assertEquals(user.getNavigationProperties().size(), users.getNavigationPropertyBindings().size());
+ assertEquals(edm.getEntityType(new FullQualifiedName(container.getNamespace(), "User")),
+ users.getEntityType());
+ assertEquals(container.getEntitySet("Folders"), users.getRelatedBindingTarget("Folders"));
}
@Test
public void demo() {
- final EdmMetadataImpl metadata = getClient().getReader().
- readMetadata(getClass().getResourceAsStream("demo-metadata.xml"));
+ final XMLMetadataImpl metadata = getClient().getDeserializer().
+ toMetadata(getClass().getResourceAsStream("demo-metadata.xml"));
assertNotNull(metadata);
assertFalse(metadata.getSchema(0).getAnnotationsList().isEmpty());
- AnnotationsImpl annots = metadata.getSchema(0).getAnnotationsList("ODataDemo.DemoService/Suppliers");
+ final AnnotationsImpl annots = metadata.getSchema(0).getAnnotationsList("ODataDemo.DemoService/Suppliers");
assertNotNull(annots);
assertFalse(annots.getAnnotations().isEmpty());
assertEquals(ConstExprConstructImpl.Type.String,
@@ -135,8 +140,8 @@ public class MetadataTest extends AbstractTest {
@Test
public void multipleSchemas() {
- final EdmMetadataImpl metadata = getClient().getReader().
- readMetadata(getClass().getResourceAsStream("northwind-metadata.xml"));
+ final XMLMetadataImpl metadata = getClient().getDeserializer().
+ toMetadata(getClass().getResourceAsStream("northwind-metadata.xml"));
assertNotNull(metadata);
final SchemaImpl first = metadata.getSchema("NorthwindModel");
@@ -159,8 +164,8 @@ public class MetadataTest extends AbstractTest {
*/
@Test
public void fromdoc1() {
- final EdmMetadataImpl metadata = getClient().getReader().
- readMetadata(getClass().getResourceAsStream("fromdoc1-metadata.xml"));
+ final XMLMetadataImpl metadata = getClient().getDeserializer().
+ toMetadata(getClass().getResourceAsStream("fromdoc1-metadata.xml"));
assertNotNull(metadata);
assertFalse(metadata.getReferences().isEmpty());
@@ -169,7 +174,6 @@ public class MetadataTest extends AbstractTest {
final EntityTypeImpl product = metadata.getSchema(0).getEntityType("Product");
assertTrue(product.isHasStream());
assertEquals("UoM.ISOCurrency", product.getProperty("Price").getAnnotation().getTerm());
- //assertEquals("Currency", product.getProperty("Price").getAnnotation().));
assertEquals("Products", product.getNavigationProperty("Supplier").getPartner());
final EntityTypeImpl category = metadata.getSchema(0).getEntityType("Category");
@@ -198,6 +202,31 @@ public class MetadataTest extends AbstractTest {
assertNotNull(functionImport);
assertEquals(metadata.getSchema(0).getNamespace() + "." + productsByRating.getName(),
functionImport.getFunction());
+
+ // Now let's go high-level
+ final Edm edm = getClient().getReader().
+ readMetadata(getClass().getResourceAsStream("fromdoc1-metadata.xml"));
+ assertNotNull(edm);
+
+ final EdmFunctionImportInfo fiInfo = edm.getServiceMetadata().getFunctionImportInfos().get(0);
+ final EdmEntityContainer demoService = edm.getEntityContainer(
+ new FullQualifiedName(metadata.getSchema(0).getNamespace(), fiInfo.getEntityContainerName()));
+ assertNotNull(demoService);
+ final EdmFunctionImport fi = demoService.getFunctionImport(fiInfo.getFunctionImportName());
+ assertNotNull(fi);
+ assertEquals(demoService.getEntitySet("Products"), fi.getReturnedEntitySet());
+
+ final EdmFunction function = edm.getFunction(
+ new FullQualifiedName(metadata.getSchema(0).getNamespace(), "ProductsByRating"),
+ null, Boolean.FALSE, null);
+ assertNotNull(function);
+ assertEquals(function.getName(), fi.getFunction(null).getName());
+ assertEquals(function.getNamespace(), fi.getFunction(null).getNamespace());
+ assertEquals(function.getParameterNames(), fi.getFunction(null).getParameterNames());
+ assertEquals(function.getReturnType().getType().getName(),
+ fi.getFunction(null).getReturnType().getType().getName());
+ assertEquals(function.getReturnType().getType().getNamespace(),
+ fi.getFunction(null).getReturnType().getType().getNamespace());
}
/**
@@ -205,8 +234,8 @@ public class MetadataTest extends AbstractTest {
*/
@Test
public void fromdoc2() {
- final EdmMetadataImpl metadata = getClient().getReader().
- readMetadata(getClass().getResourceAsStream("fromdoc2-metadata.xml"));
+ final XMLMetadataImpl metadata = getClient().getDeserializer().
+ toMetadata(getClass().getResourceAsStream("fromdoc2-metadata.xml"));
assertNotNull(metadata);
// Check displayName
@@ -253,7 +282,7 @@ public class MetadataTest extends AbstractTest {
*/
@Test
public void fromdoc3() {
- final EdmMetadataImpl metadata = getClient().getReader().
+ final Edm metadata = getClient().getReader().
readMetadata(getClass().getResourceAsStream("fromdoc3-metadata.xml"));
assertNotNull(metadata);
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/test/resources/org/apache/olingo/odata4/client/core/v4/demo-metadata.xml
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/resources/org/apache/olingo/odata4/client/core/v4/demo-metadata.xml b/odata4-lib/odata4-client-core/src/test/resources/org/apache/olingo/odata4/client/core/v4/demo-metadata.xml
index 8296468..9b21e2f 100644
--- a/odata4-lib/odata4-client-core/src/test/resources/org/apache/olingo/odata4/client/core/v4/demo-metadata.xml
+++ b/odata4-lib/odata4-client-core/src/test/resources/org/apache/olingo/odata4/client/core/v4/demo-metadata.xml
@@ -19,4 +19,145 @@
under the License.
-->
-<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"><edmx:DataServices><Schema Namespace="ODataDemo" xmlns="http://docs.oasis-open.org/odata/ns/edm"><EntityType Name="Product"><Key><PropertyRef Name="ID" /></Key><Property Name="ID" Type="Edm.Int32" Nullable="false" /><Property Name="Name" Type="Edm.String" /><Property Name="Description" Type="Edm.String" /><Property Name="ReleaseDate" Type="Edm.DateTimeOffset" Nullable="false" /><Property Name="DiscontinuedDate" Type="Edm.DateTimeOffset" /><Property Name="Rating" Type="Edm.Int16" Nullable="false" /><Property Name="Price" Type="Edm.Double" Nullable="false" /><NavigationProperty Name="Categories" Type="Collection(ODataDemo.Category)" Partner="Products" /><NavigationProperty Name="Supplier" Type="ODataDemo.Supplier" Partner="Products" /><NavigationProperty Name="ProductDetail" Type="ODataDemo.ProductDetail" Partner="Product" /></EntityType><EntityType Name="FeaturedProduct" BaseType="ODataDemo.Product"><Navig
ationProperty Name="Advertisement" Type="ODataDemo.Advertisement" Partner="FeaturedProduct" /></EntityType><EntityType Name="ProductDetail"><Key><PropertyRef Name="ProductID" /></Key><Property Name="ProductID" Type="Edm.Int32" Nullable="false" /><Property Name="Details" Type="Edm.String" /><NavigationProperty Name="Product" Type="ODataDemo.Product" Partner="ProductDetail" /></EntityType><EntityType Name="Category" OpenType="true"><Key><PropertyRef Name="ID" /></Key><Property Name="ID" Type="Edm.Int32" Nullable="false" /><Property Name="Name" Type="Edm.String" /><NavigationProperty Name="Products" Type="Collection(ODataDemo.Product)" Partner="Categories" /></EntityType><EntityType Name="Supplier"><Key><PropertyRef Name="ID" /></Key><Property Name="ID" Type="Edm.Int32" Nullable="false" /><Property Name="Name" Type="Edm.String" /><Property Name="Address" Type="ODataDemo.Address" /><Property Name="Location" Type="Edm.GeographyPoint" SRID="Variable" /><Property Name="Concurrency" Type="E
dm.Int32" ConcurrencyMode="Fixed" Nullable="false" /><NavigationProperty Name="Products" Type="Collection(ODataDemo.Product)" Partner="Supplier" /></EntityType><ComplexType Name="Address"><Property Name="Street" Type="Edm.String" /><Property Name="City" Type="Edm.String" /><Property Name="State" Type="Edm.String" /><Property Name="ZipCode" Type="Edm.String" /><Property Name="Country" Type="Edm.String" /></ComplexType><EntityType Name="Person"><Key><PropertyRef Name="ID" /></Key><Property Name="ID" Type="Edm.Int32" Nullable="false" /><Property Name="Name" Type="Edm.String" /><NavigationProperty Name="PersonDetail" Type="ODataDemo.PersonDetail" Partner="Person" /></EntityType><EntityType Name="Customer" BaseType="ODataDemo.Person"><Property Name="TotalExpense" Type="Edm.Decimal" Nullable="false" /></EntityType><EntityType Name="Employee" BaseType="ODataDemo.Person"><Property Name="EmployeeID" Type="Edm.Int64" Nullable="false" /><Property Name="HireDate" Type="Edm.DateTimeOffset" Nulla
ble="false" /><Property Name="Salary" Type="Edm.Single" Nullable="false" /></EntityType><EntityType Name="PersonDetail"><Key><PropertyRef Name="PersonID" /></Key><Property Name="PersonID" Type="Edm.Int32" Nullable="false" /><Property Name="Age" Type="Edm.Byte" Nullable="false" /><Property Name="Gender" Type="Edm.Boolean" Nullable="false" /><Property Name="Phone" Type="Edm.String" /><Property Name="Address" Type="ODataDemo.Address" /><Property Name="Photo" Type="Edm.Stream" Nullable="false" /><NavigationProperty Name="Person" Type="ODataDemo.Person" Partner="PersonDetail" /></EntityType><EntityType Name="Advertisement" HasStream="true"><Key><PropertyRef Name="ID" /></Key><Property Name="ID" Type="Edm.Guid" Nullable="false" /><Property Name="Name" Type="Edm.String" /><Property Name="AirDate" Type="Edm.DateTimeOffset" Nullable="false" /><NavigationProperty Name="FeaturedProduct" Type="ODataDemo.FeaturedProduct" Partner="Advertisement" /></EntityType><EntityContainer Name="DemoService">
<EntitySet Name="Products" EntityType="ODataDemo.Product"><NavigationPropertyBinding Path="ODataDemo.FeaturedProduct/Advertisement" Target="Advertisements" /><NavigationPropertyBinding Path="Categories" Target="Categories" /><NavigationPropertyBinding Path="Supplier" Target="Suppliers" /><NavigationPropertyBinding Path="ProductDetail" Target="ProductDetails" /></EntitySet><EntitySet Name="ProductDetails" EntityType="ODataDemo.ProductDetail"><NavigationPropertyBinding Path="Product" Target="Products" /></EntitySet><EntitySet Name="Categories" EntityType="ODataDemo.Category"><NavigationPropertyBinding Path="Products" Target="Products" /></EntitySet><EntitySet Name="Suppliers" EntityType="ODataDemo.Supplier"><NavigationPropertyBinding Path="Products" Target="Products" /></EntitySet><EntitySet Name="Persons" EntityType="ODataDemo.Person"><NavigationPropertyBinding Path="PersonDetail" Target="PersonDetails" /></EntitySet><EntitySet Name="PersonDetails" EntityType="ODataDemo.PersonDetail"
><NavigationPropertyBinding Path="Person" Target="Persons" /></EntitySet><EntitySet Name="Advertisements" EntityType="ODataDemo.Advertisement"><NavigationPropertyBinding Path="FeaturedProduct" Target="Products" /></EntitySet></EntityContainer><Annotations Target="ODataDemo.DemoService"><Annotation Term="Org.OData.Display.V1.Description" String="This is a sample OData service with vocabularies" /></Annotations><Annotations Target="ODataDemo.Product"><Annotation Term="Org.OData.Display.V1.Description" String="All Products available in the online store" /></Annotations><Annotations Target="ODataDemo.Product/Name"><Annotation Term="Org.OData.Display.V1.DisplayName" String="Product Name" /></Annotations><Annotations Target="ODataDemo.DemoService/Suppliers"><Annotation Term="Org.OData.Publication.V1.PublisherName" String="Microsoft Corp." /><Annotation Term="Org.OData.Publication.V1.PublisherId" String="MSFT" /><Annotation Term="Org.OData.Publication.V1.Keywords" String="Inventory, Suppli
er, Advertisers, Sales, Finance" /><Annotation Term="Org.OData.Publication.V1.AttributionUrl" String="http://www.odata.org/" /><Annotation Term="Org.OData.Publication.V1.AttributionDescription" String="All rights reserved" /><Annotation Term="Org.OData.Publication.V1.DocumentationUrl " String="http://www.odata.org/" /><Annotation Term="Org.OData.Publication.V1.TermsOfUseUrl" String="All rights reserved" /><Annotation Term="Org.OData.Publication.V1.PrivacyPolicyUrl" String="http://www.odata.org/" /><Annotation Term="Org.OData.Publication.V1.LastModified" String="4/2/2013" /><Annotation Term="Org.OData.Publication.V1.ImageUrl " String="http://www.odata.org/" /></Annotations></Schema></edmx:DataServices></edmx:Edmx>
\ No newline at end of file
+<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
+ <edmx:DataServices>
+ <Schema Namespace="ODataDemo" xmlns="http://docs.oasis-open.org/odata/ns/edm">
+ <EntityType Name="Product">
+ <Key>
+ <PropertyRef Name="ID" />
+ </Key>
+ <Property Name="ID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="Name" Type="Edm.String" />
+ <Property Name="Description" Type="Edm.String" />
+ <Property Name="ReleaseDate" Type="Edm.DateTimeOffset" Nullable="false" />
+ <Property Name="DiscontinuedDate" Type="Edm.DateTimeOffset" />
+ <Property Name="Rating" Type="Edm.Int16" Nullable="false" />
+ <Property Name="Price" Type="Edm.Double" Nullable="false" />
+ <NavigationProperty Name="Categories" Type="Collection(ODataDemo.Category)" Partner="Products" />
+ <NavigationProperty Name="Supplier" Type="ODataDemo.Supplier" Partner="Products" />
+ <NavigationProperty Name="ProductDetail" Type="ODataDemo.ProductDetail" Partner="Product" />
+ </EntityType>
+ <EntityType Name="FeaturedProduct" BaseType="ODataDemo.Product">
+ <NavigationProperty Name="Advertisement" Type="ODataDemo.Advertisement" Partner="FeaturedProduct" />
+ </EntityType>
+ <EntityType Name="ProductDetail">
+ <Key>
+ <PropertyRef Name="ProductID" />
+ </Key>
+ <Property Name="ProductID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="Details" Type="Edm.String" />
+ <NavigationProperty Name="Product" Type="ODataDemo.Product" Partner="ProductDetail" />
+ </EntityType>
+ <EntityType Name="Category" OpenType="true">
+ <Key>
+ <PropertyRef Name="ID" />
+ </Key>
+ <Property Name="ID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="Name" Type="Edm.String" />
+ <NavigationProperty Name="Products" Type="Collection(ODataDemo.Product)" Partner="Categories" />
+ </EntityType>
+ <EntityType Name="Supplier">
+ <Key>
+ <PropertyRef Name="ID" />
+ </Key>
+ <Property Name="ID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="Name" Type="Edm.String" />
+ <Property Name="Address" Type="ODataDemo.Address" />
+ <Property Name="Location" Type="Edm.GeographyPoint" SRID="Variable" />
+ <Property Name="Concurrency" Type="Edm.Int32" ConcurrencyMode="Fixed" Nullable="false" />
+ <NavigationProperty Name="Products" Type="Collection(ODataDemo.Product)" Partner="Supplier" />
+ </EntityType>
+ <ComplexType Name="Address">
+ <Property Name="Street" Type="Edm.String" />
+ <Property Name="City" Type="Edm.String" />
+ <Property Name="State" Type="Edm.String" />
+ <Property Name="ZipCode" Type="Edm.String" />
+ <Property Name="Country" Type="Edm.String" />
+ </ComplexType>
+ <EntityType Name="Person">
+ <Key>
+ <PropertyRef Name="ID" />
+ </Key>
+ <Property Name="ID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="Name" Type="Edm.String" />
+ <NavigationProperty Name="PersonDetail" Type="ODataDemo.PersonDetail" Partner="Person" />
+ </EntityType>
+ <EntityType Name="Customer" BaseType="ODataDemo.Person">
+ <Property Name="TotalExpense" Type="Edm.Decimal" Nullable="false" />
+ </EntityType>
+ <EntityType Name="Employee" BaseType="ODataDemo.Person">
+ <Property Name="EmployeeID" Type="Edm.Int64" Nullable="false" />
+ <Property Name="HireDate" Type="Edm.DateTimeOffset" Nullable="false" />
+ <Property Name="Salary" Type="Edm.Single" Nullable="false" />
+ </EntityType>
+ <EntityType Name="PersonDetail">
+ <Key>
+ <PropertyRef Name="PersonID" />
+ </Key>
+ <Property Name="PersonID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="Age" Type="Edm.Byte" Nullable="false" />
+ <Property Name="Gender" Type="Edm.Boolean" Nullable="false" />
+ <Property Name="Phone" Type="Edm.String" />
+ <Property Name="Address" Type="ODataDemo.Address" />
+ <Property Name="Photo" Type="Edm.Stream" Nullable="false" />
+ <NavigationProperty Name="Person" Type="ODataDemo.Person" Partner="PersonDetail" />
+ </EntityType>
+ <EntityType Name="Advertisement" HasStream="true">
+ <Key>
+ <PropertyRef Name="ID" />
+ </Key>
+ <Property Name="ID" Type="Edm.Guid" Nullable="false" />
+ <Property Name="Name" Type="Edm.String" />
+ <Property Name="AirDate" Type="Edm.DateTimeOffset" Nullable="false" />
+ <NavigationProperty Name="FeaturedProduct" Type="ODataDemo.FeaturedProduct" Partner="Advertisement" />
+ </EntityType>
+ <EntityContainer Name="DemoService">
+ <EntitySet Name="Products" EntityType="ODataDemo.Product">
+ <NavigationPropertyBinding Path="ODataDemo.FeaturedProduct/Advertisement" Target="Advertisements" />
+ <NavigationPropertyBinding Path="Categories" Target="Categories" />
+ <NavigationPropertyBinding Path="Supplier" Target="Suppliers" />
+ <NavigationPropertyBinding Path="ProductDetail" Target="ProductDetails" />
+ </EntitySet>
+ <EntitySet Name="ProductDetails" EntityType="ODataDemo.ProductDetail">
+ <NavigationPropertyBinding Path="Product" Target="Products" />
+ </EntitySet>
+ <EntitySet Name="Categories" EntityType="ODataDemo.Category">
+ <NavigationPropertyBinding Path="Products" Target="Products" />
+ </EntitySet>
+ <EntitySet Name="Suppliers" EntityType="ODataDemo.Supplier">
+ <NavigationPropertyBinding Path="Products" Target="Products" />
+ </EntitySet>
+ <EntitySet Name="Persons" EntityType="ODataDemo.Person">
+ <NavigationPropertyBinding Path="PersonDetail" Target="PersonDetails" />
+ </EntitySet>
+ <EntitySet Name="PersonDetails" EntityType="ODataDemo.PersonDetail">
+ <NavigationPropertyBinding Path="Person" Target="Persons" />
+ </EntitySet>
+ <EntitySet Name="Advertisements" EntityType="ODataDemo.Advertisement">
+ <NavigationPropertyBinding Path="FeaturedProduct" Target="Products" />
+ </EntitySet>
+ </EntityContainer>
+ <Annotations Target="ODataDemo.DemoService">
+ <Annotation Term="Org.OData.Display.V1.Description" String="This is a sample OData service with vocabularies" />
+ </Annotations>
+ <Annotations Target="ODataDemo.Product">
+ <Annotation Term="Org.OData.Display.V1.Description" String="All Products available in the online store" />
+ </Annotations>
+ <Annotations Target="ODataDemo.Product/Name">
+ <Annotation Term="Org.OData.Display.V1.DisplayName" String="Product Name" />
+ </Annotations>
+ <Annotations Target="ODataDemo.DemoService/Suppliers">
+ <Annotation Term="Org.OData.Publication.V1.PublisherName" String="Microsoft Corp." />
+ <Annotation Term="Org.OData.Publication.V1.PublisherId" String="MSFT" />
+ <Annotation Term="Org.OData.Publication.V1.Keywords" String="Inventory, Supplier, Advertisers, Sales, Finance" />
+ <Annotation Term="Org.OData.Publication.V1.AttributionUrl" String="http://www.odata.org/" />
+ <Annotation Term="Org.OData.Publication.V1.AttributionDescription" String="All rights reserved" />
+ <Annotation Term="Org.OData.Publication.V1.DocumentationUrl " String="http://www.odata.org/" />
+ <Annotation Term="Org.OData.Publication.V1.TermsOfUseUrl" String="All rights reserved" />
+ <Annotation Term="Org.OData.Publication.V1.PrivacyPolicyUrl" String="http://www.odata.org/" />
+ <Annotation Term="Org.OData.Publication.V1.LastModified" String="4/2/2013" />
+ <Annotation Term="Org.OData.Publication.V1.ImageUrl " String="http://www.odata.org/" />
+ </Annotations>
+ </Schema>
+ </edmx:DataServices>
+</edmx:Edmx>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/test/resources/org/apache/olingo/odata4/client/core/v4/fromdoc1-metadata.xml
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/resources/org/apache/olingo/odata4/client/core/v4/fromdoc1-metadata.xml b/odata4-lib/odata4-client-core/src/test/resources/org/apache/olingo/odata4/client/core/v4/fromdoc1-metadata.xml
index d2f99e3..ed46844 100644
--- a/odata4-lib/odata4-client-core/src/test/resources/org/apache/olingo/odata4/client/core/v4/fromdoc1-metadata.xml
+++ b/odata4-lib/odata4-client-core/src/test/resources/org/apache/olingo/odata4/client/core/v4/fromdoc1-metadata.xml
@@ -28,6 +28,16 @@
</edmx:Reference>
<edmx:DataServices>
<Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="ODataDemo">
+ <TypeDefinition Name="Length" UnderlyingType="Edm.Int32">
+ <Annotation Term="Org.OData.Measures.V1.Unit" String="Centimeters"/>
+ </TypeDefinition>
+ <TypeDefinition Name="Weight" UnderlyingType="Edm.Int32">
+ <Annotation Term="Org.OData.Measures.V1.Unit" String="Kilograms"/>
+ </TypeDefinition>
+ <ComplexType Name="Size">
+ <Property Name="Height" Type="Self.Length" />
+ <Property Name="Weight" Type="Self.Weight" />
+ </ComplexType>
<EntityType Name="Product" HasStream="true">
<Key>
<PropertyRef Name="ID"/>