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 all validation related imports to Jakarta #442

Merged
merged 1 commit into from
Oct 20, 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
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,25 @@ public class AspectWithConstraints {
@JsonCreator
public AspectWithConstraints(
@JsonProperty( value = "testPropertyWithRegularExpression" )
String testPropertyWithRegularExpression,
String testPropertyWithRegularExpression,
@JsonProperty( value = "testPropertyWithDecimalMinDecimalMaxRangeConstraint" )
BigDecimal testPropertyWithDecimalMinDecimalMaxRangeConstraint,
BigDecimal testPropertyWithDecimalMinDecimalMaxRangeConstraint,
@JsonProperty( value = "testPropertyWithDecimalMaxRangeConstraint" )
BigDecimal testPropertyWithDecimalMaxRangeConstraint,
BigDecimal testPropertyWithDecimalMaxRangeConstraint,
@JsonProperty( value = "testPropertyWithMinMaxRangeConstraint" )
Integer testPropertyWithMinMaxRangeConstraint,
Integer testPropertyWithMinMaxRangeConstraint,
@JsonProperty( value = "testPropertyWithMinRangeConstraint" )
Integer testPropertyWithMinRangeConstraint,
Integer testPropertyWithMinRangeConstraint,
@JsonProperty( value = "testPropertyRangeConstraintWithFloatType" )
Float testPropertyRangeConstraintWithFloatType,
Float testPropertyRangeConstraintWithFloatType,
@JsonProperty( value = "testPropertyRangeConstraintWithDoubleType" )
Double testPropertyRangeConstraintWithDoubleType,
Double testPropertyRangeConstraintWithDoubleType,
@JsonProperty( value = "testPropertyWithMinMaxLengthConstraint" )
String testPropertyWithMinMaxLengthConstraint,
String testPropertyWithMinMaxLengthConstraint,
@JsonProperty( value = "testPropertyWithMinLengthConstraint" )
BigInteger testPropertyWithMinLengthConstraint,
BigInteger testPropertyWithMinLengthConstraint,
@JsonProperty( value = "testPropertyCollectionLengthConstraint" )
List<BigInteger> testPropertyCollectionLengthConstraint ) {
List<BigInteger> testPropertyCollectionLengthConstraint ) {
this.testPropertyWithRegularExpression = testPropertyWithRegularExpression;
this.testPropertyWithDecimalMinDecimalMaxRangeConstraint =
testPropertyWithDecimalMinDecimalMaxRangeConstraint;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class AspectWithGenericNumericProperty {

@JsonCreator
public AspectWithGenericNumericProperty(
@JsonProperty(value = "testNumber") Number testNumber) {
@JsonProperty( value = "testNumber" ) Number testNumber ) {
this.testNumber = testNumber;
}

Expand All @@ -43,15 +43,15 @@ public Number getTestNumber() {
}

@Override
public boolean equals(final Object o) {
if (this == o) {
public boolean equals( final Object o ) {
if ( this == o ) {
return true;
}
if (o == null || getClass() != o.getClass()) {
if ( o == null || getClass() != o.getClass() ) {
return false;
}
final AspectWithGenericNumericProperty that = (AspectWithGenericNumericProperty) o;
return Objects.equals(testNumber, that.testNumber);
return Objects.equals( testNumber, that.testNumber );
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@
/** Generated class for Test Aspect. */
public class AspectWithRangeConstraintWithoutMinMaxIntegerValue {

@NotNull private BigInteger testInt;
@NotNull
private BigInteger testInt;

@JsonCreator
public AspectWithRangeConstraintWithoutMinMaxIntegerValue(
@JsonProperty(value = "testInt") BigInteger testInt) {
@JsonProperty( value = "testInt" ) BigInteger testInt ) {
this.testInt = testInt;
}

Expand All @@ -41,16 +42,16 @@ public BigInteger getTestInt() {
}

@Override
public boolean equals(final Object o) {
if (this == o) {
public boolean equals( final Object o ) {
if ( this == o ) {
return true;
}
if (o == null || getClass() != o.getClass()) {
if ( o == null || getClass() != o.getClass() ) {
return false;
}
final AspectWithRangeConstraintWithoutMinMaxIntegerValue that =
(AspectWithRangeConstraintWithoutMinMaxIntegerValue) o;
return Objects.equals(testInt, that.testInt);
return Objects.equals( testInt, that.testInt );
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ public void testEnumComplexMapping( final KnownVersion metaModelVersion ) {
assertThat( context.<String> read( "$['components']['schemas']['ResultGood']['properties']['details']"
+ "['properties']['message']['enum'][0]" ) ).isEqualTo( "Evaluation succeeded." );
assertThat( context.<Integer> read( "$['components']['schemas']['ResultGood']['properties']['details']"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure myself about this one. I wondered how this ever worked, because it was never a float/double value.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the same question)
you are totally right..)

I found, that the build pipelines every time working like we expect, but in my local env I was getting this error...

But I did the same fix in my PR - #441

+ "['properties']['numericCode']['enum'][0]" ) ).isEqualTo( 10 );
+ "['properties']['numericCode']['enum'][0]" ) ).isEqualTo( 10 );
}

@ParameterizedTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/

package org.eclipse.esmf.aspectmodel.java.customconstraint;

import org.eclipse.esmf.metamodel.impl.BoundDefinition;

import jakarta.validation.ConstraintValidator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/

package org.eclipse.esmf.aspectmodel.java.customconstraint;

import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.Duration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/

package org.eclipse.esmf.aspectmodel.java.customconstraint;

import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
import javax.xml.datatype.DatatypeConstants;
import javax.xml.datatype.DatatypeFactory;

import org.apache.commons.lang3.StringUtils;
import org.apache.jena.rdf.model.ResourceFactory;
import org.apache.jena.vocabulary.XSD;
import org.apache.velocity.app.FieldMethodizer;
import org.eclipse.esmf.aspectmodel.generator.ArtifactGenerator;
import org.eclipse.esmf.aspectmodel.generator.TemplateEngine;
import org.eclipse.esmf.aspectmodel.java.AspectModelJavaUtil;
Expand All @@ -40,25 +36,26 @@
import org.eclipse.esmf.aspectmodel.java.ValueInitializer;
import org.eclipse.esmf.aspectmodel.java.exception.CodeGenerationException;
import org.eclipse.esmf.aspectmodel.resolver.services.DataType;

import org.eclipse.esmf.characteristic.Trait;
import org.eclipse.esmf.metamodel.ComplexType;
import org.eclipse.esmf.metamodel.Constraint;
import org.eclipse.esmf.metamodel.Scalar;
import org.eclipse.esmf.metamodel.StructureElement;
import org.eclipse.esmf.metamodel.impl.DefaultScalar;
import org.eclipse.esmf.metamodel.impl.DefaultScalarValue;

import org.eclipse.esmf.samm.KnownVersion;
import org.jboss.forge.roaster.Roaster;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.google.common.collect.ImmutableMap;

import jakarta.validation.constraints.NotNull;
import org.apache.commons.lang3.StringUtils;
import org.apache.jena.rdf.model.ResourceFactory;
import org.apache.jena.vocabulary.XSD;
import org.apache.velocity.app.FieldMethodizer;
import org.jboss.forge.roaster.Roaster;

/**
* A {@link ArtifactGenerator} that generates Java Pojo code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ ImmutableMap.<Class<?>, Class<?>> builder()
public Class<?> getAnnotationType( final Class<?> type ) {
return typeMapping.get( type );
}
}
}