Skip to content

Commit 4cacbbb

Browse files
committed
tests: Add artifact deployment test suite
This provides a way to test artifact deployments to the ossrh stage area before releasing them.
1 parent 21b7b61 commit 4cacbbb

File tree

7 files changed

+392
-0
lines changed

7 files changed

+392
-0
lines changed

dtest/pom.xml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
Copyright 2019 David MacCormack
4+
5+
Licensed under the Apache License, Version 2.0 (the "License"); you may not
6+
use this file except in compliance with the License. You may obtain a copy
7+
of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing,
12+
software distributed under the License is distributed on an
13+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
KIND, either express or implied. See the License for the
15+
specific language governing permissions and limitations
16+
under the License.
17+
-->
18+
19+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
21+
<modelVersion>4.0.0</modelVersion>
22+
23+
<parent>
24+
<groupId>org.jsonurl</groupId>
25+
<artifactId>parent</artifactId>
26+
<version>1-SNAPSHOT</version>
27+
<relativePath></relativePath>
28+
</parent>
29+
30+
<artifactId>jsonurl-deploy-test</artifactId>
31+
<version>1.0.0-SNAPSHOT</version>
32+
<packaging>jar</packaging>
33+
34+
<properties>
35+
<javax.json.version>1.1.4</javax.json.version>
36+
</properties>
37+
38+
<name>${project.groupId}:${project.artifactId}</name>
39+
<url>https://www.jsonurl.org</url>
40+
<description>
41+
This is the JSON->URL deployment test. It serves as a way to test staged
42+
ossrh artifacts before releasing them.
43+
</description>
44+
45+
<distributionManagement>
46+
<site>
47+
<id>${project.artifactId}-site</id>
48+
<url>${project.baseUri}</url>
49+
</site>
50+
</distributionManagement>
51+
52+
<dependencies>
53+
<dependency>
54+
<groupId>org.jsonurl</groupId>
55+
<artifactId>jsonurl-jsonorg</artifactId>
56+
<version>${project.version}</version>
57+
</dependency>
58+
<dependency>
59+
<groupId>org.jsonurl</groupId>
60+
<artifactId>jsonurl-jsr374</artifactId>
61+
<version>${project.version}</version>
62+
</dependency>
63+
<dependency>
64+
<groupId>org.glassfish</groupId>
65+
<artifactId>javax.json</artifactId>
66+
<version>${javax.json.version}</version>
67+
<scope>test</scope>
68+
</dependency>
69+
</dependencies>
70+
71+
<profiles>
72+
<profile>
73+
<id>nexus</id>
74+
<repositories>
75+
<repository>
76+
<id>ossrh</id>
77+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
78+
</repository>
79+
</repositories>
80+
</profile>
81+
</profiles>
82+
</project>
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*
2+
* Copyright 2019-2021 David MacCormack
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy
6+
* of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing,
11+
* software distributed under the License is distributed on an
12+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
13+
* KIND, either express or implied. See the License for the
14+
* specific language governing permissions and limitations
15+
* under the License.
16+
*/
17+
18+
package org.jsonurl.deploytest;
19+
20+
import static org.jsonurl.deploytest.DeployTestConstants.HELLO;
21+
import static org.jsonurl.deploytest.DeployTestConstants.TEST_CASE;
22+
import static org.jsonurl.deploytest.DeployTestConstants.WORLD;
23+
import static org.junit.jupiter.api.Assertions.assertEquals;
24+
import static org.junit.jupiter.api.Assertions.assertNotNull;
25+
26+
import org.jsonurl.stream.JsonUrlCharSequence;
27+
import org.jsonurl.stream.JsonUrlEvent;
28+
import org.jsonurl.stream.JsonUrlIterator;
29+
import org.junit.jupiter.params.ParameterizedTest;
30+
import org.junit.jupiter.params.provider.ValueSource;
31+
32+
/**
33+
* <a href="https://jsonurl.org/">JSON&#x2192;URL</a> deployment
34+
* test for the jsonurl-core artifact.
35+
*
36+
* @author jsonurl.org
37+
* @author David MacCormack
38+
* @since 2021-05-01
39+
*/
40+
class CoreTest {
41+
42+
@ParameterizedTest
43+
@ValueSource(strings = {
44+
TEST_CASE,
45+
})
46+
void test(String text) {
47+
JsonUrlIterator iter = JsonUrlIterator.newInstance(
48+
new JsonUrlCharSequence(text), null, null);
49+
50+
assertNotNull(iter, text);
51+
52+
assertEquals(
53+
JsonUrlEvent.START_ARRAY,
54+
iter.next(),
55+
JsonUrlEvent.START_ARRAY.toString());
56+
57+
assertEquals(
58+
JsonUrlEvent.VALUE_STRING,
59+
iter.next(),
60+
JsonUrlEvent.VALUE_STRING.toString());
61+
62+
assertEquals(HELLO, iter.getString(), HELLO);
63+
64+
assertEquals(
65+
JsonUrlEvent.VALUE_STRING,
66+
iter.next(),
67+
JsonUrlEvent.VALUE_STRING.toString());
68+
69+
assertEquals(WORLD, iter.getString(), WORLD);
70+
71+
assertEquals(
72+
JsonUrlEvent.END_ARRAY,
73+
iter.next(),
74+
JsonUrlEvent.END_ARRAY.toString());
75+
76+
assertEquals(
77+
JsonUrlEvent.END_STREAM,
78+
iter.next(),
79+
JsonUrlEvent.END_STREAM.toString());
80+
}
81+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright 2019-2020 David MacCormack
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy
6+
* of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing,
11+
* software distributed under the License is distributed on an
12+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
13+
* KIND, either express or implied. See the License for the
14+
* specific language governing permissions and limitations
15+
* under the License.
16+
*/
17+
18+
package org.jsonurl.deploytest;
19+
20+
/**
21+
* <a href="https://jsonurl.org/">JSON&#x2192;URL</a> deployment integration
22+
* test interface.
23+
*
24+
* @author jsonurl.org
25+
* @author David MacCormack
26+
* @since 2021-05-01
27+
*/
28+
class DeployTestConstants {
29+
30+
/**
31+
* Hello.
32+
*/
33+
public static final String HELLO = "hello";
34+
35+
/**
36+
* World.
37+
*/
38+
public static final String WORLD = "World!";
39+
40+
/**
41+
* Test case.
42+
*/
43+
public static final String TEST_CASE = "(" + HELLO + "," + WORLD + ")";
44+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright 2019-2021 David MacCormack
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy
6+
* of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing,
11+
* software distributed under the License is distributed on an
12+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
13+
* KIND, either express or implied. See the License for the
14+
* specific language governing permissions and limitations
15+
* under the License.
16+
*/
17+
18+
package org.jsonurl.deploytest;
19+
20+
import static org.jsonurl.deploytest.DeployTestConstants.HELLO;
21+
import static org.jsonurl.deploytest.DeployTestConstants.TEST_CASE;
22+
import static org.jsonurl.deploytest.DeployTestConstants.WORLD;
23+
import static org.junit.jupiter.api.Assertions.assertEquals;
24+
import static org.junit.jupiter.api.Assertions.assertNotNull;
25+
26+
import java.util.List;
27+
import org.jsonurl.j2se.JsonUrlParser;
28+
import org.junit.jupiter.params.ParameterizedTest;
29+
import org.junit.jupiter.params.provider.ValueSource;
30+
31+
/**
32+
* <a href="https://jsonurl.org/">JSON&#x2192;URL</a> deployment
33+
* test for the jsonurl-factory artifact.
34+
*
35+
* @author jsonurl.org
36+
* @author David MacCormack
37+
* @since 2021-05-01
38+
*/
39+
class J2seTest {
40+
41+
@ParameterizedTest
42+
@ValueSource(strings = {
43+
TEST_CASE,
44+
})
45+
void test(String text) {
46+
List<Object> data = new JsonUrlParser().parseArray(text);
47+
assertNotNull(data);
48+
assertEquals(2, data.size(), text);
49+
assertEquals(HELLO, data.get(0), text);
50+
assertEquals(WORLD, data.get(1), text);
51+
}
52+
53+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright 2019-2021 David MacCormack
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy
6+
* of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing,
11+
* software distributed under the License is distributed on an
12+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
13+
* KIND, either express or implied. See the License for the
14+
* specific language governing permissions and limitations
15+
* under the License.
16+
*/
17+
18+
package org.jsonurl.deploytest;
19+
20+
import static org.jsonurl.deploytest.DeployTestConstants.HELLO;
21+
import static org.jsonurl.deploytest.DeployTestConstants.TEST_CASE;
22+
import static org.jsonurl.deploytest.DeployTestConstants.WORLD;
23+
import static org.junit.jupiter.api.Assertions.assertEquals;
24+
import static org.junit.jupiter.api.Assertions.assertNotNull;
25+
26+
import org.json.JSONArray;
27+
import org.jsonurl.jsonorg.JsonUrlParser;
28+
import org.junit.jupiter.params.ParameterizedTest;
29+
import org.junit.jupiter.params.provider.ValueSource;
30+
31+
/**
32+
* <a href="https://jsonurl.org/">JSON&#x2192;URL</a> deployment
33+
* test for the jsonurl-jsonorg artifact.
34+
*
35+
* @author jsonurl.org
36+
* @author David MacCormack
37+
* @since 2021-05-01
38+
*/
39+
class JsonOrgTest {
40+
41+
@ParameterizedTest
42+
@ValueSource(strings = {
43+
TEST_CASE,
44+
})
45+
void test(String text) {
46+
JSONArray data = new JsonUrlParser().parseArray(text);
47+
assertNotNull(data);
48+
assertEquals(2, data.length(), text);
49+
assertEquals(HELLO, data.getString(0), text);
50+
assertEquals(WORLD, data.getString(1), text);
51+
}
52+
53+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright 2019-2021 David MacCormack
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy
6+
* of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing,
11+
* software distributed under the License is distributed on an
12+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
13+
* KIND, either express or implied. See the License for the
14+
* specific language governing permissions and limitations
15+
* under the License.
16+
*/
17+
18+
package org.jsonurl.deploytest;
19+
20+
import static org.jsonurl.deploytest.DeployTestConstants.HELLO;
21+
import static org.jsonurl.deploytest.DeployTestConstants.TEST_CASE;
22+
import static org.jsonurl.deploytest.DeployTestConstants.WORLD;
23+
import static org.junit.jupiter.api.Assertions.assertEquals;
24+
import static org.junit.jupiter.api.Assertions.assertNotNull;
25+
26+
import javax.json.JsonArray;
27+
import org.jsonurl.jsonp.JsonUrlParser;
28+
import org.junit.jupiter.params.ParameterizedTest;
29+
import org.junit.jupiter.params.provider.ValueSource;
30+
31+
/**
32+
* <a href="https://jsonurl.org/">JSON&#x2192;URL</a> deployment
33+
* test for the jsonurl-jsr374 artifact.
34+
*
35+
* @author jsonurl.org
36+
* @author David MacCormack
37+
* @since 2021-05-01
38+
*/
39+
class JsonpTest {
40+
41+
@ParameterizedTest
42+
@ValueSource(strings = {
43+
TEST_CASE,
44+
})
45+
void test(String text) {
46+
JsonArray data = new JsonUrlParser().parseArray(text);
47+
assertNotNull(data);
48+
assertEquals(2, data.size(), text);
49+
assertEquals(HELLO, data.getString(0), text);
50+
assertEquals(WORLD, data.getString(1), text);
51+
}
52+
53+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright 2019 David MacCormack
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy
6+
* of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing,
11+
* software distributed under the License is distributed on an
12+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
13+
* KIND, either express or implied. See the License for the
14+
* specific language governing permissions and limitations
15+
* under the License.
16+
*/
17+
18+
/**
19+
* <a href="https://jsonurl.org/">JSON&#x2192;URL</a> deployment integration
20+
* test suite.
21+
*
22+
* @author jsonurl.org
23+
* @author David MacCormack
24+
* @since 2021-05-01
25+
*/
26+
package org.jsonurl.deploytest;

0 commit comments

Comments
 (0)