Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/olingo-odata4
This commit is contained in:
commit
ef8c3a0531
|
@ -30,6 +30,7 @@ import java.io.OutputStreamWriter;
|
|||
import java.util.AbstractMap;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.ConcurrentModificationException;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
@ -213,9 +214,9 @@ public abstract class AbstractServices {
|
|||
final Enumeration<Header> en = (Enumeration<Header>) body.getAllHeaders();
|
||||
|
||||
Header header = en.nextElement();
|
||||
final String request =
|
||||
final String request =
|
||||
header.getName() + (StringUtils.isNotBlank(header.getValue()) ? ":" + header.getValue() : "");
|
||||
|
||||
|
||||
final Matcher matcher = REQUEST_PATTERN.matcher(request);
|
||||
final Matcher matcherRef = BATCH_REQUEST_REF_PATTERN.matcher(request);
|
||||
|
||||
|
@ -443,23 +444,56 @@ public abstract class AbstractServices {
|
|||
}
|
||||
|
||||
final AbstractUtilities util = acceptType == Accept.ATOM ? xml : json;
|
||||
final InputStream res =
|
||||
util.patchEntity(entitySetName, entityId, IOUtils.toInputStream(changes), acceptType, ifMatch);
|
||||
|
||||
final FITAtomDeserializer atomDeserializer = Commons.getAtomDeserializer(version);
|
||||
final Map.Entry<String, InputStream> entityInfo = xml.readEntity(entitySetName, entityId, Accept.ATOM);
|
||||
|
||||
final String etag = Commons.getETag(entityInfo.getKey(), version);
|
||||
if (StringUtils.isNotBlank(ifMatch) && !ifMatch.equals(etag)) {
|
||||
throw new ConcurrentModificationException("Concurrent modification");
|
||||
}
|
||||
|
||||
final ObjectMapper mapper = Commons.getJsonMapper(version);
|
||||
final FITAtomDeserializer atomDeserializer = Commons.getAtomDeserializer(version);
|
||||
final AtomSerializer atomSerializer = Commons.getAtomSerializer(version);
|
||||
|
||||
final Container<AtomEntryImpl> cres;
|
||||
if (acceptType == Accept.ATOM) {
|
||||
cres = atomDeserializer.read(res, AtomEntryImpl.class);
|
||||
final Accept contentTypeValue = Accept.parse(contentType, version);
|
||||
|
||||
final AtomEntryImpl entryChanges;
|
||||
|
||||
if (contentTypeValue == Accept.XML || contentTypeValue == Accept.TEXT) {
|
||||
throw new UnsupportedMediaTypeException("Unsupported media type");
|
||||
} else if (contentTypeValue == Accept.ATOM) {
|
||||
entryChanges = atomDeserializer.<AtomEntryImpl, AtomEntryImpl>read(
|
||||
IOUtils.toInputStream(changes), AtomEntryImpl.class).getObject();
|
||||
} else {
|
||||
final Container<JSONEntryImpl> jcont = mapper.readValue(res, new TypeReference<JSONEntryImpl>() {
|
||||
final Container<JSONEntryImpl> jcont =
|
||||
mapper.readValue(IOUtils.toInputStream(changes), new TypeReference<JSONEntryImpl>() {
|
||||
});
|
||||
cres = new Container<AtomEntryImpl>(jcont.getContextURL(), jcont.getMetadataETag(),
|
||||
(new DataBinder(version)).getAtomEntry(jcont.getObject()));
|
||||
|
||||
entryChanges = (new DataBinder(version)).getAtomEntry(jcont.getObject());
|
||||
}
|
||||
|
||||
final Container<AtomEntryImpl> entry = atomDeserializer.read(entityInfo.getValue(), AtomEntryImpl.class);
|
||||
|
||||
for (Property property : entryChanges.getProperties()) {
|
||||
entry.getObject().getProperty(property.getName()).setValue(property.getValue());
|
||||
}
|
||||
|
||||
for (Link link : entryChanges.getNavigationLinks()) {
|
||||
entry.getObject().getNavigationLinks().add(link);
|
||||
}
|
||||
|
||||
final ByteArrayOutputStream content = new ByteArrayOutputStream();
|
||||
final OutputStreamWriter writer = new OutputStreamWriter(content, Constants.encoding);
|
||||
atomSerializer.write(writer, entry);
|
||||
writer.flush();
|
||||
writer.close();
|
||||
|
||||
final InputStream res =
|
||||
xml.addOrReplaceEntity(entityId, entitySetName, new ByteArrayInputStream(content.toByteArray()));
|
||||
|
||||
final Container<AtomEntryImpl> cres = atomDeserializer.read(res, AtomEntryImpl.class);
|
||||
|
||||
normalizeAtomEntry(cres.getObject(), entitySetName, entityId);
|
||||
|
||||
final String path = Commons.getEntityBasePath(entitySetName, entityId);
|
||||
|
@ -1520,7 +1554,55 @@ public abstract class AbstractServices {
|
|||
}
|
||||
|
||||
try {
|
||||
return navigateEntity(acceptType, entitySetName, entityId, path);
|
||||
LinkInfo linkInfo = xml.readLinks(entitySetName, entityId, path, Accept.XML);
|
||||
final Map.Entry<String, List<String>> links = xml.extractLinkURIs(linkInfo.getLinks());
|
||||
InputStream stream = xml.readEntities(links.getValue(), path, links.getKey(), linkInfo.isFeed());
|
||||
final FITAtomDeserializer atomDeserializer = Commons.getAtomDeserializer(version);
|
||||
|
||||
final ByteArrayOutputStream content = new ByteArrayOutputStream();
|
||||
final OutputStreamWriter writer = new OutputStreamWriter(content, Constants.encoding);
|
||||
|
||||
if (linkInfo.isFeed()) {
|
||||
final Container<Feed> container = atomDeserializer.<Feed, AtomFeedImpl>read(stream, AtomFeedImpl.class);
|
||||
|
||||
if (acceptType == Accept.ATOM) {
|
||||
final AtomSerializer atomSerializer = Commons.getAtomSerializer(version);
|
||||
atomSerializer.write(writer, container);
|
||||
writer.flush();
|
||||
writer.close();
|
||||
} else {
|
||||
final ObjectMapper mapper = Commons.getJsonMapper(version);
|
||||
mapper.writeValue(
|
||||
writer,
|
||||
new JsonFeedContainer<JSONFeedImpl>(container.getContextURL(),
|
||||
container.getMetadataETag(),
|
||||
(new DataBinder(version)).getJsonFeed((AtomFeedImpl) container.getObject())));
|
||||
}
|
||||
} else {
|
||||
final Container<Entry> container = atomDeserializer.<Entry, AtomEntryImpl>read(stream, AtomEntryImpl.class);
|
||||
if (acceptType == Accept.ATOM) {
|
||||
final AtomSerializer atomSerializer = Commons.getAtomSerializer(version);
|
||||
atomSerializer.write(writer, container);
|
||||
writer.flush();
|
||||
writer.close();
|
||||
} else {
|
||||
final ObjectMapper mapper = Commons.getJsonMapper(version);
|
||||
mapper.writeValue(
|
||||
writer,
|
||||
new JsonEntryContainer<JSONEntryImpl>(container.getContextURL(),
|
||||
container.getMetadataETag(),
|
||||
(new DataBinder(version)).getJsonEntry((AtomEntryImpl) container.getObject())));
|
||||
}
|
||||
}
|
||||
|
||||
final String basePath = Commons.getEntityBasePath(entitySetName, entityId);
|
||||
|
||||
return xml.createResponse(
|
||||
null,
|
||||
new ByteArrayInputStream(content.toByteArray()),
|
||||
Commons.getETag(basePath, version),
|
||||
acceptType);
|
||||
|
||||
} catch (NotFoundException e) {
|
||||
// if the given path is not about any link then search for property
|
||||
return navigateProperty(acceptType, entitySetName, entityId, path, false);
|
||||
|
@ -1541,55 +1623,6 @@ public abstract class AbstractServices {
|
|||
return utils.createResponse(null, entityInfo.getValue(), Commons.getETag(entityInfo.getKey(), version), null);
|
||||
}
|
||||
|
||||
private Response navigateEntity(
|
||||
final Accept acceptType,
|
||||
final String entitySetName,
|
||||
final String entityId,
|
||||
final String path) throws Exception {
|
||||
|
||||
final LinkInfo linkInfo;
|
||||
InputStream stream;
|
||||
if (version.compareTo(ODataServiceVersion.V30) <= 0) {
|
||||
linkInfo = xml.readLinks(entitySetName, entityId, path, Accept.XML);
|
||||
final Map.Entry<String, List<String>> links = xml.extractLinkURIs(linkInfo.getLinks());
|
||||
|
||||
switch (acceptType) {
|
||||
case JSON:
|
||||
case JSON_FULLMETA:
|
||||
case JSON_NOMETA:
|
||||
stream = json.readEntities(links.getValue(), path, links.getKey(), linkInfo.isFeed());
|
||||
stream = json.wrapJsonEntities(stream);
|
||||
break;
|
||||
default:
|
||||
stream = xml.readEntities(links.getValue(), path, links.getKey(), linkInfo.isFeed());
|
||||
}
|
||||
|
||||
} else {
|
||||
linkInfo = xml.readLinks(entitySetName, entityId, path, Accept.ATOM);
|
||||
if (acceptType == Accept.ATOM) {
|
||||
stream = linkInfo.getLinks();
|
||||
} else {
|
||||
final FITAtomDeserializer atomDeserializer = Commons.getAtomDeserializer(version);
|
||||
final DataBinder dataBinder = new DataBinder(version);
|
||||
final ObjectMapper mapper = Commons.getJsonMapper(version);
|
||||
|
||||
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
final Object object;
|
||||
if (linkInfo.isFeed()) {
|
||||
final Container<AtomFeedImpl> container = atomDeserializer.read(linkInfo.getLinks(), AtomFeedImpl.class);
|
||||
object = dataBinder.getJsonFeed(container.getObject());
|
||||
} else {
|
||||
final Container<AtomEntryImpl> container = atomDeserializer.read(linkInfo.getLinks(), AtomEntryImpl.class);
|
||||
object = dataBinder.getJsonEntry(container.getObject());
|
||||
}
|
||||
mapper.writeValue(baos, object);
|
||||
stream = new ByteArrayInputStream(baos.toByteArray());
|
||||
}
|
||||
}
|
||||
final String basePath = Commons.getEntityBasePath(entitySetName, entityId);
|
||||
return xml.createResponse(null, stream, Commons.getETag(basePath, version), acceptType);
|
||||
}
|
||||
|
||||
private Response navigateProperty(
|
||||
final Accept acceptType,
|
||||
final String entitySetName,
|
||||
|
@ -1654,9 +1687,13 @@ public abstract class AbstractServices {
|
|||
}
|
||||
|
||||
public Map.Entry<Accept, AbstractUtilities> getUtilities(final String accept, final String format) {
|
||||
final Accept acceptType;
|
||||
Accept acceptType;
|
||||
if (StringUtils.isNotBlank(format)) {
|
||||
acceptType = Accept.valueOf(format.toUpperCase());
|
||||
try {
|
||||
acceptType = Accept.valueOf(format.toUpperCase());
|
||||
} catch (Exception e) {
|
||||
acceptType = Accept.parse(format, version);
|
||||
}
|
||||
} else {
|
||||
acceptType = Accept.parse(accept, version);
|
||||
}
|
||||
|
|
|
@ -401,21 +401,6 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
|
|||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InputStream setChanges(
|
||||
final InputStream toBeChanged, final Map<String, InputStream> properties) throws Exception {
|
||||
|
||||
final ObjectMapper mapper = new ObjectMapper();
|
||||
final ObjectNode toBeChangedObject = (ObjectNode) mapper.readTree(toBeChanged);
|
||||
|
||||
for (Map.Entry<String, InputStream> property : properties.entrySet()) {
|
||||
final JsonNode propertyNode = mapper.readTree(property.getValue());
|
||||
toBeChangedObject.set(property.getKey(), propertyNode);
|
||||
}
|
||||
|
||||
return IOUtils.toInputStream(toBeChangedObject.toString(), "UTf-8");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map.Entry<String, List<String>> extractLinkURIs(
|
||||
final String entitySetName, final String entityId, final String linkName)
|
||||
|
|
|
@ -413,13 +413,15 @@ public abstract class AbstractUtilities {
|
|||
final String location, final InputStream entity, final String etag, final Accept accept) {
|
||||
return createResponse(location, entity, etag, accept, null);
|
||||
}
|
||||
|
||||
|
||||
public Response createResponse(final InputStream entity, final String etag, final Accept accept) {
|
||||
return createResponse(null, entity, etag, accept, null);
|
||||
}
|
||||
|
||||
public Response createBatchResponse(final InputStream stream, final String boundary) {
|
||||
final Response.ResponseBuilder builder = Response.accepted(stream);
|
||||
final Response.ResponseBuilder builder = version.compareTo(ODataServiceVersion.V30) <= 0
|
||||
? Response.accepted(stream)
|
||||
: Response.ok(stream);
|
||||
builder.header(Constants.get(version, ConstantKey.ODATA_SERVICE_VERSION), version.toString() + ";");
|
||||
return builder.build();
|
||||
}
|
||||
|
@ -431,6 +433,7 @@ public abstract class AbstractUtilities {
|
|||
final Response.Status status) {
|
||||
return createResponse(null, entity, etag, accept, status);
|
||||
}
|
||||
|
||||
public Response createResponse(
|
||||
final String location,
|
||||
final InputStream entity,
|
||||
|
@ -809,25 +812,6 @@ public abstract class AbstractUtilities {
|
|||
// --------------------------------
|
||||
}
|
||||
|
||||
public InputStream patchEntity(
|
||||
final String entitySetName,
|
||||
final String entityId,
|
||||
final InputStream changes,
|
||||
final Accept accept,
|
||||
final String ifMatch)
|
||||
throws Exception {
|
||||
|
||||
final Map.Entry<String, InputStream> entityInfo = readEntity(entitySetName, entityId, accept);
|
||||
|
||||
final String etag = Commons.getETag(entityInfo.getKey(), version);
|
||||
if (StringUtils.isNotBlank(ifMatch) && !ifMatch.equals(etag)) {
|
||||
throw new ConcurrentModificationException("Concurrent modification");
|
||||
}
|
||||
|
||||
final Map<String, InputStream> replacement = getChanges(changes);
|
||||
return addOrReplaceEntity(entityId, entitySetName, setChanges(entityInfo.getValue(), replacement));
|
||||
}
|
||||
|
||||
public InputStream replaceProperty(
|
||||
final String entitySetName,
|
||||
final String entityId,
|
||||
|
@ -889,9 +873,6 @@ public abstract class AbstractUtilities {
|
|||
|
||||
protected abstract Map<String, InputStream> getChanges(final InputStream src) throws Exception;
|
||||
|
||||
protected abstract InputStream setChanges(
|
||||
final InputStream toBeChanged, final Map<String, InputStream> properties) throws Exception;
|
||||
|
||||
public abstract InputStream addEditLink(
|
||||
final InputStream content, final String title, final String href) throws Exception;
|
||||
|
||||
|
|
|
@ -977,139 +977,6 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
|
|||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream setChanges(
|
||||
final InputStream toBeChanged,
|
||||
final Map<String, InputStream> properties)
|
||||
throws Exception {
|
||||
XMLEventReader reader = getEventReader(toBeChanged);
|
||||
|
||||
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
XMLEventWriter writer = getEventWriter(bos);
|
||||
|
||||
// ---------------------------------
|
||||
// add property changes
|
||||
// ---------------------------------
|
||||
Map.Entry<Integer, XmlElement> propertyElement =
|
||||
extractElement(reader, writer,
|
||||
Collections.<String>singletonList(Constants.get(version, ConstantKey.PROPERTIES)), 0, 2, 3);
|
||||
|
||||
writer.flush();
|
||||
|
||||
ByteArrayOutputStream pbos = new ByteArrayOutputStream();
|
||||
OutputStreamWriter pwriter = new OutputStreamWriter(pbos);
|
||||
|
||||
final XMLEventReader propertyReader = propertyElement.getValue().getContentReader();
|
||||
|
||||
try {
|
||||
while (true) {
|
||||
final XmlElement property = extractElement(propertyReader, null, null, 0, -1, -1).getValue();
|
||||
final String name = property.getStart().getName().getLocalPart();
|
||||
|
||||
if (properties.containsKey(name)) {
|
||||
// replace
|
||||
final InputStream replacement = properties.get(name);
|
||||
properties.remove(property.getStart().getName().getLocalPart());
|
||||
pwriter.append(IOUtils.toString(replacement));
|
||||
IOUtils.closeQuietly(replacement);
|
||||
} else {
|
||||
pwriter.append(IOUtils.toString(property.toStream()));
|
||||
}
|
||||
}
|
||||
} catch (Exception ignore) {
|
||||
// end
|
||||
}
|
||||
|
||||
for (Map.Entry<String, InputStream> remains : properties.entrySet()) {
|
||||
if (!remains.getKey().startsWith("[Constants.get(version, ConstantKey.LINK)]")) {
|
||||
pwriter.append(IOUtils.toString(remains.getValue()));
|
||||
IOUtils.closeQuietly(remains.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
pwriter.flush();
|
||||
pwriter.close();
|
||||
|
||||
writer.add(propertyElement.getValue().getStart());
|
||||
writer.add(new XMLEventReaderWrapper(new ByteArrayInputStream(pbos.toByteArray())));
|
||||
writer.add(propertyElement.getValue().getEnd());
|
||||
|
||||
IOUtils.closeQuietly(pbos);
|
||||
|
||||
writer.add(reader);
|
||||
reader.close();
|
||||
writer.flush();
|
||||
writer.close();
|
||||
// ---------------------------------
|
||||
|
||||
// ---------------------------------
|
||||
// add navigationm changes
|
||||
// ---------------------------------
|
||||
// remove existent links
|
||||
for (Map.Entry<String, InputStream> remains : properties.entrySet()) {
|
||||
|
||||
if (remains.getKey().startsWith("[Constants.get(version, ConstantKey.LINK)]")) {
|
||||
reader = getEventReader(new ByteArrayInputStream(bos.toByteArray()));
|
||||
|
||||
bos.reset();
|
||||
writer = getEventWriter(bos);
|
||||
|
||||
try {
|
||||
final String linkName = remains.getKey().substring(remains.getKey().indexOf("]") + 1);
|
||||
|
||||
extractElement(reader, writer, Collections.<String>singletonList(Constants.get(version, ConstantKey.LINK)),
|
||||
Collections.<Map.Entry<String, String>>singleton(new SimpleEntry<String, String>("title", linkName)),
|
||||
false, 0, 2, 2);
|
||||
|
||||
writer.add(reader);
|
||||
|
||||
} catch (Exception ignore) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
writer.flush();
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
|
||||
reader = getEventReader(new ByteArrayInputStream(bos.toByteArray()));
|
||||
|
||||
bos.reset();
|
||||
writer = getEventWriter(bos);
|
||||
|
||||
propertyElement = extractElement(reader, writer,
|
||||
Collections.<String>singletonList(Constants.get(version, ConstantKey.CONTENT)), 0, 2, 2);
|
||||
writer.flush();
|
||||
|
||||
pbos.reset();
|
||||
pwriter = new OutputStreamWriter(pbos);
|
||||
|
||||
for (Map.Entry<String, InputStream> remains : properties.entrySet()) {
|
||||
if (remains.getKey().startsWith("[Constants.get(version, ConstantKey.LINK)]")) {
|
||||
pwriter.append(IOUtils.toString(remains.getValue()));
|
||||
IOUtils.closeQuietly(remains.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
pwriter.flush();
|
||||
pwriter.close();
|
||||
|
||||
writer.add(new XMLEventReaderWrapper(new ByteArrayInputStream(pbos.toByteArray())));
|
||||
IOUtils.closeQuietly(pbos);
|
||||
|
||||
writer.add(propertyElement.getValue().getStart());
|
||||
writer.add(propertyElement.getValue().getContentReader());
|
||||
writer.add(propertyElement.getValue().getEnd());
|
||||
|
||||
writer.add(reader);
|
||||
reader.close();
|
||||
writer.flush();
|
||||
writer.close();
|
||||
// ---------------------------------
|
||||
|
||||
return new ByteArrayInputStream(bos.toByteArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InputStream replaceLink(
|
||||
final InputStream toBeChanged, final String linkName, final InputStream replacement)
|
||||
|
|
|
@ -84,6 +84,7 @@ public abstract class Commons {
|
|||
sequence.put("ComputerDetail", 1000);
|
||||
sequence.put("AllGeoTypesSet", 1000);
|
||||
sequence.put("Orders", 1000);
|
||||
sequence.put("Customers", 1000);
|
||||
sequence.put("Person", 1000);
|
||||
sequence.put("RowIndex", 1000);
|
||||
|
||||
|
|
|
@ -132,7 +132,11 @@ public class DataBinder {
|
|||
final Link alink = new LinkImpl();
|
||||
alink.setHref(link.getHref());
|
||||
alink.setTitle(link.getTitle());
|
||||
alink.setType(metadata.getEntityType(jsonentry.getType()).getNavigationProperty(link.getTitle()).isFeed()
|
||||
|
||||
final NavigationProperty navPropDetails =
|
||||
metadata.getEntityType(jsonentry.getType()).getNavigationProperty(link.getTitle());
|
||||
|
||||
alink.setType(navPropDetails != null && navPropDetails.isFeed()
|
||||
? Constants.get(ConstantKey.ATOM_LINK_FEED) : Constants.get(ConstantKey.ATOM_LINK_ENTRY));
|
||||
alink.setRel(link.getRel());
|
||||
|
||||
|
@ -203,7 +207,7 @@ public class DataBinder {
|
|||
public JSONPropertyImpl getJsonProperty(final AtomPropertyImpl atomproperty) {
|
||||
final JSONPropertyImpl jsonproperty = new JSONPropertyImpl();
|
||||
BeanUtils.copyProperties(atomproperty, jsonproperty, "value");
|
||||
|
||||
|
||||
if (atomproperty.getValue().isComplex()) {
|
||||
final ComplexValueImpl complex = new ComplexValueImpl();
|
||||
jsonproperty.setValue(complex);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Accounts/$entity",
|
||||
"@odata.context": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#Accounts/$entity",
|
||||
"@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Account",
|
||||
"@odata.id": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)",
|
||||
"@odata.editLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)",
|
||||
"@odata.id": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)",
|
||||
"@odata.editLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)",
|
||||
"AccountID": 101,
|
||||
"Country": "US",
|
||||
"AccountInfo": {
|
||||
|
@ -11,24 +11,24 @@
|
|||
"LastName": "Green",
|
||||
"MiddleName": "Hood"
|
||||
},
|
||||
"MyGiftCard@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyGiftCard/$ref",
|
||||
"MyGiftCard@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyGiftCard",
|
||||
"MyPaymentInstruments@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments/$ref",
|
||||
"MyPaymentInstruments@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments",
|
||||
"ActiveSubscriptions@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/ActiveSubscriptions/$ref",
|
||||
"ActiveSubscriptions@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/ActiveSubscriptions",
|
||||
"AvailableSubscriptionTemplatess@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/AvailableSubscriptionTemplatess/$ref",
|
||||
"AvailableSubscriptionTemplatess@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/AvailableSubscriptionTemplatess",
|
||||
"MyGiftCard@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyGiftCard/$ref",
|
||||
"MyGiftCard@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyGiftCard",
|
||||
"MyPaymentInstruments@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments/$ref",
|
||||
"MyPaymentInstruments@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments",
|
||||
"ActiveSubscriptions@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/ActiveSubscriptions/$ref",
|
||||
"ActiveSubscriptions@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/ActiveSubscriptions",
|
||||
"AvailableSubscriptionTemplatess@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/AvailableSubscriptionTemplatess/$ref",
|
||||
"AvailableSubscriptionTemplatess@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/AvailableSubscriptionTemplatess",
|
||||
"#Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI": {
|
||||
"title": "Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI",
|
||||
"target": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI"
|
||||
"target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI"
|
||||
},
|
||||
"#Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI": {
|
||||
"title": "Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI",
|
||||
"target": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI"
|
||||
"target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI"
|
||||
},
|
||||
"#Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo": {
|
||||
"title": "Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo",
|
||||
"target": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo"
|
||||
"target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,14 +19,14 @@
|
|||
under the License.
|
||||
|
||||
-->
|
||||
<entry xml:base="http://odatae2etest.azurewebsites.net/javatest/DefaultService/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://docs.oasis-open.org/odata/ns/data" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:context="http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Accounts/$entity">
|
||||
<id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)</id>
|
||||
<entry xml:base="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://docs.oasis-open.org/odata/ns/data" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:context="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#Accounts/$entity">
|
||||
<id>http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)</id>
|
||||
<category term="#Microsoft.Test.OData.Services.ODataWCFService.Account" scheme="http://docs.oasis-open.org/odata/ns/scheme"/>
|
||||
<link rel="edit" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/MyGiftCard" type="application/atom+xml;type=entry" title="MyGiftCard" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyGiftCard"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/MyPaymentInstruments" type="application/atom+xml;type=feed" title="MyPaymentInstruments" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/ActiveSubscriptions" type="application/atom+xml;type=feed" title="ActiveSubscriptions" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/ActiveSubscriptions"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/AvailableSubscriptionTemplatess" type="application/atom+xml;type=feed" title="AvailableSubscriptionTemplatess" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/AvailableSubscriptionTemplatess"/>
|
||||
<link rel="edit" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/MyGiftCard" type="application/atom+xml;type=entry" title="MyGiftCard" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyGiftCard"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/MyPaymentInstruments" type="application/atom+xml;type=feed" title="MyPaymentInstruments" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/ActiveSubscriptions" type="application/atom+xml;type=feed" title="ActiveSubscriptions" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/ActiveSubscriptions"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/AvailableSubscriptionTemplatess" type="application/atom+xml;type=feed" title="AvailableSubscriptionTemplatess" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/AvailableSubscriptionTemplatess"/>
|
||||
<title/>
|
||||
<updated>2014-04-14T12:45:00Z</updated>
|
||||
<author>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Accounts(101)/MyPaymentInstruments/$entity",
|
||||
"@odata.context": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#Accounts(101)/MyPaymentInstruments/$entity",
|
||||
"@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument",
|
||||
"@odata.id": "Accounts(101)/MyPaymentInstruments(101901)",
|
||||
"@odata.editLink": "Accounts(101)/MyPaymentInstruments(101901)",
|
||||
|
@ -7,10 +7,10 @@
|
|||
"FriendlyName": "101 first PI",
|
||||
"CreatedDate@odata.type": "#DateTimeOffset",
|
||||
"CreatedDate": "2014-04-09T00:00:00Z",
|
||||
"TheStoredPI@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/TheStoredPI/$ref",
|
||||
"TheStoredPI@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/TheStoredPI",
|
||||
"BillingStatements@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/BillingStatements/$ref",
|
||||
"BillingStatements@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/BillingStatements",
|
||||
"BackupStoredPI@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/BackupStoredPI/$ref",
|
||||
"BackupStoredPI@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/BackupStoredPI"
|
||||
"TheStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101901)/TheStoredPI/$ref",
|
||||
"TheStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101901)/TheStoredPI",
|
||||
"BillingStatements@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101901)/BillingStatements/$ref",
|
||||
"BillingStatements@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101901)/BillingStatements",
|
||||
"BackupStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101901)/BackupStoredPI/$ref",
|
||||
"BackupStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101901)/BackupStoredPI"
|
||||
}
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
under the License.
|
||||
|
||||
-->
|
||||
<entry xml:base="http://odatae2etest.azurewebsites.net/javatest/DefaultService/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://docs.oasis-open.org/odata/ns/data" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:context="http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Accounts(101)/MyPaymentInstruments/$entity">
|
||||
<entry xml:base="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://docs.oasis-open.org/odata/ns/data" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:context="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#Accounts(101)/MyPaymentInstruments/$entity">
|
||||
<category term="#Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument" scheme="http://docs.oasis-open.org/odata/ns/scheme"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/TheStoredPI"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/BillingStatements"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/BackupStoredPI"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101901)/TheStoredPI"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101901)/BillingStatements"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101901)/BackupStoredPI"/>
|
||||
<id/>
|
||||
<title/>
|
||||
<updated>2014-04-14T12:47:37Z</updated>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Accounts(101)/MyPaymentInstruments",
|
||||
"@odata.context": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#Accounts(101)/MyPaymentInstruments",
|
||||
"value": [{
|
||||
"@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument",
|
||||
"@odata.id": "Accounts(101)/MyPaymentInstruments(101901)",
|
||||
|
@ -8,12 +8,12 @@
|
|||
"FriendlyName": "101 first PI",
|
||||
"CreatedDate@odata.type": "#DateTimeOffset",
|
||||
"CreatedDate": "2014-04-09T00:00:00Z",
|
||||
"TheStoredPI@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/TheStoredPI/$ref",
|
||||
"TheStoredPI@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/TheStoredPI",
|
||||
"BillingStatements@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/BillingStatements/$ref",
|
||||
"BillingStatements@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/BillingStatements",
|
||||
"BackupStoredPI@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/BackupStoredPI/$ref",
|
||||
"BackupStoredPI@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/BackupStoredPI"
|
||||
"TheStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101901)/TheStoredPI/$ref",
|
||||
"TheStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101901)/TheStoredPI",
|
||||
"BillingStatements@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101901)/BillingStatements/$ref",
|
||||
"BillingStatements@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101901)/BillingStatements",
|
||||
"BackupStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101901)/BackupStoredPI/$ref",
|
||||
"BackupStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101901)/BackupStoredPI"
|
||||
}, {
|
||||
"@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI",
|
||||
"@odata.id": "Accounts(101)/MyPaymentInstruments(101902)",
|
||||
|
@ -28,14 +28,14 @@
|
|||
"Balance": 100.0,
|
||||
"ExperationDate@odata.type": "#DateTimeOffset",
|
||||
"ExperationDate": "2022-11-01T00:00:00Z",
|
||||
"TheStoredPI@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI/$ref",
|
||||
"TheStoredPI@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI",
|
||||
"BillingStatements@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements/$ref",
|
||||
"BillingStatements@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements",
|
||||
"BackupStoredPI@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI/$ref",
|
||||
"BackupStoredPI@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI",
|
||||
"CreditRecords@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords/$ref",
|
||||
"CreditRecords@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords"
|
||||
"TheStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI/$ref",
|
||||
"TheStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI",
|
||||
"BillingStatements@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements/$ref",
|
||||
"BillingStatements@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements",
|
||||
"BackupStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI/$ref",
|
||||
"BackupStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI",
|
||||
"CreditRecords@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords/$ref",
|
||||
"CreditRecords@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords"
|
||||
}, {
|
||||
"@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI",
|
||||
"@odata.id": "Accounts(101)/MyPaymentInstruments(101903)",
|
||||
|
@ -50,13 +50,13 @@
|
|||
"Balance": 300.0,
|
||||
"ExperationDate@odata.type": "#DateTimeOffset",
|
||||
"ExperationDate": "2022-10-02T00:00:00Z",
|
||||
"TheStoredPI@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI/$ref",
|
||||
"TheStoredPI@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI",
|
||||
"BillingStatements@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements/$ref",
|
||||
"BillingStatements@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements",
|
||||
"BackupStoredPI@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI/$ref",
|
||||
"BackupStoredPI@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI",
|
||||
"CreditRecords@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords/$ref",
|
||||
"CreditRecords@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords"
|
||||
"TheStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI/$ref",
|
||||
"TheStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI",
|
||||
"BillingStatements@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements/$ref",
|
||||
"BillingStatements@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements",
|
||||
"BackupStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI/$ref",
|
||||
"BackupStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI",
|
||||
"CreditRecords@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords/$ref",
|
||||
"CreditRecords@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords"
|
||||
}]
|
||||
}
|
||||
|
|
|
@ -19,15 +19,15 @@
|
|||
under the License.
|
||||
|
||||
-->
|
||||
<feed xml:base="http://odatae2etest.azurewebsites.net/javatest/DefaultService/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://docs.oasis-open.org/odata/ns/data" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:context="http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Accounts(101)/MyPaymentInstruments">
|
||||
<id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/MyPaymentInstruments</id>
|
||||
<feed xml:base="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://docs.oasis-open.org/odata/ns/data" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:context="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#Accounts(101)/MyPaymentInstruments">
|
||||
<id>http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/MyPaymentInstruments</id>
|
||||
<title/>
|
||||
<updated>2014-04-14T12:45:33Z</updated>
|
||||
<entry>
|
||||
<category term="#Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument" scheme="http://docs.oasis-open.org/odata/ns/scheme"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/TheStoredPI"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/BillingStatements"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/BackupStoredPI"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101901)/TheStoredPI"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101901)/BillingStatements"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101901)/BackupStoredPI"/>
|
||||
<id/>
|
||||
<title/>
|
||||
<updated>2014-04-14T12:45:33Z</updated>
|
||||
|
@ -44,10 +44,10 @@
|
|||
</entry>
|
||||
<entry>
|
||||
<category term="#Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI" scheme="http://docs.oasis-open.org/odata/ns/scheme"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/CreditRecords" type="application/atom+xml;type=feed" title="CreditRecords" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/CreditRecords" type="application/atom+xml;type=feed" title="CreditRecords" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords"/>
|
||||
<id/>
|
||||
<title/>
|
||||
<updated>2014-04-14T12:45:33Z</updated>
|
||||
|
@ -69,10 +69,10 @@
|
|||
</entry>
|
||||
<entry>
|
||||
<category term="#Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI" scheme="http://docs.oasis-open.org/odata/ns/scheme"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/CreditRecords" type="application/atom+xml;type=feed" title="CreditRecords" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI"/>
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/CreditRecords" type="application/atom+xml;type=feed" title="CreditRecords" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords"/>
|
||||
<id/>
|
||||
<title/>
|
||||
<updated>2014-04-14T12:45:33Z</updated>
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"@odata.context": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#OrderDetails/$entity",
|
||||
"@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.OrderDetail",
|
||||
"@odata.id": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/OrderDetails(OrderID=7,ProductID=5)",
|
||||
"@odata.editLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/OrderDetails(OrderID=7,ProductID=5)",
|
||||
"OrderID": 7,
|
||||
"ProductID": 5,
|
||||
"OrderPlaced@odata.type": "#DateTimeOffset",
|
||||
"OrderPlaced": "2014-04-16T12:34:53.1351147Z",
|
||||
"Quantity": 50,
|
||||
"UnitPrice@odata.type": "#Single",
|
||||
"UnitPrice": 3.24,
|
||||
"ProductOrdered@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/OrderDetails(OrderID=7,ProductID=5)/ProductOrdered/$ref",
|
||||
"ProductOrdered@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/OrderDetails(OrderID=7,ProductID=5)/ProductOrdered",
|
||||
"AssociatedOrder@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/OrderDetails(OrderID=7,ProductID=5)/AssociatedOrder/$ref",
|
||||
"AssociatedOrder@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/OrderDetails(OrderID=7,ProductID=5)/AssociatedOrder"
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
|
||||
-->
|
||||
<entry xml:base="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://docs.oasis-open.org/odata/ns/data" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:context="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#OrderDetails/$entity">
|
||||
<id>http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/OrderDetails(OrderID=7,ProductID=5)</id>
|
||||
<category term="#Microsoft.Test.OData.Services.ODataWCFService.OrderDetail" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
|
||||
<link rel="edit" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/OrderDetails(OrderID=7,ProductID=5)" />
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/ProductOrdered" type="application/atom+xml;type=feed" title="ProductOrdered" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/OrderDetails(OrderID=7,ProductID=5)/ProductOrdered" />
|
||||
<link rel="http://docs.oasis-open.org/odata/ns/related/AssociatedOrder" type="application/atom+xml;type=entry" title="AssociatedOrder" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/OrderDetails(OrderID=7,ProductID=5)/AssociatedOrder" />
|
||||
<title />
|
||||
<updated>2014-04-16T12:38:34Z</updated>
|
||||
<author>
|
||||
<name />
|
||||
</author>
|
||||
<content type="application/xml">
|
||||
<m:properties>
|
||||
<d:OrderID m:type="Int32">7</d:OrderID>
|
||||
<d:ProductID m:type="Int32">5</d:ProductID>
|
||||
<d:OrderPlaced m:type="DateTimeOffset">2014-04-16T12:34:53.1351147Z</d:OrderPlaced>
|
||||
<d:Quantity m:type="Int32">50</d:Quantity>
|
||||
<d:UnitPrice m:type="Single">3.24</d:UnitPrice>
|
||||
</m:properties>
|
||||
</content>
|
||||
</entry>
|
|
@ -55,7 +55,6 @@ import org.apache.olingo.client.core.uri.URIUtils;
|
|||
import org.apache.olingo.commons.api.domain.v3.ODataEntity;
|
||||
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
|
||||
import org.apache.olingo.commons.api.format.ODataPubFormat;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
public class BatchTestITCase extends AbstractTestITCase {
|
||||
|
|
|
@ -0,0 +1,466 @@
|
|||
/*
|
||||
* 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.client.core.it.v4;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.olingo.client.api.ODataBatchConstants;
|
||||
import org.apache.olingo.client.api.communication.request.ODataStreamManager;
|
||||
import org.apache.olingo.client.api.communication.request.batch.BatchStreamManager;
|
||||
import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest;
|
||||
import org.apache.olingo.client.api.communication.request.batch.ODataBatchResponseItem;
|
||||
import org.apache.olingo.client.api.communication.request.batch.ODataChangeset;
|
||||
import org.apache.olingo.client.api.communication.request.batch.ODataRetrieve;
|
||||
import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
|
||||
import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
|
||||
import org.apache.olingo.client.api.communication.request.cud.v4.UpdateType;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
|
||||
import org.apache.olingo.client.api.communication.response.ODataBatchResponse;
|
||||
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
|
||||
import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
|
||||
import org.apache.olingo.client.api.communication.response.ODataResponse;
|
||||
import org.apache.olingo.client.api.uri.v4.URIBuilder;
|
||||
import org.apache.olingo.client.core.communication.request.AbstractODataStreamManager;
|
||||
import org.apache.olingo.client.core.communication.request.Wrapper;
|
||||
import org.apache.olingo.client.core.communication.request.batch.ODataChangesetResponseItem;
|
||||
import org.apache.olingo.client.core.communication.request.batch.ODataRetrieveResponseItem;
|
||||
import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl;
|
||||
import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl.ODataEntityResponseImpl;
|
||||
import org.apache.olingo.client.core.uri.URIUtils;
|
||||
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
|
||||
import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
|
||||
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
|
||||
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
|
||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||
import org.apache.olingo.commons.api.format.ODataPubFormat;
|
||||
import org.junit.Test;
|
||||
|
||||
public class BatchTestITCase extends AbstractTestITCase {
|
||||
|
||||
private static final String PREFIX = "!!PREFIX!!";
|
||||
|
||||
private static final String SUFFIX = "!!SUFFIX!!";
|
||||
|
||||
private static final int MAX = 10000;
|
||||
|
||||
@Test
|
||||
public void stringStreaming() {
|
||||
final TestStreamManager streaming = new TestStreamManager();
|
||||
|
||||
new StreamingThread(streaming).start();
|
||||
|
||||
streaming.addObject((PREFIX + "\n").getBytes());
|
||||
|
||||
for (int i = 0; i <= MAX; i++) {
|
||||
streaming.addObject((i + ") send info\n").getBytes());
|
||||
}
|
||||
|
||||
streaming.addObject(SUFFIX.getBytes());
|
||||
streaming.finalizeBody();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void emptyBatchRequest() {
|
||||
// create your request
|
||||
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
|
||||
|
||||
final BatchStreamManager payload = request.execute();
|
||||
final ODataBatchResponse response = payload.getResponse();
|
||||
|
||||
assertEquals(200, response.getStatusCode());
|
||||
assertEquals("OK", response.getStatusMessage());
|
||||
|
||||
final Iterator<ODataBatchResponseItem> iter = response.getBody();
|
||||
assertFalse(iter.hasNext());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void changesetWithError() {
|
||||
// create your request
|
||||
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
|
||||
|
||||
final BatchStreamManager payload = request.execute();
|
||||
final ODataChangeset changeset = payload.addChangeset();
|
||||
|
||||
URIBuilder targetURI;
|
||||
ODataEntityCreateRequest<ODataEntity> createReq;
|
||||
|
||||
targetURI = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders");
|
||||
for (int i = 1; i <= 2; i++) {
|
||||
// Create Customer into the changeset
|
||||
createReq = client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), newOrder(100 + i));
|
||||
createReq.setFormat(ODataPubFormat.JSON);
|
||||
changeset.addRequest(createReq);
|
||||
}
|
||||
|
||||
targetURI = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("WrongEntitySet");
|
||||
createReq = client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), newOrder(105));
|
||||
createReq.setFormat(ODataPubFormat.JSON);
|
||||
changeset.addRequest(createReq);
|
||||
|
||||
targetURI = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders");
|
||||
for (int i = 3; i <= 4; i++) {
|
||||
// Create Customer into the changeset
|
||||
createReq = client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), newOrder(100 + i));
|
||||
createReq.setFormat(ODataPubFormat.ATOM);
|
||||
changeset.addRequest(createReq);
|
||||
}
|
||||
|
||||
final ODataBatchResponse response = payload.getResponse();
|
||||
assertEquals(200, response.getStatusCode());
|
||||
assertEquals("OK", response.getStatusMessage());
|
||||
|
||||
final Iterator<ODataBatchResponseItem> iter = response.getBody();
|
||||
final ODataChangesetResponseItem chgResponseItem = (ODataChangesetResponseItem) iter.next();
|
||||
|
||||
final ODataResponse res = chgResponseItem.next();
|
||||
assertEquals(404, res.getStatusCode());
|
||||
assertEquals("Not Found", res.getStatusMessage());
|
||||
assertEquals(Integer.valueOf(3), Integer.valueOf(
|
||||
res.getHeader(ODataBatchConstants.CHANGESET_CONTENT_ID_NAME).iterator().next()));
|
||||
assertFalse(chgResponseItem.hasNext());
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void changesetWithReference() throws EdmPrimitiveTypeException {
|
||||
// create your request
|
||||
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
|
||||
final BatchStreamManager streamManager = request.execute();
|
||||
|
||||
final ODataChangeset changeset = streamManager.addChangeset();
|
||||
ODataEntity order = newOrder(20);
|
||||
|
||||
URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders");
|
||||
|
||||
// add create request
|
||||
final ODataEntityCreateRequest<ODataEntity> createReq =
|
||||
client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), order);
|
||||
|
||||
changeset.addRequest(createReq);
|
||||
|
||||
// retrieve request reference
|
||||
int createRequestRef = changeset.getLastContentId();
|
||||
|
||||
// add update request: link CustomerInfo(17) to the new customer
|
||||
final ODataEntity customerChanges = client.getObjectFactory().newEntity(order.getTypeName());
|
||||
customerChanges.addLink(client.getObjectFactory().newEntitySetNavigationLink(
|
||||
"OrderDetails",
|
||||
client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("OrderDetails").
|
||||
appendKeySegment(new HashMap<String, Object>() {
|
||||
private static final long serialVersionUID = 3109256773218160485L;
|
||||
|
||||
{
|
||||
put("OrderID", 7);
|
||||
put("ProductID", 5);
|
||||
}
|
||||
}).build()));
|
||||
|
||||
final ODataEntityUpdateRequest<ODataEntity> updateReq = client.getCUDRequestFactory().getEntityUpdateRequest(
|
||||
URI.create("$" + createRequestRef), UpdateType.PATCH, customerChanges);
|
||||
|
||||
changeset.addRequest(updateReq);
|
||||
|
||||
final ODataBatchResponse response = streamManager.getResponse();
|
||||
assertEquals(200, response.getStatusCode());
|
||||
assertEquals("OK", response.getStatusMessage());
|
||||
|
||||
// verify response payload ...
|
||||
final Iterator<ODataBatchResponseItem> iter = response.getBody();
|
||||
|
||||
final ODataBatchResponseItem item = iter.next();
|
||||
assertTrue(item instanceof ODataChangesetResponseItem);
|
||||
|
||||
final ODataChangesetResponseItem chgitem = (ODataChangesetResponseItem) item;
|
||||
|
||||
ODataResponse res = chgitem.next();
|
||||
assertEquals(201, res.getStatusCode());
|
||||
assertTrue(res instanceof ODataEntityCreateResponse);
|
||||
|
||||
order = ((ODataEntityCreateResponse<ODataEntity>) res).getBody();
|
||||
ODataEntitySetRequest<ODataEntitySet> req = client.getRetrieveRequestFactory().getEntitySetRequest(
|
||||
URIUtils.getURI(testStaticServiceRootURL, order.getEditLink().toASCIIString() + "/OrderDetails"));
|
||||
|
||||
assertEquals(Integer.valueOf(7),
|
||||
req.execute().getBody().getEntities().get(0).getProperty("OrderID").getPrimitiveValue().
|
||||
toCastValue(Integer.class));
|
||||
|
||||
res = chgitem.next();
|
||||
assertEquals(204, res.getStatusCode());
|
||||
assertTrue(res instanceof ODataEntityUpdateResponse);
|
||||
|
||||
// clean ...
|
||||
assertEquals(204, client.getCUDRequestFactory().getDeleteRequest(
|
||||
URIUtils.getURI(testStaticServiceRootURL, order.getEditLink().toASCIIString())).execute().
|
||||
getStatusCode());
|
||||
|
||||
try {
|
||||
client.getRetrieveRequestFactory().getEntityRequest(
|
||||
URIUtils.getURI(testStaticServiceRootURL, order.getEditLink().toASCIIString())).
|
||||
execute().getBody();
|
||||
fail();
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void batchRequest() throws EdmPrimitiveTypeException {
|
||||
// create your request
|
||||
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
|
||||
|
||||
final BatchStreamManager streamManager = request.execute();
|
||||
|
||||
// -------------------------------------------
|
||||
// Add retrieve item
|
||||
// -------------------------------------------
|
||||
ODataRetrieve retrieve = streamManager.addRetrieve();
|
||||
|
||||
// prepare URI
|
||||
URIBuilder targetURI = client.getURIBuilder(testStaticServiceRootURL);
|
||||
targetURI.appendEntitySetSegment("Customers").appendKeySegment(1).
|
||||
expand("Orders").select("PersonID,Orders/OrderID");
|
||||
|
||||
// create new request
|
||||
ODataEntityRequest<ODataEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
|
||||
queryReq.setFormat(ODataPubFormat.ATOM);
|
||||
|
||||
retrieve.setRequest(queryReq);
|
||||
// -------------------------------------------
|
||||
|
||||
// -------------------------------------------
|
||||
// Add changeset item
|
||||
// -------------------------------------------
|
||||
final ODataChangeset changeset = streamManager.addChangeset();
|
||||
|
||||
// Update Customer into the changeset
|
||||
targetURI = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").appendKeySegment(1);
|
||||
final URI editLink = targetURI.build();
|
||||
|
||||
final ODataEntity patch = client.getObjectFactory().newEntity(
|
||||
new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer"));
|
||||
patch.setEditLink(editLink);
|
||||
|
||||
patch.getProperties().add(client.getObjectFactory().newPrimitiveProperty(
|
||||
"LastName",
|
||||
client.getObjectFactory().newPrimitiveValueBuilder().buildString("new last name")));
|
||||
|
||||
final ODataEntityUpdateRequest changeReq =
|
||||
client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.PATCH, patch);
|
||||
changeReq.setFormat(ODataPubFormat.JSON_FULL_METADATA);
|
||||
|
||||
changeset.addRequest(changeReq);
|
||||
|
||||
// Create Order into the changeset
|
||||
targetURI = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders");
|
||||
final ODataEntity original = newOrder(1000);
|
||||
final ODataEntityCreateRequest<ODataEntity> createReq =
|
||||
client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), original);
|
||||
createReq.setFormat(ODataPubFormat.ATOM);
|
||||
changeset.addRequest(createReq);
|
||||
// -------------------------------------------
|
||||
|
||||
// -------------------------------------------
|
||||
// Add retrieve item
|
||||
// -------------------------------------------
|
||||
retrieve = streamManager.addRetrieve();
|
||||
|
||||
// prepare URI
|
||||
targetURI = client.getURIBuilder(testStaticServiceRootURL).
|
||||
appendEntitySetSegment("Customers").appendKeySegment(1);
|
||||
|
||||
// create new request
|
||||
queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
|
||||
|
||||
retrieve.setRequest(queryReq);
|
||||
// -------------------------------------------
|
||||
|
||||
final ODataBatchResponse response = streamManager.getResponse();
|
||||
assertEquals(200, response.getStatusCode());
|
||||
assertEquals("OK", response.getStatusMessage());
|
||||
final Iterator<ODataBatchResponseItem> iter = response.getBody();
|
||||
|
||||
// retrive the first item (ODataRetrieve)
|
||||
ODataBatchResponseItem item = iter.next();
|
||||
assertTrue(item instanceof ODataRetrieveResponseItem);
|
||||
|
||||
ODataRetrieveResponseItem retitem = (ODataRetrieveResponseItem) item;
|
||||
ODataResponse res = retitem.next();
|
||||
assertTrue(res instanceof ODataEntityResponseImpl);
|
||||
assertEquals(200, res.getStatusCode());
|
||||
assertEquals("OK", res.getStatusMessage());
|
||||
|
||||
ODataEntityRequestImpl<ODataEntity>.ODataEntityResponseImpl entres =
|
||||
(ODataEntityRequestImpl.ODataEntityResponseImpl) res;
|
||||
|
||||
ODataEntity entity = entres.getBody();
|
||||
assertEquals(1, entity.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class), 0);
|
||||
|
||||
// retrieve the second item (ODataChangeset)
|
||||
item = iter.next();
|
||||
assertTrue(item instanceof ODataChangesetResponseItem);
|
||||
|
||||
final ODataChangesetResponseItem chgitem = (ODataChangesetResponseItem) item;
|
||||
res = chgitem.next();
|
||||
assertTrue(res instanceof ODataEntityUpdateResponse);
|
||||
assertEquals(204, res.getStatusCode());
|
||||
assertEquals("No Content", res.getStatusMessage());
|
||||
|
||||
res = chgitem.next();
|
||||
assertTrue(res instanceof ODataEntityCreateResponse);
|
||||
assertEquals(201, res.getStatusCode());
|
||||
assertEquals("Created", res.getStatusMessage());
|
||||
|
||||
final ODataEntityCreateResponse<ODataEntity> createres = (ODataEntityCreateResponse<ODataEntity>) res;
|
||||
entity = createres.getBody();
|
||||
assertEquals(new Integer(1000), entity.getProperty("OrderID").getPrimitiveValue().toCastValue(Integer.class));
|
||||
|
||||
// retrive the third item (ODataRetrieve)
|
||||
item = iter.next();
|
||||
assertTrue(item instanceof ODataRetrieveResponseItem);
|
||||
|
||||
retitem = (ODataRetrieveResponseItem) item;
|
||||
res = retitem.next();
|
||||
assertTrue(res instanceof ODataEntityResponseImpl);
|
||||
assertEquals(200, res.getStatusCode());
|
||||
assertEquals("OK", res.getStatusMessage());
|
||||
|
||||
entres = (ODataEntityRequestImpl.ODataEntityResponseImpl) res;
|
||||
entity = entres.getBody();
|
||||
assertEquals("new last name",
|
||||
entity.getProperty("LastName").getPrimitiveValue().toCastValue(String.class));
|
||||
|
||||
assertFalse(iter.hasNext());
|
||||
}
|
||||
|
||||
private static class TestStreamManager extends AbstractODataStreamManager<ODataBatchResponse> {
|
||||
|
||||
public TestStreamManager() {
|
||||
super(new Wrapper<Future<HttpResponse>>());
|
||||
}
|
||||
|
||||
public ODataStreamManager<ODataBatchResponse> addObject(byte[] src) {
|
||||
stream(src);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ODataBatchResponse getResponse(long timeout, TimeUnit unit) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* To be used for debug purposes.
|
||||
*/
|
||||
private static class StreamingThread extends Thread {
|
||||
|
||||
private final TestStreamManager streaming;
|
||||
|
||||
public StreamingThread(final TestStreamManager streaming) {
|
||||
this.streaming = streaming;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
|
||||
byte[] buff = new byte[1024];
|
||||
|
||||
int len;
|
||||
|
||||
while ((len = streaming.getBody().read(buff)) >= 0) {
|
||||
builder.append(new String(buff, 0, len));
|
||||
}
|
||||
|
||||
assertTrue(builder.toString().startsWith(PREFIX));
|
||||
assertTrue(builder.toString().contains((MAX / 2) + ") send info"));
|
||||
assertTrue(builder.toString().contains((MAX / 3) + ") send info"));
|
||||
assertTrue(builder.toString().contains((MAX / 20) + ") send info"));
|
||||
assertTrue(builder.toString().contains((MAX / 30) + ") send info"));
|
||||
assertTrue(builder.toString().contains(MAX + ") send info"));
|
||||
assertTrue(builder.toString().endsWith(SUFFIX));
|
||||
|
||||
} catch (IOException e) {
|
||||
fail();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class BatchStreamingThread extends Thread {
|
||||
|
||||
private final BatchStreamManager streaming;
|
||||
|
||||
public BatchStreamingThread(final BatchStreamManager streaming) {
|
||||
this.streaming = streaming;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
|
||||
byte[] buff = new byte[1024];
|
||||
|
||||
int len;
|
||||
|
||||
while ((len = streaming.getBody().read(buff)) >= 0) {
|
||||
builder.append(new String(buff, 0, len));
|
||||
}
|
||||
|
||||
LOG.debug("Batch request {}", builder.toString());
|
||||
|
||||
assertTrue(builder.toString().contains("Content-Id:2"));
|
||||
assertTrue(builder.toString().contains("GET " + testStaticServiceRootURL));
|
||||
} catch (IOException e) {
|
||||
fail();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ODataEntity newOrder(final int id) {
|
||||
final ODataEntity order = getClient().getObjectFactory().
|
||||
newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Order"));
|
||||
|
||||
order.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("OrderID",
|
||||
getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(id)));
|
||||
order.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("OrderDate",
|
||||
getClient().getObjectFactory().newPrimitiveValueBuilder().
|
||||
setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(Calendar.getInstance()).build()));
|
||||
order.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("ShelfLife",
|
||||
getClient().getObjectFactory().newPrimitiveValueBuilder().
|
||||
setType(EdmPrimitiveTypeKind.Duration).setText("PT0.0000002S").build()));
|
||||
|
||||
return order;
|
||||
}
|
||||
}
|
|
@ -67,7 +67,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
|
|||
|
||||
assertNotNull(entity);
|
||||
assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString());
|
||||
assertEquals(getServiceRoot() + "/Customers(PersonID=1)", entity.getEditLink().toASCIIString());
|
||||
assertEquals(getServiceRoot() + "/Customers(1)", entity.getEditLink().toASCIIString());
|
||||
|
||||
assertEquals(3, entity.getNavigationLinks().size());
|
||||
|
||||
|
|
Loading…
Reference in New Issue