Skip to content

Commit de7a0b5

Browse files
committed
Merge branch 'renovate/com.google.cloud-native-image-shared-config-1.x' of https://github.com/renovate-bot/google-http-java-client into renovate/com.google.cloud-native-image-shared-config-1.x
2 parents 35543d3 + 715fc0d commit de7a0b5

File tree

7 files changed

+271
-174
lines changed

7 files changed

+271
-174
lines changed

google-http-client-xml/src/test/java/com/google/api/client/xml/AtomTest.java

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import java.util.List;
3333
import org.junit.Assert;
3434
import org.junit.Test;
35+
import org.junit.runner.RunWith;
36+
import org.junit.runners.JUnit4;
3537
import org.xmlpull.v1.XmlPullParser;
3638

3739
/**
@@ -40,20 +42,25 @@
4042
* @author Yaniv Inbar
4143
* @author Gerald Madlmayr
4244
*/
45+
@RunWith(JUnit4.class)
4346
public class AtomTest {
4447

45-
private static final String SAMPLE_FEED =
46-
"<?xml version=\"1.0\" encoding=\"utf-8\"?><feed "
47-
+ "xmlns=\"http://www.w3.org/2005/Atom\"> <title>Example Feed</title> <link href"
48-
+ "=\"http://example.org/\"/> <updated>2003-12-13T18:31:02Z</updated> <author> "
49-
+ "<name>John Doe</name> </author> <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6"
50-
+ "</id> <entry> <title>Atom-Powered Robots Run Amok</title> <link href=\"http"
51-
+ "://example.org/2003/12/13/atom03\"/> <id>urn:uuid:1225c695-cfb8-4ebb-aaaa"
52-
+ "-80da344efa6a</id> <updated>2003-12-13T18:30:02Z</updated> <summary>Some text"
53-
+ ".</summary> </entry><entry> <title>Atom-Powered Robots Run Amok!</title> <link"
54-
+ " href=\"http://example.org/2003/12/13/atom02\"/> <id>urn:uuid:1225c695-cfb8-4ebb"
55-
+ "-aaaa-80da344efa62</id> <updated>2003-12-13T18:32:02Z</updated> <summary>Some "
56-
+ "other text.</summary> </entry></feed>";
48+
private static final String SAMPLE_FEED;
49+
50+
static {
51+
SAMPLE_FEED =
52+
"<?xml version=\"1.0\" encoding=\"utf-8\"?><feed "
53+
+ "xmlns=\"http://www.w3.org/2005/Atom\"> <title>Example Feed</title> <link href"
54+
+ "=\"http://example.org/\"/> <updated>2003-12-13T18:31:02Z</updated> <author> "
55+
+ "<name>John Doe</name> </author> <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6"
56+
+ "</id> <entry> <title>Atom-Powered Robots Run Amok</title> <link href=\"http"
57+
+ "://example.org/2003/12/13/atom03\"/> <id>urn:uuid:1225c695-cfb8-4ebb-aaaa"
58+
+ "-80da344efa6a</id> <updated>2003-12-13T18:30:02Z</updated> <summary>Some text"
59+
+ ".</summary> </entry><entry> <title>Atom-Powered Robots Run Amok!</title> <link"
60+
+ " href=\"http://example.org/2003/12/13/atom02\"/> <id>urn:uuid:1225c695-cfb8-4ebb"
61+
+ "-aaaa-80da344efa62</id> <updated>2003-12-13T18:32:02Z</updated> <summary>Some "
62+
+ "other text.</summary> </entry></feed>";
63+
}
5764

5865
/** Test for checking the Slug Header */
5966
@Test

google-http-client-xml/src/test/java/com/google/api/client/xml/GenericXmlListTest.java

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import java.util.ArrayList;
2525
import java.util.Collection;
2626
import org.junit.Test;
27+
import org.junit.runner.RunWith;
28+
import org.junit.runners.JUnit4;
2729
import org.xmlpull.v1.XmlPullParser;
2830
import org.xmlpull.v1.XmlSerializer;
2931

@@ -35,30 +37,35 @@
3537
*
3638
* @author Gerald Madlmayr
3739
*/
40+
@RunWith(JUnit4.class)
3841
public class GenericXmlListTest {
3942

40-
private static final String MULTI_TYPE_WITH_CLASS_TYPE =
41-
"<?xml version=\"1.0\"?><any "
42-
+ "xmlns=\"http://www.w3.org/2005/Atom\"><rep><elem>content1</elem><rep>rep10</rep><rep>"
43-
+ "rep11</rep><value>value1</value></rep><rep><elem>content2</elem><rep>rep20</rep><rep>rep21"
44-
+ "</rep><value>value2</value></rep><rep><elem>content3</elem><rep>rep30</rep><rep>rep31"
45-
+ "</rep><value>value3</value></rep></any>";
46-
private static final String MULTIPLE_STRING_ELEMENT =
47-
"<?xml version=\"1.0\"?><any xmlns"
48-
+ "=\"http://www.w3.org/2005/Atom\"><rep>rep1</rep><rep>rep2</rep></any>";
49-
private static final String MULTIPLE_INTEGER_ELEMENT =
50-
"<?xml version=\"1.0\"?><any xmlns"
51-
+ "=\"http://www.w3.org/2005/Atom\"><rep>1</rep><rep>2</rep></any>";
52-
private static final String ARRAY_TYPE_WITH_PRIMITIVE_ADDED_NESTED =
53-
"<?xml version=\"1.0"
54-
+ "\"?><any xmlns=\"http://www.w3.org/2005/Atom\"><rep>1<nested>something</nested></rep"
55-
+ "><rep>2</rep></any>";
56-
private static final String MULTIPLE_ENUM_ELEMENT =
57-
"<?xml version=\"1.0\"?><any xmlns"
58-
+ "=\"http://www.w3.org/2005/Atom\"><rep>ENUM_1</rep><rep>ENUM_2</rep></any>";
59-
private static final String COLLECTION_OF_ARRAY =
60-
"<?xml version=\"1.0\"?><any xmlns"
61-
+ "=\"http://www.w3.org/2005/Atom\"><rep><a>a</a><b>b</b></rep><rep><c>c</c><d>d</d></rep></any>";
43+
private static final String MULTI_TYPE_WITH_CLASS_TYPE;
44+
private static final String MULTIPLE_STRING_ELEMENT;
45+
private static final String MULTIPLE_INTEGER_ELEMENT;
46+
private static final String MULTIPLE_ENUM_ELEMENT;
47+
private static final String COLLECTION_OF_ARRAY;
48+
49+
static {
50+
MULTI_TYPE_WITH_CLASS_TYPE =
51+
"<?xml version=\"1.0\"?><any "
52+
+ "xmlns=\"http://www.w3.org/2005/Atom\"><rep><elem>content1</elem><rep>rep10</rep><rep>"
53+
+ "rep11</rep><value>value1</value></rep><rep><elem>content2</elem><rep>rep20</rep><rep>rep21"
54+
+ "</rep><value>value2</value></rep><rep><elem>content3</elem><rep>rep30</rep><rep>rep31"
55+
+ "</rep><value>value3</value></rep></any>";
56+
MULTIPLE_STRING_ELEMENT =
57+
"<?xml version=\"1.0\"?><any xmlns"
58+
+ "=\"http://www.w3.org/2005/Atom\"><rep>rep1</rep><rep>rep2</rep></any>";
59+
MULTIPLE_INTEGER_ELEMENT =
60+
"<?xml version=\"1.0\"?><any xmlns"
61+
+ "=\"http://www.w3.org/2005/Atom\"><rep>1</rep><rep>2</rep></any>";
62+
MULTIPLE_ENUM_ELEMENT =
63+
"<?xml version=\"1.0\"?><any xmlns"
64+
+ "=\"http://www.w3.org/2005/Atom\"><rep>ENUM_1</rep><rep>ENUM_2</rep></any>";
65+
COLLECTION_OF_ARRAY =
66+
"<?xml version=\"1.0\"?><any xmlns"
67+
+ "=\"http://www.w3.org/2005/Atom\"><rep><a>a</a><b>b</b></rep><rep><c>c</c><d>d</d></rep></any>";
68+
}
6269

6370
/** The purpose of this test is to map an XML with an Array of {@link XmlTest.AnyType} objects. */
6471
@SuppressWarnings("unchecked")

google-http-client-xml/src/test/java/com/google/api/client/xml/GenericXmlTest.java

Lines changed: 46 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
import java.util.List;
2929
import java.util.Map;
3030
import org.junit.Test;
31+
import org.junit.runner.RunWith;
32+
import org.junit.runners.JUnit4;
3133
import org.xmlpull.v1.XmlPullParser;
3234
import org.xmlpull.v1.XmlPullParserException;
3335
import org.xmlpull.v1.XmlSerializer;
@@ -41,39 +43,52 @@
4143
* @author Yaniv Inbar
4244
* @author Gerald Madlmayr
4345
*/
46+
@RunWith(JUnit4.class)
4447
public class GenericXmlTest {
4548

46-
private static final String XML =
47-
"<?xml version=\"1.0\"?><feed xmlns=\"http://www.w3.org"
48-
+ "/2005/Atom\" xmlns:gd=\"http://schemas.google.com/g/2005\"><atom:entry xmlns=\"http"
49-
+ "://schemas.google.com/g/2005\" xmlns:atom=\"http://www.w3.org/2005/Atom\" gd:etag"
50-
+ "=\"abc\"><atom:title>One</atom:title></atom:entry><entry gd:etag=\"def\"><title "
51-
+ "attribute=\"someattribute\">Two</title></entry></feed>";
52-
private static final String ANY_GENERIC_TYPE_XML =
53-
"<?xml version=\"1.0\"?><any attr=\"value\" "
54-
+ "xmlns=\"http://www.w3.org/2005/Atom\"><elem><rep attr=\"param1\">rep1</rep><rep "
55-
+ "attr=\"param2\">rep2</rep><value>content</value></elem></any>";
56-
private static final String SIMPLE_XML = "<any>test</any>";
57-
private static final String SIMPLE_XML_NUMERIC = "<any>1</any>";
58-
private static final String ANY_TYPE_XML =
59-
"<?xml version=\"1.0\"?><any attr=\"value\" "
60-
+ "xmlns=\"http://www.w3.org/2005/Atom\"><elem>content</elem><rep>rep1</rep><rep>rep2</rep"
61-
+ "><value>content</value></any>";
62-
private static final String ANY_TYPE_XML_PRIMITIVE_INT =
63-
"<?xml version=\"1.0\"?><any attr"
64-
+ "=\"2\" xmlns=\"http://www.w3.org/2005/Atom\">1<intArray>1</intArray><intArray>2"
65-
+ "</intArray></any>";
66-
private static final String ANY_TYPE_XML_PRIMITIVE_STR =
67-
"<?xml version=\"1.0\"?><any attr"
68-
+ "=\"2+1\" xmlns=\"http://www.w3.org/2005/Atom\">1+1<strArray>1+1</strArray><strArray>2"
69-
+ "+1</strArray></any>";
70-
private static final String ALL_TYPE =
71-
"<?xml version=\"1.0\"?><any xmlns=\"\"><integer"
72-
+ "/><str/><genericXml/><anyEnum/><stringArray/><integerCollection/></any>";
73-
private static final String ANY_TYPE_XML_NESTED_ARRAY =
74-
"<?xml version=\"1.0\"?><any attr"
75-
+ "=\"value\" xmlns=\"http://www.w3.org/2005/Atom\"><elem>content</elem><rep><p>rep1</p"
76-
+ "><p>rep2</p></rep><rep><p>rep3</p><p>rep4</p></rep><value>content</value></any>";
49+
private static final String XML;
50+
private static final String ANY_GENERIC_TYPE_XML;
51+
private static final String SIMPLE_XML;
52+
private static final String SIMPLE_XML_NUMERIC;
53+
private static final String ANY_TYPE_XML;
54+
private static final String ANY_TYPE_XML_PRIMITIVE_INT;
55+
private static final String ANY_TYPE_XML_PRIMITIVE_STR;
56+
private static final String ALL_TYPE;
57+
private static final String ANY_TYPE_XML_NESTED_ARRAY;
58+
59+
static {
60+
XML =
61+
"<?xml version=\"1.0\"?><feed xmlns=\"http://www.w3.org"
62+
+ "/2005/Atom\" xmlns:gd=\"http://schemas.google.com/g/2005\"><atom:entry xmlns=\"http"
63+
+ "://schemas.google.com/g/2005\" xmlns:atom=\"http://www.w3.org/2005/Atom\" gd:etag"
64+
+ "=\"abc\"><atom:title>One</atom:title></atom:entry><entry gd:etag=\"def\"><title "
65+
+ "attribute=\"someattribute\">Two</title></entry></feed>";
66+
ANY_GENERIC_TYPE_XML =
67+
"<?xml version=\"1.0\"?><any attr=\"value\" "
68+
+ "xmlns=\"http://www.w3.org/2005/Atom\"><elem><rep attr=\"param1\">rep1</rep><rep "
69+
+ "attr=\"param2\">rep2</rep><value>content</value></elem></any>";
70+
SIMPLE_XML = "<any>test</any>";
71+
SIMPLE_XML_NUMERIC = "<any>1</any>";
72+
ANY_TYPE_XML =
73+
"<?xml version=\"1.0\"?><any attr=\"value\" "
74+
+ "xmlns=\"http://www.w3.org/2005/Atom\"><elem>content</elem><rep>rep1</rep><rep>rep2</rep"
75+
+ "><value>content</value></any>";
76+
ANY_TYPE_XML_PRIMITIVE_INT =
77+
"<?xml version=\"1.0\"?><any attr"
78+
+ "=\"2\" xmlns=\"http://www.w3.org/2005/Atom\">1<intArray>1</intArray><intArray>2"
79+
+ "</intArray></any>";
80+
ANY_TYPE_XML_PRIMITIVE_STR =
81+
"<?xml version=\"1.0\"?><any attr"
82+
+ "=\"2+1\" xmlns=\"http://www.w3.org/2005/Atom\">1+1<strArray>1+1</strArray><strArray>2"
83+
+ "+1</strArray></any>";
84+
ALL_TYPE =
85+
"<?xml version=\"1.0\"?><any xmlns=\"\"><integer"
86+
+ "/><str/><genericXml/><anyEnum/><stringArray/><integerCollection/></any>";
87+
ANY_TYPE_XML_NESTED_ARRAY =
88+
"<?xml version=\"1.0\"?><any attr"
89+
+ "=\"value\" xmlns=\"http://www.w3.org/2005/Atom\"><elem>content</elem><rep><p>rep1</p"
90+
+ "><p>rep2</p></rep><rep><p>rep3</p><p>rep4</p></rep><value>content</value></any>";
91+
}
7792

7893
public GenericXmlTest() {}
7994

google-http-client-xml/src/test/java/com/google/api/client/xml/XmlEnumTest.java

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
import java.io.StringReader;
2626
import java.util.ArrayList;
2727
import org.junit.Test;
28+
import org.junit.runner.RunWith;
29+
import org.junit.runners.JUnit4;
2830
import org.xmlpull.v1.XmlPullParser;
2931
import org.xmlpull.v1.XmlSerializer;
3032

@@ -33,25 +35,34 @@
3335
*
3436
* @author Gerald Madlmayr
3537
*/
38+
@RunWith(JUnit4.class)
3639
public class XmlEnumTest {
3740

38-
private static final String XML =
39-
"<?xml version=\"1.0\"?><any anyEnum=\"ENUM_1\" attr"
40-
+ "=\"value\" xmlns=\"http://www.w3.org/2005/Atom\"><anotherEnum>ENUM_2</anotherEnum"
41-
+ "><elem>content</elem><rep>rep1</rep><rep>rep2</rep><value>ENUM_1</value></any>";
42-
private static final String XML_ENUM_ELEMENT_ONLY =
43-
"<?xml version=\"1.0\"?><any xmlns"
44-
+ "=\"http://www.w3.org/2005/Atom\"><elementEnum>ENUM_2</elementEnum></any>";
45-
private static final String XML_ENUM_ATTRIBUTE_ONLY =
46-
"<?xml version=\"1.0\"?><any "
47-
+ "attributeEnum=\"ENUM_1\" xmlns=\"http://www.w3.org/2005/Atom\" />";
48-
private static final String XML_ENUM_INCORRECT =
49-
"<?xml version=\"1.0\"?><any xmlns=\"http"
50-
+ "://www.w3.org/2005/Atom\"><elementEnum>ENUM_3</elementEnum></any>";
51-
private static final String XML_ENUM_ELEMENT_ONLY_NESTED =
52-
"<?xml version=\"1.0\"?><any "
53-
+ "xmlns=\"http://www.w3.org/2005/Atom\"><elementEnum>ENUM_2<nested>something</nested"
54-
+ "></elementEnum></any>";
41+
private static final String XML;
42+
private static final String XML_ENUM_ELEMENT_ONLY;
43+
private static final String XML_ENUM_ATTRIBUTE_ONLY;
44+
private static final String XML_ENUM_INCORRECT;
45+
private static final String XML_ENUM_ELEMENT_ONLY_NESTED;
46+
47+
static {
48+
XML =
49+
"<?xml version=\"1.0\"?><any anyEnum=\"ENUM_1\" attr"
50+
+ "=\"value\" xmlns=\"http://www.w3.org/2005/Atom\"><anotherEnum>ENUM_2</anotherEnum"
51+
+ "><elem>content</elem><rep>rep1</rep><rep>rep2</rep><value>ENUM_1</value></any>";
52+
XML_ENUM_ELEMENT_ONLY =
53+
"<?xml version=\"1.0\"?><any xmlns"
54+
+ "=\"http://www.w3.org/2005/Atom\"><elementEnum>ENUM_2</elementEnum></any>";
55+
XML_ENUM_ATTRIBUTE_ONLY =
56+
"<?xml version=\"1.0\"?><any "
57+
+ "attributeEnum=\"ENUM_1\" xmlns=\"http://www.w3.org/2005/Atom\" />";
58+
XML_ENUM_INCORRECT =
59+
"<?xml version=\"1.0\"?><any xmlns=\"http"
60+
+ "://www.w3.org/2005/Atom\"><elementEnum>ENUM_3</elementEnum></any>";
61+
XML_ENUM_ELEMENT_ONLY_NESTED =
62+
"<?xml version=\"1.0\"?><any "
63+
+ "xmlns=\"http://www.w3.org/2005/Atom\"><elementEnum>ENUM_2<nested>something</nested"
64+
+ "></elementEnum></any>";
65+
}
5566

5667
@Test
5768
public void testParseAnyType() throws Exception {

google-http-client-xml/src/test/java/com/google/api/client/xml/XmlListTest.java

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import java.util.ArrayList;
2525
import java.util.Collection;
2626
import org.junit.Test;
27+
import org.junit.runner.RunWith;
28+
import org.junit.runners.JUnit4;
2729
import org.xmlpull.v1.XmlPullParser;
2830
import org.xmlpull.v1.XmlSerializer;
2931

@@ -32,30 +34,40 @@
3234
*
3335
* @author Gerald Madlmayr
3436
*/
37+
@RunWith(JUnit4.class)
3538
public class XmlListTest {
3639

37-
private static final String MULTI_TYPE_WITH_CLASS_TYPE =
38-
"<?xml version=\"1.0\"?><any "
39-
+ "xmlns=\"http://www.w3.org/2005/Atom\"><rep><elem>content1</elem><rep>rep10</rep><rep"
40-
+ ">rep11</rep><value>value1</value></rep><rep><elem>content2</elem><rep>rep20</rep><rep"
41-
+ ">rep21</rep><value>value2</value></rep><rep><elem>content3</elem><rep>rep30</rep><rep"
42-
+ ">rep31</rep><value>value3</value></rep></any>";
43-
private static final String MULTIPLE_STRING_ELEMENT =
44-
"<?xml version=\"1.0\"?><any xmlns"
45-
+ "=\"http://www.w3.org/2005/Atom\"><rep>rep1</rep><rep>rep2</rep></any>";
46-
private static final String MULTIPLE_STRING_ELEMENT_IN_COLLECTION =
47-
"<?xml version=\"1.0"
48-
+ "\"?><any xmlns=\"http://www.w3.org/2005/Atom\"><coll><rep>rep1</rep><rep>rep2</rep"
49-
+ "></coll></any>";
50-
private static final String MULTIPLE_INTEGER_ELEMENT =
51-
"<?xml version=\"1.0\"?><any xmlns"
52-
+ "=\"http://www.w3.org/2005/Atom\"><rep>1</rep><rep>2</rep></any>";
53-
private static final String MULTIPLE_ENUM_ELEMENT =
54-
"<?xml version=\"1.0\"?><any xmlns"
55-
+ "=\"http://www.w3.org/2005/Atom\"><rep>ENUM_1</rep><rep>ENUM_2</rep></any>";
56-
private static final String COLLECTION_OF_ARRAY =
57-
"<?xml version=\"1.0\"?><any xmlns"
58-
+ "=\"http://www.w3.org/2005/Atom\"><rep><a>a</a><b>b</b></rep><rep><c>c</c><d>d</d></rep></any>";
40+
private static final String MULTI_TYPE_WITH_CLASS_TYPE;
41+
private static final String MULTIPLE_STRING_ELEMENT;
42+
private static final String MULTIPLE_STRING_ELEMENT_IN_COLLECTION;
43+
private static final String MULTIPLE_INTEGER_ELEMENT;
44+
private static final String MULTIPLE_ENUM_ELEMENT;
45+
private static final String COLLECTION_OF_ARRAY;
46+
47+
static {
48+
MULTI_TYPE_WITH_CLASS_TYPE =
49+
"<?xml version=\"1.0\"?><any "
50+
+ "xmlns=\"http://www.w3.org/2005/Atom\"><rep><elem>content1</elem><rep>rep10</rep><rep"
51+
+ ">rep11</rep><value>value1</value></rep><rep><elem>content2</elem><rep>rep20</rep><rep"
52+
+ ">rep21</rep><value>value2</value></rep><rep><elem>content3</elem><rep>rep30</rep><rep"
53+
+ ">rep31</rep><value>value3</value></rep></any>";
54+
MULTIPLE_STRING_ELEMENT =
55+
"<?xml version=\"1.0\"?><any xmlns"
56+
+ "=\"http://www.w3.org/2005/Atom\"><rep>rep1</rep><rep>rep2</rep></any>";
57+
MULTIPLE_STRING_ELEMENT_IN_COLLECTION =
58+
"<?xml version=\"1.0"
59+
+ "\"?><any xmlns=\"http://www.w3.org/2005/Atom\"><coll><rep>rep1</rep><rep>rep2</rep"
60+
+ "></coll></any>";
61+
MULTIPLE_INTEGER_ELEMENT =
62+
"<?xml version=\"1.0\"?><any xmlns"
63+
+ "=\"http://www.w3.org/2005/Atom\"><rep>1</rep><rep>2</rep></any>";
64+
MULTIPLE_ENUM_ELEMENT =
65+
"<?xml version=\"1.0\"?><any xmlns"
66+
+ "=\"http://www.w3.org/2005/Atom\"><rep>ENUM_1</rep><rep>ENUM_2</rep></any>";
67+
COLLECTION_OF_ARRAY =
68+
"<?xml version=\"1.0\"?><any xmlns"
69+
+ "=\"http://www.w3.org/2005/Atom\"><rep><a>a</a><b>b</b></rep><rep><c>c</c><d>d</d></rep></any>";
70+
}
5971

6072
/** The purpose of this test is to map an XML with an Array of {@link XmlTest.AnyType} objects. */
6173
@SuppressWarnings("unchecked")

0 commit comments

Comments
 (0)