Skip to content

Commit

Permalink
Fixed formatting issues in ITs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Javatar81 committed Sep 3, 2024
1 parent 3798de9 commit 277b531
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,17 @@
package io.fabric8.it.top;

import com.fasterxml.jackson.databind.JsonNode;
import io.fabric8.kubernetes.api.model.AnyType;
import io.fabric8.kubernetes.api.model.ObjectMeta;
import io.fabric8.kubernetes.client.utils.Serialization;
import org.junit.jupiter.api.Test;
import io.fabric8.java.generator.testing.KubernetesResourceDiff;
import io.argoproj.v1alpha1.Application;
import io.argoproj.v1alpha1.ApplicationSpec;
import io.argoproj.v1alpha1.applicationspec.Destination;
import io.fabric8.java.generator.testing.KubernetesResourceDiff;
import io.fabric8.kubernetes.api.model.ObjectMeta;
import io.fabric8.kubernetes.client.utils.Serialization;
import org.junit.jupiter.api.Test;

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.List;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand All @@ -43,9 +39,9 @@ void testDeserialization() {
try {
Application.class.getMethod("getAdditionalProperties");
fail("No getAdditionalProperties method expected");
} catch (NoSuchMethodException e) {
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
}
}

private Application createSampleApplicationNoAdditionalFields(String name) throws Exception {
Expand Down Expand Up @@ -74,7 +70,7 @@ void testAgainstSampleNoAdditionalFields() throws Exception {

// Act
List<JsonNode> aggregatedDiffs = diff.getListOfDiffs();

// Assert
assertEquals(0, aggregatedDiffs.size());
}
Expand All @@ -89,7 +85,7 @@ void testAgainstSampleWithAdditionalFields() throws Exception {

// Act
List<JsonNode> aggregatedDiffs = diff.getListOfDiffs();

// Assert
// We expect 6 additional fields that are not available in the sample object
assertEquals(6, aggregatedDiffs.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,22 @@
package io.fabric8.it.top;

import com.fasterxml.jackson.databind.JsonNode;
import io.argoproj.v1alpha1.Application;
import io.argoproj.v1alpha1.ApplicationSpec;
import io.argoproj.v1alpha1.application.Operation;
import io.argoproj.v1alpha1.application.operation.InitiatedBy;
import io.argoproj.v1alpha1.applicationspec.Destination;
import io.fabric8.java.generator.testing.KubernetesResourceDiff;
import io.fabric8.kubernetes.api.model.ObjectMeta;
import io.fabric8.kubernetes.client.utils.Serialization;
import org.junit.jupiter.api.Test;
import io.fabric8.java.generator.testing.KubernetesResourceDiff;

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.Files;
import java.util.List;
import io.argoproj.v1alpha1.Application;
import io.argoproj.v1alpha1.ApplicationSpec;
import io.argoproj.v1alpha1.applicationspec.Destination;
import io.argoproj.v1alpha1.application.Operation;
import io.argoproj.v1alpha1.application.operation.InitiatedBy;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;

class TestToplevelFields {

Expand All @@ -56,6 +55,7 @@ private Application createSampleApplication() throws Exception {
application.setOperation(op);
return application;
}

@Test
void testAgainstSample() throws Exception {
// Arrange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,21 @@
package io.fabric8.it.top;

import com.fasterxml.jackson.databind.JsonNode;
import io.argoproj.v1alpha1.Application;
import io.argoproj.v1alpha1.ApplicationSpec;
import io.argoproj.v1alpha1.applicationspec.Destination;
import io.fabric8.java.generator.testing.KubernetesResourceDiff;
import io.fabric8.kubernetes.api.model.AnyType;
import io.fabric8.kubernetes.api.model.ObjectMeta;
import io.fabric8.kubernetes.client.utils.Serialization;
import org.junit.jupiter.api.Test;
import io.fabric8.java.generator.testing.KubernetesResourceDiff;
import io.argoproj.v1alpha1.Application;
import io.argoproj.v1alpha1.ApplicationSpec;
import io.argoproj.v1alpha1.applicationspec.Destination;

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import java.util.Map;

import static org.junit.jupiter.api.Assertions.assertEquals;

Expand All @@ -40,8 +39,7 @@ class TestPreserveUnknownToplevelObjectsFromConfig {
@Test
void testDeserialization() {
// Arrange
Application sample =
Serialization.unmarshal(getClass().getResourceAsStream("/sample-addprops.yaml"), Application.class);
Application sample = Serialization.unmarshal(getClass().getResourceAsStream("/sample-addprops.yaml"), Application.class);
// Assert
assertEquals(5, sample.getAdditionalProperties().size());
}
Expand All @@ -62,8 +60,8 @@ private Application createSampleApplicationAdditionalFields() throws Exception {
application.setAdditionalProperty("consumerID", new AnyType("{uuid}"));
application.setAdditionalProperty("url", new AnyType("tcp://admin:public@localhost:1883"));
application.setAdditionalProperty("qos", new AnyType(1));
application.setAdditionalProperty("anArray", new AnyType(new int[]{1, 2, 3}));
application.setAdditionalProperty("anArray", new AnyType(new int[] { 1, 2, 3 }));

Map<String, Object> obj = new HashMap();
obj.put("ONE", 1);
obj.put("TWO", 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,30 @@
package io.fabric8.it.dummy;

import com.fasterxml.jackson.databind.JsonNode;
import io.argoproj.v1alpha1.Application;
import io.argoproj.v1alpha1.ApplicationSpec;
import io.argoproj.v1alpha1.application.Operation;
import io.argoproj.v1alpha1.application.operation.InitiatedBy;
import io.argoproj.v1alpha1.applicationspec.Destination;
import io.fabric8.java.generator.testing.KubernetesResourceDiff;
import io.fabric8.kubernetes.api.model.ObjectMeta;
import io.fabric8.kubernetes.client.utils.Serialization;
import org.junit.jupiter.api.Test;
import io.fabric8.java.generator.testing.KubernetesResourceDiff;

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.Files;
import java.util.List;
import io.argoproj.v1alpha1.Application;
import io.argoproj.v1alpha1.ApplicationSpec;
import io.argoproj.v1alpha1.applicationspec.Destination;
import io.argoproj.v1alpha1.application.Operation;
import io.argoproj.v1alpha1.application.operation.InitiatedBy;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;

class TestToplevelFields {

@Test
void testDeserialization() {
// Arrange
Application sample =
Serialization.unmarshal(getClass().getResourceAsStream("/sample-tl-operation.yaml"), Application.class);
Application sample = Serialization.unmarshal(getClass().getResourceAsStream("/sample-tl-operation.yaml"),
Application.class);
// Assert
assertEquals(0, sample.getAdditionalProperties().size());
}
Expand All @@ -65,6 +64,7 @@ private Application createSampleApplication() throws Exception {
application.setOperation(op);
return application;
}

@Test
void testAgainstSample() throws Exception {
// Arrange
Expand Down

0 comments on commit 277b531

Please sign in to comment.