diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ObjectWrapper.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ObjectWrapper.java deleted file mode 100644 index 06376196b..000000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ObjectWrapper.java +++ /dev/null @@ -1,150 +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.client.core.communication.request.retrieve; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import org.apache.commons.io.IOUtils; -import org.apache.olingo.client.api.data.ODataError; -import org.apache.olingo.client.api.domain.ODataEntity; -import org.apache.olingo.client.api.domain.ODataEntitySet; -import org.apache.olingo.client.api.domain.ODataEntitySetIterator; -import org.apache.olingo.client.api.domain.ODataLinkCollection; -import org.apache.olingo.client.api.domain.ODataProperty; -import org.apache.olingo.client.api.domain.ODataServiceDocument; -import org.apache.olingo.client.api.domain.ODataValue; -import org.apache.olingo.client.api.edm.xml.XMLMetadata; -import org.apache.olingo.client.api.op.ODataReader; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ObjectWrapper { - - /** - * Logger. - */ - private static final Logger LOG = LoggerFactory.getLogger(ObjectWrapper.class); - - private final ODataReader reader; - - private final byte[] obj; - - private final String format; - - /** - * Constructor. - * - * @param is source input stream. - * @param format source format (ODataPubFormat, ODataFormat, ODataValueFormat, - * ODataServiceDocumentFormat). - */ - public ObjectWrapper(final ODataReader reader, final InputStream is, final String format) { - this.reader = reader; - try { - this.obj = IOUtils.toByteArray(is); - this.format = format; - } catch (IOException e) { - throw new IllegalArgumentException(e); - } - } - - /** - * Parses stream as ODataEntitySetIterator. - * - * I - * - * @return ODataEntitySetIterator if success; null otherwise. - */ - public ODataEntitySetIterator getODataEntitySetIterator() { - return reader.read(new ByteArrayInputStream(obj), format, ODataEntitySetIterator.class); - } - - /** - * Parses stream as ODataEntitySet. - * - * @return ODataEntitySet if success; null otherwise. - */ - public ODataEntitySet getODataEntitySet() { - return reader.read(new ByteArrayInputStream(obj), format, ODataEntitySet.class); - } - - /** - * Parses stream as ODataEntity. - * - * @return ODataEntity if success; null otherwise. - */ - public ODataEntity getODataEntity() { - return reader.read(new ByteArrayInputStream(obj), format, ODataEntity.class); - } - - /** - * Parses stream as ODataProperty. - * - * @return ODataProperty if success; null otherwise. - */ - public ODataProperty getODataProperty() { - return reader.read(new ByteArrayInputStream(obj), format, ODataProperty.class); - } - - /** - * Parses stream as ODataLinkCollection. - * - * @return ODataLinkCollection if success; null otherwise. - */ - public ODataLinkCollection getODataLinkCollection() { - return reader.read(new ByteArrayInputStream(obj), format, ODataLinkCollection.class); - } - - /** - * Parses stream as ODataValue. - * - * @return ODataValue if success; null otherwise. - */ - public ODataValue getODataValue() { - return reader.read(new ByteArrayInputStream(obj), format, ODataValue.class); - } - - /** - * Parses stream as EdmMetadata. - * - * @return EdmMetadata if success; null otherwise. - */ - public XMLMetadata getEdmMetadata() { - return reader.read(new ByteArrayInputStream(obj), null, XMLMetadata.class); - } - - /** - * Parses stream as ODataServiceDocument. - * - * @return ODataServiceDocument if success; null otherwise. - */ - public ODataServiceDocument getODataServiceDocument() { - return reader.read(new ByteArrayInputStream(obj), format, ODataServiceDocument.class); - } - - /** - * Parses stream as ODataError. - * - * @return ODataError if success; null otherwise. - */ - public ODataError getODataError() { - return reader.read(new ByteArrayInputStream(obj), null, ODataError.class); - } -} diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java index 15c55a5f5..a05562b6d 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java @@ -30,7 +30,6 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRe import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest; import org.apache.olingo.client.api.communication.response.ODataRawResponse; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; -import org.apache.olingo.client.core.communication.request.retrieve.ObjectWrapper; import org.apache.olingo.client.api.domain.ODataEntity; import org.apache.olingo.client.api.domain.ODataEntitySet; import org.apache.olingo.client.api.domain.ODataInlineEntity; @@ -152,7 +151,7 @@ public class EntityRetrieveTestITCase extends AbstractV3TestITCase { final ODataRawResponse res = req.execute(); assertNotNull(res); - + final ODataEntitySet entitySet = res.getBodyAs(ODataEntitySet.class); assertNull(entitySet);