diff --git a/crd-generator/maven-plugin/pom.xml b/crd-generator/maven-plugin/pom.xml index 90da64d467..e95238c91b 100644 --- a/crd-generator/maven-plugin/pom.xml +++ b/crd-generator/maven-plugin/pom.xml @@ -31,6 +31,11 @@ maven-plugin + + + ${project.version} + + org.apache.maven @@ -91,6 +96,36 @@ + + + org.apache.maven.plugins + maven-invoker-plugin + + ${project.build.directory}/it + true + + src/it/settings.xml + verify + true + ${skipTests} + true + invoker.properties + + ${project.version} + ${project.artifactId} + ${project.groupId} + + + + + integration-tests + + install + run + + + + diff --git a/crd-generator/maven-plugin/src/it/project-explicit/invoker.properties b/crd-generator/maven-plugin/src/it/project-explicit/invoker.properties new file mode 100644 index 0000000000..39321ee3b4 --- /dev/null +++ b/crd-generator/maven-plugin/src/it/project-explicit/invoker.properties @@ -0,0 +1,3 @@ +invoker.goals.1=clean package +invoker.mavenOpts= +invoker.debug=false diff --git a/crd-generator/maven-plugin/src/it/project-explicit/pom.xml b/crd-generator/maven-plugin/src/it/project-explicit/pom.xml new file mode 100644 index 0000000000..afbbca5504 --- /dev/null +++ b/crd-generator/maven-plugin/src/it/project-explicit/pom.xml @@ -0,0 +1,56 @@ + + 4.0.0 + + io.fabric8.crd.generator.samples + project-explicit + 0.1-SNAPSHOT + jar + + + + org.projectlombok + lombok + provided + @lombok.version@ + + + io.fabric8 + kubernetes-client-api + @fabric8-client.version@ + + + + + + + io.fabric8 + crd-generator-maven-plugin + + + + generate + + + + io.fabric8.crd.maven.example.explicit.v1.Multiple + io.fabric8.crd.maven.example.explicit.v2.Multiple + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + + + diff --git a/crd-generator/maven-plugin/src/it/project-explicit/src/main/java/io/fabric8/crd/maven/example/explicit/v1/Multiple.java b/crd-generator/maven-plugin/src/it/project-explicit/src/main/java/io/fabric8/crd/maven/example/explicit/v1/Multiple.java new file mode 100644 index 0000000000..862b636f63 --- /dev/null +++ b/crd-generator/maven-plugin/src/it/project-explicit/src/main/java/io/fabric8/crd/maven/example/explicit/v1/Multiple.java @@ -0,0 +1,10 @@ +package io.fabric8.crd.maven.example.explicit.v1; + +import io.fabric8.kubernetes.client.CustomResource; +import io.fabric8.kubernetes.model.annotation.Group; +import io.fabric8.kubernetes.model.annotation.Version; + +@Group("sample.fabric8.io") +@Version(value = "v1", storage = false) +public class Multiple extends CustomResource { +} diff --git a/crd-generator/maven-plugin/src/it/project-explicit/src/main/java/io/fabric8/crd/maven/example/explicit/v1/MultipleSpec.java b/crd-generator/maven-plugin/src/it/project-explicit/src/main/java/io/fabric8/crd/maven/example/explicit/v1/MultipleSpec.java new file mode 100644 index 0000000000..cd233acae4 --- /dev/null +++ b/crd-generator/maven-plugin/src/it/project-explicit/src/main/java/io/fabric8/crd/maven/example/explicit/v1/MultipleSpec.java @@ -0,0 +1,9 @@ +package io.fabric8.crd.maven.example.explicit.v1; + +public class MultipleSpec { + private String v1; + + public String getV1() { + return v1; + } +} diff --git a/crd-generator/maven-plugin/src/it/project-explicit/src/main/java/io/fabric8/crd/maven/example/explicit/v2/Multiple.java b/crd-generator/maven-plugin/src/it/project-explicit/src/main/java/io/fabric8/crd/maven/example/explicit/v2/Multiple.java new file mode 100644 index 0000000000..ec068e1b96 --- /dev/null +++ b/crd-generator/maven-plugin/src/it/project-explicit/src/main/java/io/fabric8/crd/maven/example/explicit/v2/Multiple.java @@ -0,0 +1,10 @@ +package io.fabric8.crd.maven.example.explicit.v2; + +import io.fabric8.kubernetes.client.CustomResource; +import io.fabric8.kubernetes.model.annotation.Group; +import io.fabric8.kubernetes.model.annotation.Version; + +@Group("sample.fabric8.io") +@Version("v2") +public class Multiple extends CustomResource { +} diff --git a/crd-generator/maven-plugin/src/it/project-explicit/src/main/java/io/fabric8/crd/maven/example/explicit/v2/MultipleSpec.java b/crd-generator/maven-plugin/src/it/project-explicit/src/main/java/io/fabric8/crd/maven/example/explicit/v2/MultipleSpec.java new file mode 100644 index 0000000000..04632bf6aa --- /dev/null +++ b/crd-generator/maven-plugin/src/it/project-explicit/src/main/java/io/fabric8/crd/maven/example/explicit/v2/MultipleSpec.java @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.crd.maven.example.explicit.v2; + +public class MultipleSpec { + private String v2; + + public String getV2() { + return v2; + } +} diff --git a/crd-generator/maven-plugin/src/it/project-explicit/verify.groovy b/crd-generator/maven-plugin/src/it/project-explicit/verify.groovy new file mode 100644 index 0000000000..f1ac3b58ec --- /dev/null +++ b/crd-generator/maven-plugin/src/it/project-explicit/verify.groovy @@ -0,0 +1,8 @@ +import io.fabric8.crd.generator.maven.plugin.Verify; + + +[ "multiples.sample.fabric8.io-v1" ].each { + Verify.verifyExist(new File(basedir, sprintf("/target/classes/META-INF/fabric8/%s.yml",it))) +} + +true diff --git a/crd-generator/maven-plugin/src/it/project-scan/invoker.properties b/crd-generator/maven-plugin/src/it/project-scan/invoker.properties new file mode 100644 index 0000000000..39321ee3b4 --- /dev/null +++ b/crd-generator/maven-plugin/src/it/project-scan/invoker.properties @@ -0,0 +1,3 @@ +invoker.goals.1=clean package +invoker.mavenOpts= +invoker.debug=false diff --git a/crd-generator/maven-plugin/src/it/project-scan/pom.xml b/crd-generator/maven-plugin/src/it/project-scan/pom.xml new file mode 100644 index 0000000000..5bb0d4e1e6 --- /dev/null +++ b/crd-generator/maven-plugin/src/it/project-scan/pom.xml @@ -0,0 +1,52 @@ + + 4.0.0 + + io.fabric8.crd.generator.samples + scan-project + 0.1-SNAPSHOT + + jar + + + + org.projectlombok + lombok + provided + @lombok.version@ + + + io.fabric8 + kubernetes-client-api + @fabric8-client.version@ + + + + + + + io.fabric8 + crd-generator-maven-plugin + @fabric8-client.version@ + + + + generate + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + + + diff --git a/crd-generator/maven-plugin/src/it/project-scan/src/main/java/io/fabric8/crd/maven/example/simple/v1/Multiple.java b/crd-generator/maven-plugin/src/it/project-scan/src/main/java/io/fabric8/crd/maven/example/simple/v1/Multiple.java new file mode 100644 index 0000000000..e524ae5192 --- /dev/null +++ b/crd-generator/maven-plugin/src/it/project-scan/src/main/java/io/fabric8/crd/maven/example/simple/v1/Multiple.java @@ -0,0 +1,10 @@ +package io.fabric8.crd.maven.example.simple.v1; + +import io.fabric8.kubernetes.client.CustomResource; +import io.fabric8.kubernetes.model.annotation.Group; +import io.fabric8.kubernetes.model.annotation.Version; + +@Group("sample.fabric8.io") +@Version(value = "v1", storage = false) +public class Multiple extends CustomResource { +} diff --git a/crd-generator/maven-plugin/src/it/project-scan/src/main/java/io/fabric8/crd/maven/example/simple/v1/MultipleSpec.java b/crd-generator/maven-plugin/src/it/project-scan/src/main/java/io/fabric8/crd/maven/example/simple/v1/MultipleSpec.java new file mode 100644 index 0000000000..b8a926e69d --- /dev/null +++ b/crd-generator/maven-plugin/src/it/project-scan/src/main/java/io/fabric8/crd/maven/example/simple/v1/MultipleSpec.java @@ -0,0 +1,8 @@ +package io.fabric8.crd.maven.example.simple.v1; + +import lombok.Data; + +@Data +public class MultipleSpec { + private String v1; +} diff --git a/crd-generator/maven-plugin/src/it/project-scan/src/main/java/io/fabric8/crd/maven/example/simple/v2/Multiple.java b/crd-generator/maven-plugin/src/it/project-scan/src/main/java/io/fabric8/crd/maven/example/simple/v2/Multiple.java new file mode 100644 index 0000000000..dd74f643dd --- /dev/null +++ b/crd-generator/maven-plugin/src/it/project-scan/src/main/java/io/fabric8/crd/maven/example/simple/v2/Multiple.java @@ -0,0 +1,10 @@ +package io.fabric8.crd.maven.example.simple.v2; + +import io.fabric8.kubernetes.client.CustomResource; +import io.fabric8.kubernetes.model.annotation.Group; +import io.fabric8.kubernetes.model.annotation.Version; + +@Group("sample.fabric8.io") +@Version("v2") +public class Multiple extends CustomResource { +} diff --git a/crd-generator/maven-plugin/src/it/project-scan/src/main/java/io/fabric8/crd/maven/example/simple/v2/MultipleSpec.java b/crd-generator/maven-plugin/src/it/project-scan/src/main/java/io/fabric8/crd/maven/example/simple/v2/MultipleSpec.java new file mode 100644 index 0000000000..4e94866de7 --- /dev/null +++ b/crd-generator/maven-plugin/src/it/project-scan/src/main/java/io/fabric8/crd/maven/example/simple/v2/MultipleSpec.java @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.crd.maven.example.simple.v2; + +import lombok.Data; + +@Data +public class MultipleSpec { + private String v2; +} diff --git a/crd-generator/maven-plugin/src/it/project-scan/verify.groovy b/crd-generator/maven-plugin/src/it/project-scan/verify.groovy new file mode 100644 index 0000000000..f1ac3b58ec --- /dev/null +++ b/crd-generator/maven-plugin/src/it/project-scan/verify.groovy @@ -0,0 +1,8 @@ +import io.fabric8.crd.generator.maven.plugin.Verify; + + +[ "multiples.sample.fabric8.io-v1" ].each { + Verify.verifyExist(new File(basedir, sprintf("/target/classes/META-INF/fabric8/%s.yml",it))) +} + +true diff --git a/crd-generator/maven-plugin/src/it/settings.xml b/crd-generator/maven-plugin/src/it/settings.xml new file mode 100644 index 0000000000..8890c85392 --- /dev/null +++ b/crd-generator/maven-plugin/src/it/settings.xml @@ -0,0 +1,35 @@ + + + + + it-repo + + true + + + + local.central + @localRepositoryUrl@ + + true + + + true + + + + + + local.central + @localRepositoryUrl@ + + true + + + true + + + + + + diff --git a/crd-generator/maven-plugin/src/test/java/io/fabric8/crd/generator/maven/plugin/Verify.java b/crd-generator/maven-plugin/src/test/java/io/fabric8/crd/generator/maven/plugin/Verify.java new file mode 100644 index 0000000000..aaeee4b7a9 --- /dev/null +++ b/crd-generator/maven-plugin/src/test/java/io/fabric8/crd/generator/maven/plugin/Verify.java @@ -0,0 +1,10 @@ +package io.fabric8.crd.generator.maven.plugin; + +import java.io.File; + +class Verify { + static void verifyExist(File file) { + if (!file.exists()) + throw new AssertionError("File " + file.getAbsoluteFile() + " does not exist"); + } +}