Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate to jakarta jaxb #1

Merged
merged 2 commits into from
Jan 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: "maven"
directory: "/"
schedule:
interval: "weekly"
day: "saturday"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "saturday"
32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

on:
push:
branches:
- main
- boris/*
tags:
- '*'
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'temurin'
cache: 'maven'
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Archive installer
uses: actions/upload-artifact@v3
with:
name: cc-xjc-plugin.jar
path: ./cc-xjc-plugin/target/cc-xjc-plugin-*.jar
33 changes: 15 additions & 18 deletions cc-xjc-it/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,18 @@
</executions>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb21-plugin</artifactId>
<groupId>com.evolvedbinary.maven.jvnet</groupId>
<artifactId>jaxb30-maven-plugin</artifactId>
<dependencies>
<dependency>
<groupId>net.sourceforge.ccxjc</groupId>
<artifactId>cc-xjc-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>basic</artifactId>
<version>0.4.1.5</version>
<groupId>codes.rafael.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>${version.jaxb2_commons-basics}</version>
</dependency>
</dependencies>
<executions>
Expand Down Expand Up @@ -585,16 +585,16 @@
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb21-plugin</artifactId>
<groupId>com.evolvedbinary.maven.jvnet</groupId>
<artifactId>jaxb30-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<version>4.13.2</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand All @@ -604,21 +604,18 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>basic</artifactId>
<version>0.4.1.5</version>
<scope>compile</scope>
<groupId>codes.rafael.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>${version.jaxb2_commons-basics}</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.1</version>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.1.13</version>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
*/
package net.sourceforge.ccxjc.it;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBElement;
import net.sourceforge.ccxjc.it.model.priv.collections.valueclass.ccxjcit.ChoiceComplexType;
import org.junit.Test;

Expand Down
21 changes: 21 additions & 0 deletions cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/CommonHelper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package net.sourceforge.ccxjc.it;

import java.util.GregorianCalendar;

import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.Duration;
import javax.xml.datatype.XMLGregorianCalendar;

final class CommonHelper {
static final double FLOAT_EPSILON = 0.001F;
static final double DOUBLE_EPSILON = 0.00000001D;

static Duration createDurationFromMillis( long millis ) throws DatatypeConfigurationException {
return DatatypeFactory.newInstance().newDuration( millis );
}

static XMLGregorianCalendar now() throws DatatypeConfigurationException {
return DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
*/
package net.sourceforge.ccxjc.it;

import javax.activation.MimeType;
import javax.activation.MimeTypeParseException;
import javax.xml.bind.DataBindingException;
import javax.xml.bind.annotation.adapters.XmlAdapter;
import jakarta.activation.MimeType;
import jakarta.activation.MimeTypeParseException;
import jakarta.xml.bind.DataBindingException;
import jakarta.xml.bind.annotation.adapters.XmlAdapter;

/**
* {@code XmlAdapter} adapting {@code String} to {@code MimeType}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@
*/
package net.sourceforge.ccxjc.it;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.jvnet.jaxb2_commons.lang.builder.CopyBuilder;
import org.jvnet.jaxb2_commons.lang.CopyStrategy2;
import org.jvnet.jaxb2_commons.lang.EqualsStrategy2;
import org.jvnet.jaxb2_commons.lang.HashCodeStrategy2;
import org.jvnet.jaxb2_commons.lang.ToStringStrategy2;
import org.jvnet.jaxb2_commons.locator.ObjectLocator;

/**
* Class referenced by {@code &lt;jaxb:class ref="net.sourceforge.ccxjc.it.ReferencedClass"&gt;} test customizations.
Expand All @@ -54,33 +55,31 @@ public ReferencedClass( final ReferencedClass o )
}

@Override
public ReferencedClass clone()
public Object clone()
{
try
{
return (ReferencedClass) super.clone();
return super.clone();
}
catch ( final CloneNotSupportedException e )
{
throw new AssertionError( e );
}
}

public void toString( final ToStringBuilder toStringBuilder )
{
public StringBuilder appendFields( final ObjectLocator locator, final StringBuilder buffer, final ToStringStrategy2 strategy ) {
return buffer;
}

public void equals( final Object object, final EqualsBuilder equalsBuilder )
{
public boolean equals( final ObjectLocator thisLocator, final ObjectLocator thatLocator, final Object object, final EqualsStrategy2 strategy ) {
return true;
}

public void hashCode( final HashCodeBuilder hashCodeBuilder )
{
public int hashCode( final ObjectLocator locator, final HashCodeStrategy2 strategy ) {
return 0;
}

public Object copyTo( final Object target, final CopyBuilder copyBuilder )
{
public Object copyTo(ObjectLocator locator, Object target, CopyStrategy2 strategy) {
return target;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.Duration;
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.namespace.QName;
import junit.framework.Assert;
import net.sourceforge.ccxjc.it.model.priv.collections.valueclass.ccxjcit.SimpleTypeAttributes;
import org.apache.commons.lang.SerializationUtils;
import org.junit.Assert;
import org.junit.Test;

/**
Expand Down Expand Up @@ -72,7 +72,7 @@ public XMLGregorianCalendar getTestCalendar() throws DatatypeConfigurationExcept
{
if ( this.testCalendar == null )
{
this.testCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar();
this.testCalendar = CommonHelper.now();
}

return this.testCalendar;
Expand All @@ -82,7 +82,7 @@ public Duration getTestDuration() throws DatatypeConfigurationException
{
if ( this.testDuration == null )
{
this.testDuration = DatatypeFactory.newInstance().newDuration( 1000L );
this.testDuration = CommonHelper.createDurationFromMillis( 1000L );
}

return this.testDuration;
Expand All @@ -106,10 +106,7 @@ public List<String> getTestEntities()
{
if ( this.testEntities == null )
{
this.testEntities = Arrays.asList( new String[]
{
"ENTITY 1", "ENTITY 2", "ENTITY 3"
} );
this.testEntities = Arrays.asList( "ENTITY 1", "ENTITY 2", "ENTITY 3" );

}

Expand All @@ -120,10 +117,7 @@ public List<Object> getTestIdRefs()
{
if ( this.testIdRefs == null )
{
this.testIdRefs = Arrays.asList( new Object[]
{
"ID"
} );
this.testIdRefs = Collections.singletonList( "ID" );

}

Expand All @@ -134,10 +128,7 @@ public List<String> getTestTokens()
{
if ( this.testTokens == null )
{
this.testTokens = Arrays.asList( new String[]
{
"NMTOKEN 1", "NMTOKEN 2", "NMTOKEN 3"
} );
this.testTokens = Arrays.asList( "NMTOKEN 1", "NMTOKEN 2", "NMTOKEN 3" );

}

Expand All @@ -156,7 +147,7 @@ public QName getTestQName()

public void assertTestBytes( final byte[] bytes )
{
Assert.assertTrue( Arrays.equals( this.getTestBytes(), bytes ) );
Assert.assertArrayEquals(this.getTestBytes(), bytes);
}

public SimpleTypeAttributes getTestSimpleTypeAttributes() throws DatatypeConfigurationException
Expand Down Expand Up @@ -199,7 +190,7 @@ public SimpleTypeAttributes getTestSimpleTypeAttributes() throws DatatypeConfigu
t.setQName( this.getTestQName() );
t.setShort( (short) 100 );
t.setString( "String" );
t.setTime( DatatypeFactory.newInstance().newXMLGregorianCalendar() );
t.setTime( this.getTestCalendar() );
t.setToken( "Token" );
t.setUnsignedByte( (short) 100 );
t.setUnsignedInt( 100L );
Expand All @@ -218,16 +209,16 @@ public void assertTestSimpleTypeAttributes( final SimpleTypeAttributes a ) throw
Assert.assertEquals( "any", a.getAnySimpleType() );
Assert.assertEquals( "anyURI", a.getAnyURI() );
this.assertTestBytes( a.getBase64Binary() );
Assert.assertEquals( true, a.isBoolean() );
Assert.assertTrue( a.isBoolean() );
Assert.assertEquals( 1, a.getByte() );
Assert.assertEquals( this.getTestCalendar(), a.getDate() );
Assert.assertEquals( this.getTestCalendar(), a.getDateTime() );
Assert.assertEquals( BigDecimal.TEN, a.getDecimal() );
Assert.assertEquals( 100.0D, a.getDouble() );
Assert.assertEquals(100.0D, a.getDouble(), CommonHelper.DOUBLE_EPSILON );
Assert.assertEquals( this.getTestDuration(), a.getDuration() );
Assert.assertEquals( this.getTestEntities(), a.getENTITIES() );
Assert.assertEquals( "ENTITY", a.getENTITY() );
Assert.assertEquals( 100.0F, a.getFloat() );
Assert.assertEquals(100.0F, a.getFloat(), CommonHelper.FLOAT_EPSILON );
Assert.assertEquals( this.getTestCalendar(), a.getGDay() );
Assert.assertEquals( this.getTestCalendar(), a.getGMonth() );
Assert.assertEquals( this.getTestCalendar(), a.getGMonthDay() );
Expand Down
Loading