Repository: olingo-odata4 Updated Branches: refs/heads/master 1b6259b97 -> 26f7d2a6b
[OLINGO-575] removal of some test V3 code Signed-off-by: Christian Amend <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/c7aa842f Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/c7aa842f Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/c7aa842f Branch: refs/heads/master Commit: c7aa842fb40856e068dc2741fe5c33f1abb7b6ec Parents: 1b6259b Author: Klaus Straubinger <[email protected]> Authored: Fri Jan 15 16:06:45 2016 +0100 Committer: Christian Amend <[email protected]> Committed: Mon Jan 18 13:35:48 2016 +0100 ---------------------------------------------------------------------- .../org/apache/olingo/fit/AbstractServices.java | 46 -------- .../apache/olingo/fit/metadata/Association.java | 70 ------------ .../olingo/fit/metadata/AssociationSet.java | 74 ------------- .../apache/olingo/fit/metadata/Container.java | 13 --- .../apache/olingo/fit/metadata/Metadata.java | 110 +++---------------- .../olingo/fit/metadata/NavigationProperty.java | 27 ----- .../org/apache/olingo/fit/metadata/Schema.java | 14 --- .../org/apache/olingo/fit/methods/MERGE.java | 33 ------ .../org/apache/olingo/fit/utils/Constants.java | 60 +++------- .../olingo/fit/base/EntityUpdateTestITCase.java | 2 +- .../edm/annotation/EdmConstantExpression.java | 8 +- 11 files changed, 35 insertions(+), 422 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c7aa842f/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java index fc886ff..c287e5b 100644 --- a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java +++ b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java @@ -88,7 +88,6 @@ import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory; import org.apache.olingo.fit.metadata.EntityType; import org.apache.olingo.fit.metadata.Metadata; import org.apache.olingo.fit.metadata.NavigationProperty; -import org.apache.olingo.fit.methods.MERGE; import org.apache.olingo.fit.methods.PATCH; import org.apache.olingo.fit.serializer.FITAtomDeserializer; import org.apache.olingo.fit.utils.AbstractUtilities; @@ -414,23 +413,6 @@ public abstract class AbstractServices { addSingleBatchResponse(xml.createFaultResponse(Accept.XML.toString(), e), contentId, bos); } - @MERGE - @Path("/{entitySetName}({entityId})") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON }) - public Response mergeEntity( - @Context final UriInfo uriInfo, - @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept, - @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType, - @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer, - @HeaderParam("If-Match") @DefaultValue(StringUtils.EMPTY) final String ifMatch, - @PathParam("entitySetName") final String entitySetName, - @PathParam("entityId") final String entityId, - final String changes) { - - return patchEntity(uriInfo, accept, contentType, prefer, ifMatch, entitySetName, entityId, changes); - } - @PATCH @Path("/{entitySetName}({entityId})") @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON }) @@ -1510,34 +1492,6 @@ public abstract class AbstractServices { * @param changes * @return response */ - @MERGE - @Path("/{entitySetName}({entityId})/{path:.*}") - public Response mergeProperty( - @Context final UriInfo uriInfo, - @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept, - @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType, - @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer, - @PathParam("entitySetName") final String entitySetName, - @PathParam("entityId") final String entityId, - @PathParam("path") final String path, - @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format, - final String changes) { - - return replaceProperty(uriInfo.getRequestUri().toASCIIString(), - accept, contentType, prefer, entitySetName, entityId, path, format, changes, false); - } - - /** - * Replace property. - * - * @param accept - * @param entitySetName - * @param entityId - * @param path - * @param format - * @param changes - * @return response - */ @PATCH @Path("/{entitySetName}({entityId})/{path:.*}") public Response patchProperty( http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c7aa842f/fit/src/main/java/org/apache/olingo/fit/metadata/Association.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/metadata/Association.java b/fit/src/main/java/org/apache/olingo/fit/metadata/Association.java deleted file mode 100644 index aa0ce6d..0000000 --- a/fit/src/main/java/org/apache/olingo/fit/metadata/Association.java +++ /dev/null @@ -1,70 +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.fit.metadata; - -import java.util.LinkedHashMap; -import java.util.Map; - -public class Association extends AbstractMetadataElement { - - private final String name; - - private Map<String, Role> roles; - - public Association(final String name) { - this.name = name; - roles = new LinkedHashMap<String, Role>(); - } - - public String getName() { - return name; - } - - public Association addRole(final String name, final String type, final String multiplicity) { - roles.put(name, new Role(name, type, multiplicity)); - return this; - } - - public Role getRole(final String name) { - return roles.get(name); - } - - public static class Role { - - final String name; - - final String type; - - final String multiplicity; - - public Role(final String name, final String type, final String multiplicity) { - this.name = name; - this.type = type; - this.multiplicity = multiplicity; - } - - public String getType() { - return type; - } - - public String getMultiplicity() { - return multiplicity; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c7aa842f/fit/src/main/java/org/apache/olingo/fit/metadata/AssociationSet.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/metadata/AssociationSet.java b/fit/src/main/java/org/apache/olingo/fit/metadata/AssociationSet.java deleted file mode 100644 index 9bda9db..0000000 --- a/fit/src/main/java/org/apache/olingo/fit/metadata/AssociationSet.java +++ /dev/null @@ -1,74 +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.fit.metadata; - -import java.util.LinkedHashMap; -import java.util.Map; - -public class AssociationSet extends AbstractMetadataElement { - - private final String name; - - private final String association; - - private Map<String, Role> roles; - - public AssociationSet(final String name, final String association) { - this.name = name; - this.association = association; - roles = new LinkedHashMap<String, Role>(); - } - - public String getName() { - return name; - } - - public String getAssociation() { - return association; - } - - public AssociationSet addRole(final String name, final String entitySet) { - roles.put(name, new Role(name, entitySet)); - return this; - } - - public Role getRole(final String name) { - return roles.get(name); - } - - public static class Role { - - final String name; - - final String entitySet; - - public Role(final String name, final String entitySet) { - this.name = name; - this.entitySet = entitySet; - } - - public String getName() { - return name; - } - - public String getEntitySet() { - return entitySet; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c7aa842f/fit/src/main/java/org/apache/olingo/fit/metadata/Container.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/metadata/Container.java b/fit/src/main/java/org/apache/olingo/fit/metadata/Container.java index aab6143..e8eb3bf 100644 --- a/fit/src/main/java/org/apache/olingo/fit/metadata/Container.java +++ b/fit/src/main/java/org/apache/olingo/fit/metadata/Container.java @@ -26,25 +26,17 @@ import java.util.Map; public class Container extends AbstractMetadataElement { private final String name; - private final Map<String, EntitySet> entitySets; - private final Map<String, AssociationSet> associationSets; - public Container(final String name) { this.name = name; entitySets = new HashMap<String, EntitySet>(); - associationSets = new HashMap<String, AssociationSet>(); } public String getName() { return name; } - public AssociationSet getAssociationSet(final String association) { - return associationSets.get(association); - } - public Collection<EntitySet> getEntitySets() { return entitySets.values(); } @@ -68,9 +60,4 @@ public class Container extends AbstractMetadataElement { entitySets.put(name, entitySet); return this; } - - public Container addAssociationSet(final String name, final AssociationSet associationSet) { - associationSets.put(name, associationSet); - return this; - } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c7aa842f/fit/src/main/java/org/apache/olingo/fit/metadata/Metadata.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/metadata/Metadata.java b/fit/src/main/java/org/apache/olingo/fit/metadata/Metadata.java index 6482143..0d88b1d 100644 --- a/fit/src/main/java/org/apache/olingo/fit/metadata/Metadata.java +++ b/fit/src/main/java/org/apache/olingo/fit/metadata/Metadata.java @@ -82,37 +82,20 @@ public class Metadata extends AbstractMetadataElement { for (Map.Entry<String, Schema> schemaEntry : schemas.entrySet()) { for (EntityType entityType : schemaEntry.getValue().getEntityTypes()) { for (NavigationProperty property : entityType.getNavigationProperties()) { - if (StringUtils.isNotBlank(property.getReleationship())) { - // V3 ... - final Association association = schemaEntry.getValue().getAssociation( - property.getReleationship().replaceAll(schemaEntry.getKey() + "\\.", "")); - final Association.Role role = association.getRole(property.getToRole()); - property.setFeed(role.getMultiplicity().equals("*")); - property.setType(property.isEntitySet() ? "Collection(" + role.getType() + ")" : role.getType()); - - // let me assume that it will be just a single container - final AssociationSet associationSet = schemaEntry.getValue().getContainers().iterator().next(). - getAssociationSet(property.getReleationship()); - - final AssociationSet.Role associationSetRole = associationSet.getRole(property.getToRole()); - property.setTarget(associationSetRole.getEntitySet()); - } else { - // V4 ... - property.setFeed(property.getType().startsWith("Collection(")); - - final Collection<EntitySet> entitySets = schemaEntry.getValue().getContainers().iterator().next(). - getEntitySets(schemaEntry.getKey(), entityType.getName()); - - final Iterator<EntitySet> iter = entitySets.iterator(); - boolean found = false; - - while (!found && iter.hasNext()) { - final EntitySet entitySet = iter.next(); - final String target = entitySet.getTarget(property.getName()); - if (StringUtils.isNotBlank(target)) { - property.setTarget(entitySet.getTarget(property.getName())); - found = true; - } + property.setFeed(property.getType().startsWith("Collection(")); + + final Collection<EntitySet> entitySets = schemaEntry.getValue().getContainers().iterator().next(). + getEntitySets(schemaEntry.getKey(), entityType.getName()); + + final Iterator<EntitySet> iter = entitySets.iterator(); + boolean found = false; + + while (!found && iter.hasNext()) { + final EntitySet entitySet = iter.next(); + final String target = entitySet.getTarget(property.getName()); + if (StringUtils.isNotBlank(target)) { + property.setTarget(entitySet.getTarget(property.getName())); + found = true; } } } @@ -209,10 +192,6 @@ public class Metadata extends AbstractMetadataElement { && event.asStartElement().getName().equals(new QName(DEF_NS, "EntityContainer"))) { final org.apache.olingo.fit.metadata.Container container = getContainer(event.asStartElement(), reader); schema.addContainer(container.getName(), container); - } else if (event.isStartElement() && event.asStartElement().getName().equals(new QName(DEF_NS, "Association"))) { - // just for V3 - final Association association = getAssociation(event.asStartElement(), reader); - schema.addAssociation(association.getName(), association); } else if (event.isEndElement() && event.asEndElement().getName().equals(start.getName())) { completed = true; } @@ -236,11 +215,6 @@ public class Metadata extends AbstractMetadataElement { || event.asStartElement().getName().equals(new QName(DEF_NS, "Singleton")))) { final EntitySet entitySet = getEntitySet(event.asStartElement(), reader); container.addEntitySet(entitySet.getName(), entitySet); - } else if (event.isStartElement() - && event.asStartElement().getName().equals(new QName(DEF_NS, "AssociationSet"))) { - // just for V3 - final AssociationSet associationSet = getAssociationSet(event.asStartElement(), reader); - container.addAssociationSet(associationSet.getAssociation(), associationSet); } else if (event.isEndElement() && event.asEndElement().getName().equals(start.getName())) { completed = true; } @@ -249,52 +223,6 @@ public class Metadata extends AbstractMetadataElement { return container; } - private Association getAssociation( - final StartElement start, final XMLEventReader reader) throws XMLStreamException { - final Association association = new Association(start.getAttributeByName(new QName("Name")).getValue()); - - boolean completed = false; - - while (!completed && reader.hasNext()) { - XMLEvent event = reader.nextEvent(); - - if (event.isStartElement() && event.asStartElement().getName().equals(new QName(DEF_NS, "End"))) { - final String role = event.asStartElement().getAttributeByName(new QName("Role")).getValue(); - final String type = event.asStartElement().getAttributeByName(new QName("Type")).getValue(); - final String multiplicity = - event.asStartElement().getAttributeByName(new QName("Multiplicity")).getValue(); - association.addRole(role, type, multiplicity); - } else if (event.isEndElement() && event.asEndElement().getName().equals(start.getName())) { - completed = true; - } - } - - return association; - } - - private AssociationSet getAssociationSet( - final StartElement start, final XMLEventReader reader) throws XMLStreamException { - final AssociationSet associationSet = new AssociationSet( - start.getAttributeByName(new QName("Name")).getValue(), - start.getAttributeByName(new QName("Association")).getValue()); - - boolean completed = false; - - while (!completed && reader.hasNext()) { - XMLEvent event = reader.nextEvent(); - - if (event.isStartElement() && event.asStartElement().getName().equals(new QName(DEF_NS, "End"))) { - final String role = event.asStartElement().getAttributeByName(new QName("Role")).getValue(); - final String entitySet = event.asStartElement().getAttributeByName(new QName("EntitySet")).getValue(); - associationSet.addRole(role, entitySet); - } else if (event.isEndElement() && event.asEndElement().getName().equals(start.getName())) { - completed = true; - } - } - - return associationSet; - } - private EntityType getEntityType(final StartElement start, final XMLEventReader reader) throws XMLStreamException { final EntityType entityType = new EntityType(start.getAttributeByName(new QName("Name")).getValue()); final Attribute baseType = start.getAttributeByName(new QName("BaseType")); @@ -348,16 +276,6 @@ public class Metadata extends AbstractMetadataElement { property.setType(type.getValue()); } - final Attribute relationship = start.getAttributeByName(new QName("Relationship")); - if (relationship != null) { - property.setReleationship(relationship.getValue()); - } - - final Attribute toRole = start.getAttributeByName(new QName("ToRole")); - if (toRole != null) { - property.setToRole(toRole.getValue()); - } - return property; } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c7aa842f/fit/src/main/java/org/apache/olingo/fit/metadata/NavigationProperty.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/metadata/NavigationProperty.java b/fit/src/main/java/org/apache/olingo/fit/metadata/NavigationProperty.java index 0e27dc1..e0cf627 100644 --- a/fit/src/main/java/org/apache/olingo/fit/metadata/NavigationProperty.java +++ b/fit/src/main/java/org/apache/olingo/fit/metadata/NavigationProperty.java @@ -21,19 +21,8 @@ package org.apache.olingo.fit.metadata; public class NavigationProperty extends AbstractMetadataElement { private final String name; - - // ----------------------- - // just for v3 - // ----------------------- - private String releationship; - - private String toRole; - // ----------------------- - private String type; - private String target; - private boolean entitySet; public NavigationProperty(final String name) { @@ -44,22 +33,6 @@ public class NavigationProperty extends AbstractMetadataElement { return name; } - public String getReleationship() { - return releationship; - } - - public void setReleationship(final String releationship) { - this.releationship = releationship; - } - - public String getToRole() { - return toRole; - } - - public void setToRole(final String toRole) { - this.toRole = toRole; - } - public String getType() { return type; } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c7aa842f/fit/src/main/java/org/apache/olingo/fit/metadata/Schema.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/metadata/Schema.java b/fit/src/main/java/org/apache/olingo/fit/metadata/Schema.java index 9a23f40..368894f 100644 --- a/fit/src/main/java/org/apache/olingo/fit/metadata/Schema.java +++ b/fit/src/main/java/org/apache/olingo/fit/metadata/Schema.java @@ -25,18 +25,13 @@ import java.util.Map; public class Schema extends AbstractMetadataElement { private final String namespace; - private final Map<String, Container> containers; - - private final Map<String, Association> associations; - private final Map<String, EntityType> entityTypes; public Schema(final String namespace) { this.namespace = namespace; entityTypes = new HashMap<String, EntityType>(); containers = new HashMap<String, Container>(); - associations = new HashMap<String, Association>(); } public String getNamespace() { @@ -68,13 +63,4 @@ public class Schema extends AbstractMetadataElement { containers.put(name, container); return this; } - - public Association getAssociation(final String name) { - return associations.get(name); - } - - public Schema addAssociation(final String name, final Association association) { - associations.put(name, association); - return this; - } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c7aa842f/fit/src/main/java/org/apache/olingo/fit/methods/MERGE.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/methods/MERGE.java b/fit/src/main/java/org/apache/olingo/fit/methods/MERGE.java deleted file mode 100644 index 8115826..0000000 --- a/fit/src/main/java/org/apache/olingo/fit/methods/MERGE.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.fit.methods; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import javax.ws.rs.HttpMethod; - -@Target({ ElementType.METHOD }) -@Retention(RetentionPolicy.RUNTIME) -@HttpMethod("MERGE") -public @interface MERGE { - // No additional methods needed for now. -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c7aa842f/fit/src/main/java/org/apache/olingo/fit/utils/Constants.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/Constants.java b/fit/src/main/java/org/apache/olingo/fit/utils/Constants.java index c2eaa7d..d0915a4 100644 --- a/fit/src/main/java/org/apache/olingo/fit/utils/Constants.java +++ b/fit/src/main/java/org/apache/olingo/fit/utils/Constants.java @@ -26,52 +26,35 @@ import java.util.Map; public class Constants { - private final static Map<ConstantKey, String> v4constants = new EnumMap<ConstantKey, String>(ConstantKey.class); - - private final static Map<ConstantKey, String> constants = new EnumMap<ConstantKey, String>(ConstantKey.class); + private static Map<ConstantKey, String> constants = new EnumMap<ConstantKey, String>(ConstantKey.class); /** * CR/LF. */ public static final byte[] CRLF = { 13, 10 }; - public static final Charset ENCODING = Charset.forName("UTF-8"); - public static final CharsetDecoder DECODER = ENCODING.newDecoder(); static { DECODER.onMalformedInput(CodingErrorAction.IGNORE); DECODER.onUnmappableCharacter(CodingErrorAction.IGNORE); - // ----------------------------- - // V4 only - // ----------------------------- - v4constants.put(ConstantKey.JSON_ID_NAME, "@odata.id"); - v4constants.put(ConstantKey.JSON_TYPE_NAME, "@odata.type"); - v4constants.put(ConstantKey.JSON_NAVIGATION_SUFFIX, "@odata.navigationLink"); - v4constants.put(ConstantKey.JSON_EDITLINK_NAME, "@odata.editLink"); - v4constants.put(ConstantKey.DATASERVICES_NS, "http://docs.oasis-open.org/odata/ns/dataservices"); - v4constants.put(ConstantKey.METADATA_NS, "http://docs.oasis-open.org/odata/ns/metadata"); - v4constants.put(ConstantKey.GEORSS_NS, "http://www.georss.org/georss"); - v4constants.put(ConstantKey.GML_NS, "http://www.opengis.net/gml"); - v4constants.put(ConstantKey.EDM_NS, "http://docs.oasis-open.org/odata/ns/edm"); - v4constants.put(ConstantKey.ATOM_LINK_REL, "http://docs.oasis-open.org/odata/ns/related/"); - v4constants.put(ConstantKey.ODATA_SERVICE_VERSION, "OData-Version"); - v4constants.put(ConstantKey.DEFAULT_SERVICE_URL, "http://localhost:9080/stub/StaticService/V40/Static.svc/"); - v4constants.put(ConstantKey.ODATA_METADATA_PREFIX, + constants.put(ConstantKey.JSON_ID_NAME, "@odata.id"); + constants.put(ConstantKey.JSON_TYPE_NAME, "@odata.type"); + constants.put(ConstantKey.JSON_NAVIGATION_SUFFIX, "@odata.navigationLink"); + constants.put(ConstantKey.JSON_EDITLINK_NAME, "@odata.editLink"); + constants.put(ConstantKey.DATASERVICES_NS, "http://docs.oasis-open.org/odata/ns/dataservices"); + constants.put(ConstantKey.METADATA_NS, "http://docs.oasis-open.org/odata/ns/metadata"); + constants.put(ConstantKey.GEORSS_NS, "http://www.georss.org/georss"); + constants.put(ConstantKey.GML_NS, "http://www.opengis.net/gml"); + constants.put(ConstantKey.EDM_NS, "http://docs.oasis-open.org/odata/ns/edm"); + constants.put(ConstantKey.ATOM_LINK_REL, "http://docs.oasis-open.org/odata/ns/related/"); + constants.put(ConstantKey.ODATA_SERVICE_VERSION, "OData-Version"); + constants.put(ConstantKey.DEFAULT_SERVICE_URL, "http://localhost:9080/stub/StaticService/V40/Static.svc/"); + constants.put(ConstantKey.ODATA_METADATA_PREFIX, "http://localhost:9080/stub/StaticService/V40/Static.svc/$metadata#"); - v4constants.put(ConstantKey.ODATA_METADATA_ENTITY_SUFFIX, "/$entity"); - // ----------------------------- - - // ----------------------------- - // V3 and defaults - // ----------------------------- - constants.put(ConstantKey.ODATA_SERVICE_VERSION, "DataServiceVersion"); - constants.put(ConstantKey.DEFAULT_SERVICE_URL, "http://localhost:9080/stub/StaticService/V30/Static.svc/"); + constants.put(ConstantKey.ODATA_METADATA_ENTITY_SUFFIX, "/$entity"); constants.put(ConstantKey.ODATA_COUNT_NAME, "odata.count"); - constants.put(ConstantKey.ODATA_METADATA_PREFIX, - "http://localhost:9080/stub/StaticService/V30/Static.svc/$metadata#"); - constants.put(ConstantKey.ODATA_METADATA_ENTITY_SUFFIX, "/@Element"); constants.put(ConstantKey.ATOM_DEF_TYPE, "Edm.String"); constants.put(ConstantKey.ATOM_PROPERTY_PREFIX, "d:"); constants.put(ConstantKey.ATOM_METADATA_PREFIX, "m:"); @@ -79,7 +62,6 @@ public class Constants { constants.put(ConstantKey.ATOM_DATASERVICE_NS, "xmlns:d"); constants.put(ConstantKey.ATOM_LINK_ENTRY, "application/atom+xml;type=entry"); constants.put(ConstantKey.ATOM_LINK_FEED, "application/atom+xml;type=feed"); - constants.put(ConstantKey.ATOM_LINK_REL, "http://schemas.microsoft.com/ado/2007/08/dataservices/related/"); constants.put(ConstantKey.TYPE, "m:type"); constants.put(ConstantKey.INLINE_LOCAL, "inline"); constants.put(ConstantKey.INLINE_FILE_PATH, "inline"); @@ -88,11 +70,6 @@ public class Constants { constants.put(ConstantKey.CONTENT, "content"); constants.put(ConstantKey.PROPERTIES, "m:properties"); constants.put(ConstantKey.LINK, "link"); - constants.put(ConstantKey.METADATA_NS, "http://schemas.microsoft.com/ado/2007/08/dataservices/metadta"); - constants.put(ConstantKey.DATASERVICES_NS, "http://schemas.microsoft.com/ado/2007/08/dataservices"); - constants.put(ConstantKey.GEORSS_NS, "http://www.georss.org/georss"); - constants.put(ConstantKey.GML_NS, "http://www.opengis.net/gml"); - constants.put(ConstantKey.EDM_NS, "http://schemas.microsoft.com/ado/2009/11/edm"); constants.put(ConstantKey.METADATA, "metadata"); constants.put(ConstantKey.SERVICES, "services"); constants.put(ConstantKey.FEED, "feed"); @@ -107,17 +84,12 @@ public class Constants { constants.put(ConstantKey.JSON_NEXTLINK_SUFFIX, "@odata.nextLink"); constants.put(ConstantKey.JSON_ODATAMETADATA_NAME, "odata.metadata"); constants.put(ConstantKey.JSON_NAVIGATION_BIND_SUFFIX, "@odata.bind"); - constants.put(ConstantKey.JSON_NAVIGATION_SUFFIX, "@odata.navigationLinkUrl"); constants.put(ConstantKey.JSON_MEDIA_SUFFIX, "@odata.mediaEditLink"); - constants.put(ConstantKey.JSON_TYPE_NAME, "odata.type"); constants.put(ConstantKey.JSON_TYPE_SUFFIX, "@odata.type"); - constants.put(ConstantKey.JSON_ID_NAME, "odata.id"); - constants.put(ConstantKey.JSON_EDITLINK_NAME, "odata.editLink"); constants.put(ConstantKey.XHTTP_HEADER_NAME, "X-HTTP-METHOD"); - // ----------------------------- } public static String get(final ConstantKey key) { - return (!v4constants.containsKey(key) ? constants : v4constants).get(key); + return constants.get(key); } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c7aa842f/fit/src/test/java/org/apache/olingo/fit/base/EntityUpdateTestITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/base/EntityUpdateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/EntityUpdateTestITCase.java index aa2bc06..d1abb08 100644 --- a/fit/src/test/java/org/apache/olingo/fit/base/EntityUpdateTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/base/EntityUpdateTestITCase.java @@ -79,7 +79,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase { @Test @Ignore - public void testUpateSingleValuedNavtiogationReference() throws Exception { + public void updateSingleValuedNavigationReference() throws Exception { URI targetURI = getClient().newURIBuilder(testStaticServiceRootURL) .appendEntitySetSegment("People") http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c7aa842f/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmConstantExpression.java ---------------------------------------------------------------------- diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmConstantExpression.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmConstantExpression.java index 7c9c69d..3541a3d 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmConstantExpression.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmConstantExpression.java @@ -36,25 +36,25 @@ public interface EdmConstantExpression extends EdmExpression { Object asPrimitive(); /** - * A list of enum members or empty list if this expression is of type primitve or geospatial. + * A list of enum members or empty list if this expression is of type primitive or geospatial. * @return a list of all enum members or empty list */ List<String> asEnumMembers(); /** - * Return the Enum type name or null if this expression is of type primitve or geospatial. + * Return the Enum type name or null if this expression is of type primitive or geospatial. * @return enum type name or null */ String getEnumTypeName(); /** - * Return the geospatial object or null if this expression is of type primitve or enum. + * Return the geospatial object or null if this expression is of type primitive or enum. * @return geospatial object or null */ Geospatial asGeospatial(); /** - * Returns the value of the expression as String + * Returns the value of the expression as String. * @return String representation of the expression */ String getValueAsString();
