Skip to content

Commit

Permalink
test(crd-generator): approval tests use lombok for proper serialization
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Nuri <[email protected]>
  • Loading branch information
manusa committed May 7, 2024
1 parent fa6a3c3 commit 869d95b
Show file tree
Hide file tree
Showing 14 changed files with 46 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,9 @@
*/
package io.fabric8.crd.generator.approvaltests.inherited;

import lombok.Data;

@Data
public class BaseSpec {
private int baseInt;

public int getBaseInt() {
return baseInt;
}

public void setBaseInt(int baseInt) {
this.baseInt = baseInt;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
*/
package io.fabric8.crd.generator.approvaltests.inherited;

import lombok.Data;

/**
* @author <a href="[email protected]">Christophe Laprun</a>
*/
@Data
public class BaseStatus {

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
*/
package io.fabric8.crd.generator.approvaltests.inherited;

import lombok.Data;

import java.util.Map;

@Data
public class ChildSpec extends BaseSpec {
private Map<String, Object> unsupported;
private Map<String, String> supported;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,15 @@
package io.fabric8.crd.generator.approvaltests.json;

import com.fasterxml.jackson.databind.JsonNode;
import lombok.Data;

@Data
public class ContainingJsonSpec {

private int field;

public int getField() {
return field;
}

private JsonNode free;

public JsonNode getFree() {
return free;
}

private Foo foo;

public Foo getFoo() {
return foo;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;

import java.util.HashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@

import io.fabric8.generator.annotation.Required;
import io.fabric8.generator.annotation.ValidationRule;
import lombok.Data;

@ValidationRule(value = "self.minReplicas <= self.replicas && self.replicas <= self.maxReplicas", fieldPath = ".replicas")
@Data
public class K8sValidationSpec {
@Required
String namePrefix;
Expand Down Expand Up @@ -82,15 +84,17 @@ enum Priority {
high
}

static class DeepLevel1 {
@Data
static final class DeepLevel1 {
@Required
private String valueL1;

@Required
private DeepLevel2 deepLevel2;
}

static class DeepLevel2 {
@Data
static final class DeepLevel2 {
@Required
private String valueL2;

Expand All @@ -100,7 +104,8 @@ static class DeepLevel2 {
}

@ValidationRule("self.dummy.startsWith('on-class-')")
static class OnClass {
@Data
static final class OnClass {
@Required
private String dummy;
}
Expand All @@ -110,6 +115,7 @@ static class ClassWithValidationsFromAbstractClass extends AbstractBase {
}

@ValidationRule("self.dummy.startsWith('abstract-')")
@Data
static abstract class AbstractBase {
@Required
private String dummy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
*/
package io.fabric8.crd.generator.approvaltests.k8svalidation;

import lombok.Data;

@Data
public class K8sValidationStatus {
Integer availableReplicas;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
import io.fabric8.kubernetes.client.CustomResource;
import io.fabric8.kubernetes.model.annotation.Group;
import io.fabric8.kubernetes.model.annotation.Version;
import lombok.Data;

import java.util.EnumMap;

@Group("sample.fabric8.io")
@Version("v1alpha1")
@Data
public class ContainingMaps extends CustomResource<ContainingMapsSpec, Void> {

public enum Foo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,19 @@
*/
package io.fabric8.crd.generator.approvaltests.map;

import lombok.Data;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Data
public class ContainingMapsSpec {

private Map<String, List<String>> test = null;

public Map<String, List<String>> getTest() {
return test;
}

private Map<String, Map<String, List<Boolean>>> test2 = null;

public Map<String, Map<String, List<Boolean>>> getTest2() {
return test2;
}

private MultiHashMap<String, Integer> stringToIntMultiMap1;
private MultiMap<String, Integer> stringToIntMultiMap2;
private SwappedParametersMap<List<Integer>, String> stringToIntMultiMap3;
Expand All @@ -56,7 +51,7 @@ interface RedundantParametersMap<A, B, K, V> extends Map<K, V> {
interface RedundantParametersStringToIntMultiMap<K, V> extends Map<String, List<Integer>> {
}

static class StringKeyedMultiHashMap<V> extends MultiHashMap<String, V> {
static final class StringKeyedMultiHashMap<V> extends MultiHashMap<String, V> {
}

interface IntValuedMultiMap<K> extends MultiMap<K, Integer> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
*/
package io.fabric8.crd.generator.approvaltests.multipleversions.v1;

import lombok.Data;

@Data
public class MultipleSpec {
private String v1;

public String getV1() {
return v1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
*/
package io.fabric8.crd.generator.approvaltests.multipleversions.v2;

import lombok.Data;

@Data
public class MultipleSpec {
private String v2;

public String getV2() {
return v2;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
*/
package io.fabric8.crd.generator.approvaltests.nocyclic;

import lombok.Data;

@Data
public class NoCyclicSpec {
private Ref ref1;
private Ref ref2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
*/
package io.fabric8.crd.generator.approvaltests.nocyclic;

import lombok.Data;

@Data
public class NoCyclicStatus {
private String message;
private Ref ref1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@
*/
package io.fabric8.crd.generator.approvaltests.nocyclic;

import lombok.Data;

@Data
public class Ref {

private int ref;

protected Inner inner;

public static class Inner {
public static final class Inner {
}

}

0 comments on commit 869d95b

Please sign in to comment.