aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/test/java/com/yahoo
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-01-27 14:07:45 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2023-01-27 14:07:45 +0100
commit75ab63c8dea02c4e8148fb7e79730d163eb6647e (patch)
treeb2557fc192f6faff27066fddb1b7692c9d06cc93 /document/src/test/java/com/yahoo
parentb6e493d2eba1e35bd07de4eb380299e2d21ec1bc (diff)
Deprecate xml methods
Diffstat (limited to 'document/src/test/java/com/yahoo')
-rw-r--r--document/src/test/java/com/yahoo/document/DocumentTestCase.java18
-rw-r--r--document/src/test/java/com/yahoo/document/annotation/Bug6394548TestCase.java2
-rw-r--r--document/src/test/java/com/yahoo/document/datatypes/PredicateFieldValueTest.java3
-rw-r--r--document/src/test/java/com/yahoo/document/datatypes/StructTestCase.java1
-rw-r--r--document/src/test/java/com/yahoo/document/serialization/XmlDocumentWriterTestCase.java29
-rw-r--r--document/src/test/java/com/yahoo/document/serialization/XmlStreamTestCase.java4
6 files changed, 11 insertions, 46 deletions
diff --git a/document/src/test/java/com/yahoo/document/DocumentTestCase.java b/document/src/test/java/com/yahoo/document/DocumentTestCase.java
index f1c74ad6efc..33b77cb1878 100644
--- a/document/src/test/java/com/yahoo/document/DocumentTestCase.java
+++ b/document/src/test/java/com/yahoo/document/DocumentTestCase.java
@@ -20,7 +20,6 @@ import com.yahoo.document.datatypes.WeightedSet;
import com.yahoo.document.serialization.DocumentDeserializerFactory;
import com.yahoo.document.serialization.DocumentReader;
import com.yahoo.document.serialization.DocumentSerializerFactory;
-import com.yahoo.document.serialization.XmlDocumentWriter;
import com.yahoo.io.GrowableByteBuffer;
import com.yahoo.vespa.objects.BufferSerializer;
import org.junit.Test;
@@ -920,6 +919,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
}
@Test
+ @SuppressWarnings("deprecation")
public void testToXml() {
setUpSertestDocType();
Document doc = getSertestDocument();
@@ -935,19 +935,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
}
@Test
- public void testXmlSerializer() {
- setUpSertestDocType();
- Document doc = getSertestDocument();
- doc.setFieldValue("mailid", "emailfromalicetobob&someone");
- doc.setFieldValue("myposfield", PositionDataType.valueOf(-122057174, 37374821));
- String xml = doc.toXML(" ");
- XmlDocumentWriter w = XmlDocumentWriter.createWriter(" ");
- w.write(doc);
- String otherXml = doc.toXML(" ");
- assertEquals(xml, otherXml);
- }
-
- @Test
+ @SuppressWarnings("deprecation")
public void testSingleFieldToXml() {
Document doc = new Document(docMan.getDocumentType("testdoc"), new DocumentId("id:ns:testdoc::xmltest"));
doc.setFieldValue("stringattr", new StringFieldValue("hello world"));
@@ -955,6 +943,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
}
@Test
+ @SuppressWarnings("deprecation")
public void testDelegatedDocumentToXml() {
Document doc = new Document(docMan.getDocumentType("testdoc"), new DocumentId("id:ns:testdoc::xmltest"));
doc.setFieldValue("stringattr", new StringFieldValue("hello universe"));
@@ -1159,6 +1148,7 @@ public class DocumentTestCase extends DocumentTestCaseBase {
}
@Test
+ @SuppressWarnings("deprecation")
public void testDocumentComparisonDoesNotCorruptStateBug6394548() {
DocumentTypeManager docMan = new DocumentTypeManager();
DocumentType docType = new DocumentType("bug2354045");
diff --git a/document/src/test/java/com/yahoo/document/annotation/Bug6394548TestCase.java b/document/src/test/java/com/yahoo/document/annotation/Bug6394548TestCase.java
index 3ec858062be..424fd0018c8 100644
--- a/document/src/test/java/com/yahoo/document/annotation/Bug6394548TestCase.java
+++ b/document/src/test/java/com/yahoo/document/annotation/Bug6394548TestCase.java
@@ -17,6 +17,7 @@ import static org.junit.Assert.*;
public class Bug6394548TestCase {
@Test
+ @SuppressWarnings("deprecation")
public void testSerializeAndDeserializeMultipleAdjacentStructAnnotations() {
DocumentTypeManager manager = new DocumentTypeManager();
var sub = DocumentTypeManagerConfigurer.configure
@@ -65,6 +66,7 @@ public class Bug6394548TestCase {
assertEquals(annotationsBefore, annotationsAfter);
}
+ @SuppressWarnings("deprecation")
private String dumpAllAnnotations(SpanTree tree) {
ArrayList<String> tmp = new ArrayList<>();
for (Annotation anno : tree) {
diff --git a/document/src/test/java/com/yahoo/document/datatypes/PredicateFieldValueTest.java b/document/src/test/java/com/yahoo/document/datatypes/PredicateFieldValueTest.java
index 95bdf8f4bc4..c77ad8493c9 100644
--- a/document/src/test/java/com/yahoo/document/datatypes/PredicateFieldValueTest.java
+++ b/document/src/test/java/com/yahoo/document/datatypes/PredicateFieldValueTest.java
@@ -53,6 +53,7 @@ public class PredicateFieldValueTest {
}
@Test
+ @SuppressWarnings("deprecation")
public void requireThatXmlOutputIsEmptyForNullPredicate() {
XmlStream expected = new XmlStream();
expected.beginTag("tag");
@@ -61,6 +62,7 @@ public class PredicateFieldValueTest {
}
@Test
+ @SuppressWarnings("deprecation")
public void requireThatXmlOutputIsPredicateLanguage() {
Predicate predicate = new FeatureSet("key", "valueA", "valueB");
XmlStream expected = new XmlStream();
@@ -181,6 +183,7 @@ public class PredicateFieldValueTest {
assertTrue(lhs.equals(rhs));
}
+ @SuppressWarnings("deprecation")
private static String printXml(String tag, FieldValue value) {
XmlStream out = new XmlStream();
out.beginTag(tag);
diff --git a/document/src/test/java/com/yahoo/document/datatypes/StructTestCase.java b/document/src/test/java/com/yahoo/document/datatypes/StructTestCase.java
index ea066ff4ffd..06875b8ca3c 100644
--- a/document/src/test/java/com/yahoo/document/datatypes/StructTestCase.java
+++ b/document/src/test/java/com/yahoo/document/datatypes/StructTestCase.java
@@ -248,6 +248,7 @@ public class StructTestCase {
}
@Test
+ @SuppressWarnings("deprecation")
public void testCompareToDoesNotMutateStateBug6394548() {
StructDataType type = new StructDataType("test");
// NOTE: non-increasing ID order!
diff --git a/document/src/test/java/com/yahoo/document/serialization/XmlDocumentWriterTestCase.java b/document/src/test/java/com/yahoo/document/serialization/XmlDocumentWriterTestCase.java
deleted file mode 100644
index b291d3e784d..00000000000
--- a/document/src/test/java/com/yahoo/document/serialization/XmlDocumentWriterTestCase.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.document.serialization;
-
-import com.yahoo.document.DataType;
-import com.yahoo.document.Document;
-import com.yahoo.document.DocumentType;
-import com.yahoo.document.Field;
-import com.yahoo.document.datatypes.PredicateFieldValue;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-/**
- * @author Simon Thoresen Hult
- */
-public class XmlDocumentWriterTestCase {
-
- @Test
- public void requireThatPredicateFieldValuesAreSerializedAsString() {
- DocumentType docType = new DocumentType("my_type");
- Field field = new Field("my_predicate", DataType.PREDICATE);
- docType.addField(field);
- Document doc = new Document(docType, "id:ns:my_type::");
- PredicateFieldValue predicate = Mockito.mock(PredicateFieldValue.class);
- doc.setFieldValue("my_predicate", predicate);
-
- new XmlDocumentWriter().write(doc);
- Mockito.verify(predicate, Mockito.times(1)).printXml(Mockito.any(XmlStream.class));
- }
-}
diff --git a/document/src/test/java/com/yahoo/document/serialization/XmlStreamTestCase.java b/document/src/test/java/com/yahoo/document/serialization/XmlStreamTestCase.java
index afe08aeb2d6..4a66b562f35 100644
--- a/document/src/test/java/com/yahoo/document/serialization/XmlStreamTestCase.java
+++ b/document/src/test/java/com/yahoo/document/serialization/XmlStreamTestCase.java
@@ -1,11 +1,8 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.document.serialization;
-import com.yahoo.document.serialization.XmlStream;
import org.junit.Test;
-import java.io.IOException;
-
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -14,6 +11,7 @@ import static org.junit.Assert.assertTrue;
*
* @author HÃ¥kon Humberset
*/
+@Deprecated
public class XmlStreamTestCase {
/** A catch all test checking that regular usage looks good. */