[12/24] olingo-odata2 git commit: [OLINGO-1253]Client Module for Olingo v2
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/4261deb7/odata2-lib/odata-client-core/src/test/java/org/apache/olingo/odata2/client/core/ep/deserializer/XmlErrorDocumentTest.java -- diff --git a/odata2-lib/odata-client-core/src/test/java/org/apache/olingo/odata2/client/core/ep/deserializer/XmlErrorDocumentTest.java b/odata2-lib/odata-client-core/src/test/java/org/apache/olingo/odata2/client/core/ep/deserializer/XmlErrorDocumentTest.java new file mode 100644 index 000..2a255f1 --- /dev/null +++ b/odata2-lib/odata-client-core/src/test/java/org/apache/olingo/odata2/client/core/ep/deserializer/XmlErrorDocumentTest.java @@ -0,0 +1,281 @@ +/*** + * 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.odata2.client.core.ep.deserializer; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.InputStream; +import java.util.Locale; + +import org.apache.olingo.odata2.api.ep.EntityProviderException; +import org.apache.olingo.odata2.api.processor.ODataErrorContext; +import org.apache.olingo.odata2.client.core.ep.deserializer.XmlErrorDocumentDeserializer; +import org.apache.olingo.odata2.testutil.helper.StringHelper; +import org.junit.Test; + +/** + * + */ +public class XmlErrorDocumentTest extends AbstractDeserializerTest { + + private static final String XML_ERROR_DOCUMENT_SIMPLE = + "\n" + + "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\;>\n" + + "\tErrorCode\n" + + "\tMessage\n" + + ""; + private static final String XML_ERROR_DOCUMENT_NULL_LOCALE = + "\n" + + "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\;>\n" + + "\tErrorCode\n" + + "\tMessage\n" + + ""; + private static final String XML_ERROR_DOCUMENT_INNER_ERROR = + "\n" + + "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\;>\n" + + "\tErrorCode\n" + + "\tMessage\n" + + "Some InnerError\n" + + ""; + private static final String XML_ERROR_DOCUMENT_INNER_ERROR_COMPLEX = + "\n" + + "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\;>\n" + + "\tErrorCode\n" + + "\tMessage\n" + + "" + + "More Inner Error" + + "\n" + + ""; + private static final String XML_ERROR_DOCUMENT_INVALID_XML = + "\n" + + "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\;>\n" + + "\tErrorCode\n" + + "\tMessage\n" + + ""; + /* error document with name 'locale' instead of 'lang' for message object */ + private static final String XML_ERROR_DOCUMENT_UNKNOWN_CONTENT = + "\n" + + "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\;>\n" + + "\tErrorCode\n" + + "\tMessage\n" + + "\tSecret\n" + + ""; + /* error document without value for message object */ + private static final String XML_ERROR_DOCUMENT_EMPTY_MESSAGE = + "\n" + + "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\;>\n" + + "\tErrorCode\n" + + "\t\n" + + ""; + private static final String XML_ERROR_DOCUMENT_MISSING_MESSAGE = + "\n" + + "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\;>\n" + + "\tErrorCode\n" + + ""; + private static final String XML_ERROR_DOCUMENT_MISSING_CODE = + "\n" + + "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\;>\n" + + "\tMessage\n" + + ""; + private static final String XML_ERROR_DOCUMENT_MISSING_ERROR = + "\n" + + "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\;>\n" + + "\tErrorCode\n" + + "\tMessage\n" + + ""; + private XmlErrorDocumentDeserializer xedc = new
[12/24] olingo-odata2 git commit: [OLINGO-1253]Client Module for Olingo v2
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/test/java/org/apache/olingo/odata2/client/core/ep/deserializer/XmlErrorDocumentTest.java -- diff --git a/odata2-lib/odata-client-core/src/test/java/org/apache/olingo/odata2/client/core/ep/deserializer/XmlErrorDocumentTest.java b/odata2-lib/odata-client-core/src/test/java/org/apache/olingo/odata2/client/core/ep/deserializer/XmlErrorDocumentTest.java new file mode 100644 index 000..2a255f1 --- /dev/null +++ b/odata2-lib/odata-client-core/src/test/java/org/apache/olingo/odata2/client/core/ep/deserializer/XmlErrorDocumentTest.java @@ -0,0 +1,281 @@ +/*** + * 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.odata2.client.core.ep.deserializer; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.InputStream; +import java.util.Locale; + +import org.apache.olingo.odata2.api.ep.EntityProviderException; +import org.apache.olingo.odata2.api.processor.ODataErrorContext; +import org.apache.olingo.odata2.client.core.ep.deserializer.XmlErrorDocumentDeserializer; +import org.apache.olingo.odata2.testutil.helper.StringHelper; +import org.junit.Test; + +/** + * + */ +public class XmlErrorDocumentTest extends AbstractDeserializerTest { + + private static final String XML_ERROR_DOCUMENT_SIMPLE = + "\n" + + "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\;>\n" + + "\tErrorCode\n" + + "\tMessage\n" + + ""; + private static final String XML_ERROR_DOCUMENT_NULL_LOCALE = + "\n" + + "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\;>\n" + + "\tErrorCode\n" + + "\tMessage\n" + + ""; + private static final String XML_ERROR_DOCUMENT_INNER_ERROR = + "\n" + + "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\;>\n" + + "\tErrorCode\n" + + "\tMessage\n" + + "Some InnerError\n" + + ""; + private static final String XML_ERROR_DOCUMENT_INNER_ERROR_COMPLEX = + "\n" + + "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\;>\n" + + "\tErrorCode\n" + + "\tMessage\n" + + "" + + "More Inner Error" + + "\n" + + ""; + private static final String XML_ERROR_DOCUMENT_INVALID_XML = + "\n" + + "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\;>\n" + + "\tErrorCode\n" + + "\tMessage\n" + + ""; + /* error document with name 'locale' instead of 'lang' for message object */ + private static final String XML_ERROR_DOCUMENT_UNKNOWN_CONTENT = + "\n" + + "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\;>\n" + + "\tErrorCode\n" + + "\tMessage\n" + + "\tSecret\n" + + ""; + /* error document without value for message object */ + private static final String XML_ERROR_DOCUMENT_EMPTY_MESSAGE = + "\n" + + "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\;>\n" + + "\tErrorCode\n" + + "\t\n" + + ""; + private static final String XML_ERROR_DOCUMENT_MISSING_MESSAGE = + "\n" + + "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\;>\n" + + "\tErrorCode\n" + + ""; + private static final String XML_ERROR_DOCUMENT_MISSING_CODE = + "\n" + + "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\;>\n" + + "\tMessage\n" + + ""; + private static final String XML_ERROR_DOCUMENT_MISSING_ERROR = + "\n" + + "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\;>\n" + + "\tErrorCode\n" + + "\tMessage\n" + + ""; + private XmlErrorDocumentDeserializer xedc = new