Skip to content

Commit 006b29b

Browse files
authored
Merge branch 'master' into deploymentPipeline
2 parents e8f125f + 996d3a5 commit 006b29b

File tree

7 files changed

+50
-16
lines changed

7 files changed

+50
-16
lines changed

.github/workflows/pipeline.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This workflow will build a Java project with Maven
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
2+
# For more information see: https://docs.github.com/en/actions/learn-github-actions or https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
33

44
name: Java CI with Maven
55

@@ -37,13 +37,21 @@ jobs:
3737
mvn site -DgenerateReports=false -Dmaven.compiler.source=${{ matrix.java }} -Dmaven.compiler.target=${{ matrix.java }}
3838
- name: Upload Test Results ${{ matrix.java }}
3939
if: ${{ always() }}
40-
uses: actions/upload-artifact@v1
40+
uses: actions/upload-artifact@v3
4141
with:
4242
name: Test Results ${{ matrix.java }}
4343
path: target/surefire-reports/
4444
- name: Upload Test Report ${{ matrix.java }}
4545
if: ${{ always() }}
46-
uses: actions/upload-artifact@v1
46+
uses: actions/upload-artifact@v3
4747
with:
4848
name: Test Report ${{ matrix.java }}
4949
path: target/site/
50+
- name: Package Jar ${{ matrix.java }}
51+
run: mvn clean package -Dmaven.compiler.source=${{ matrix.java }} -Dmaven.compiler.target=${{ matrix.java }} -Dmaven.test.skip=true -Dmaven.site.skip=true
52+
- name: Upload Package Results ${{ matrix.java }}
53+
if: ${{ always() }}
54+
uses: actions/upload-artifact@v3
55+
with:
56+
name: Package Jar ${{ matrix.java }}
57+
path: target/*.jar

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# ignore eclipse project files
22
.project
33
.classpath
4+
# ignore vscode files
5+
.vscode
46
# ignore Intellij Idea project files
57
.idea
68
*.iml

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ JSON in Java [package org.json]
77
===============================
88

99
[![Maven Central](https://img.shields.io/maven-central/v/org.json/json.svg)](https://mvnrepository.com/artifact/org.json/json)
10+
[![Java CI with Maven](https://github.com/stleary/JSON-java/actions/workflows/pipeline.yml/badge.svg)](https://github.com/stleary/JSON-java/actions/workflows/pipeline.yml)
11+
[![CodeQL](https://github.com/stleary/JSON-java/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/stleary/JSON-java/actions/workflows/codeql-analysis.yml)
1012

1113
**[Click here if you just want the latest release jar file.](https://search.maven.org/remotecontent?filepath=org/json/json/20231013/json-20231013.jar)**
1214

@@ -24,7 +26,7 @@ Project goals include:
2426
* No external dependencies
2527
* Fast execution and low memory footprint
2628
* Maintain backward compatibility
27-
* Designed and tested to use on Java versions 1.6 - 1.11
29+
* Designed and tested to use on Java versions 1.8 - 17
2830

2931
The files in this package implement JSON encoders and decoders. The package can also convert between JSON and XML, HTTP headers, Cookies, and CDL.
3032

pom.xml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4747
</properties>
4848

49+
4950
<distributionManagement>
5051
<repository>
5152
<id>ossrh</id>
@@ -58,6 +59,7 @@
5859
</snapshotRepository>
5960
</distributionManagement>
6061

62+
6163
<dependencies>
6264
<dependency>
6365
<groupId>junit</groupId>
@@ -164,17 +166,34 @@
164166
<autoReleaseAfterClose>false</autoReleaseAfterClose>
165167
</configuration>
166168
</plugin>
169+
<plugin>
170+
<groupId>org.moditect</groupId>
171+
<artifactId>moditect-maven-plugin</artifactId>
172+
<version>1.0.0.Final</version>
173+
<executions>
174+
<execution>
175+
<id>add-module-infos</id>
176+
<phase>package</phase>
177+
<goals>
178+
<goal>add-module-info</goal>
179+
</goals>
180+
<configuration>
181+
<jvmVersion>9</jvmVersion>
182+
<module>
183+
<moduleInfoSource>
184+
module org.json {
185+
exports org.json;
186+
}
187+
</moduleInfoSource>
188+
</module>
189+
</configuration>
190+
</execution>
191+
</executions>
192+
</plugin>
167193
<plugin>
168194
<groupId>org.apache.maven.plugins</groupId>
169195
<artifactId>maven-jar-plugin</artifactId>
170196
<version>3.3.0</version>
171-
<configuration>
172-
<archive>
173-
<manifestEntries>
174-
<Automatic-Module-Name>org.json</Automatic-Module-Name>
175-
</manifestEntries>
176-
</archive>
177-
</configuration>
178197
</plugin>
179198
</plugins>
180199
</build>

src/test/java/org/json/junit/JSONMLTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -762,8 +762,8 @@ public void testToJSONObject_reversibility() {
762762
final String xml = JSONML.toString(originalObject);
763763
final JSONObject revertedObject = JSONML.toJSONObject(xml, false);
764764
final String newJson = revertedObject.toString();
765-
assertTrue("JSON Objects are not similar",originalObject.similar(revertedObject));
766-
assertEquals("original JSON does not equal the new JSON",originalJson, newJson);
765+
assertTrue("JSON Objects are not similar", originalObject.similar(revertedObject));
766+
assertTrue("JSON Strings are not similar", new JSONObject(originalJson).similar(new JSONObject(newJson)));
767767
}
768768

769769
// these tests do not pass for the following reasons:

src/test/java/org/json/junit/JSONObjectTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2095,7 +2095,9 @@ public void valueToString() {
20952095
"}";
20962096
JSONObject jsonObject = new JSONObject(jsonObjectStr);
20972097
assertTrue("jsonObject valueToString() incorrect",
2098-
JSONObject.valueToString(jsonObject).equals(jsonObject.toString()));
2098+
new JSONObject(JSONObject.valueToString(jsonObject))
2099+
.similar(new JSONObject(jsonObject.toString()))
2100+
);
20992101
String jsonArrayStr =
21002102
"[1,2,3]";
21012103
JSONArray jsonArray = new JSONArray(jsonArrayStr);
@@ -2106,7 +2108,8 @@ public void valueToString() {
21062108
map.put("key2", "val2");
21072109
map.put("key3", "val3");
21082110
assertTrue("map valueToString() incorrect",
2109-
jsonObject.toString().equals(JSONObject.valueToString(map)));
2111+
new JSONObject(jsonObject.toString())
2112+
.similar(new JSONObject(JSONObject.valueToString(map))));
21102113
Collection<Integer> collection = new ArrayList<Integer>();
21112114
collection.add(Integer.valueOf(1));
21122115
collection.add(Integer.valueOf(2));

src/test/java/org/json/junit/XMLTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1234,7 +1234,7 @@ public void testIndentComplicatedJsonObjectWithArrayAndWithConfig(){
12341234
for (int numRead; (numRead = in.read(buffer, 0, buffer.length)) > 0; ) {
12351235
expected.append(buffer, 0, numRead);
12361236
}
1237-
assertEquals(expected.toString(), actualString);
1237+
assertTrue(XML.toJSONObject(expected.toString()).similar(XML.toJSONObject(actualString)));
12381238
}
12391239
} catch (IOException e) {
12401240
fail("file writer error: " +e.getMessage());

0 commit comments

Comments
 (0)