Skip to content

Commit

Permalink
Upgrade to Sprox 4.0.0.
Browse files Browse the repository at this point in the history
As a result, support for OSGi environments is removed. All unit tests
work again.
  • Loading branch information
voostindie committed Mar 1, 2020
1 parent 0327d3c commit b12f4c9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 126 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ To use `sprox-json`, add the following dependency to your Maven POM:
</dependency>
```

Note that you also need to include Sprox, at least version 3.1.3. That also means you need at least Java 8.
Note that you also need to include Sprox, at least version 4.0.0. That also means you need at least Java 8.

Once your project is set up correctly, you can declare and use a Sprox processor like so (for example):

Expand Down Expand Up @@ -128,7 +128,7 @@ And of course, it's up to you to handle this value.

The easiest way to do this is to use the `JsonValueParserWrapper`. This parser implements the Sprox `Parser` interface and wraps another parser. It converts the ugly constant value back into an actual `null` value that it then returns. It passes any other String values to the parser it wraps. If you do this then in your controller classes all you need to do is define the parameter as an `Optional<String>`, which is exactly what you would want to do anyway.

In case your processor needs to be able to map to all Java primitives and all values might be `null` in the JSON input, call the convience method `JsonValueParserWrapper.addDefaultJsonParsers(XmlProcessorBuilder<T> builder)` to replace all Sprox built-in parsers with parsers that support JSON null values.
In case your processor needs to be able to map to all Java primitives and all values might be `null` in the JSON input, call the convenience method `JsonValueParserWrapper.addDefaultJsonParsers(XmlProcessorBuilder<T> builder)` to replace all Sprox built-in parsers with parsers that support JSON null values.

## Custom root node name

Expand Down
87 changes: 6 additions & 81 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,8 @@
</licenses>

<properties>
<sprox.version>3.1.3</sprox.version>
<sprox.version>4.0.0</sprox.version>
<junit.version>4.11</junit.version>
<osgi.core.version>5.0.0</osgi.core.version>
<felix.version>4.2.1</felix.version>
<pax-exam.version>3.3.0</pax-exam.version>
<logback.version>1.0.13</logback.version>
</properties>

<dependencies>
Expand All @@ -59,19 +55,13 @@
<dependency>
<groupId>javax.json</groupId>
<artifactId>javax.json-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>${osgi.core.version}</version>
<version>1.1.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>1.0.4</version>
<version>1.1.4</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -80,48 +70,14 @@
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-junit4</artifactId>
<version>${pax-exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-native</artifactId>
<version>${pax-exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-link-mvn</artifactId>
<version>${pax-exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<version>${felix.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<prerequisites>
<maven>2.2.1</maven>
</prerequisites>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
Expand All @@ -141,7 +97,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.4</version>
<version>0.8.5</version>
<executions>
<execution>
<goals>
Expand All @@ -157,41 +113,10 @@
</execution>
</executions>
</plugin>
<!-- Needed because the maven-bundle-plugin is used in "jar" packaging (see below). -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<!--+
| Because the tests include integration tests on the bundle itself (deployed in an OSGi container)
| it's not possible to use the plugin with the "bundle" packaging mode. Because in that case the
| manifest is generated in the packaging phase, after the tests. Below the plugin is configured
| to generate the manifest before the tests are run.
+-->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.4.0</version>
<configuration>
<instructions>
<Export-Package>nl.ulso.sprox.json</Export-Package>
</instructions>
</configuration>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<version>3.2.0</version>
</plugin>
</plugins>
</build>
Expand Down
43 changes: 0 additions & 43 deletions src/test/java/nl/ulso/sprox/json/osgi/OsgiBundleTest.java

This file was deleted.

0 comments on commit b12f4c9

Please sign in to comment.