Skip to content

Commit

Permalink
Add more integration tests and verify content
Browse files Browse the repository at this point in the history
  • Loading branch information
baloo42 committed May 15, 2024
1 parent b79bae8 commit 2492a6e
Show file tree
Hide file tree
Showing 60 changed files with 1,780 additions and 104 deletions.
21 changes: 21 additions & 0 deletions crd-generator/maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@
<artifactId>${project.artifactId}</artifactId>
<groupId>${project.groupId}</groupId>
</scriptVariables>
<setupIncludes>
<setupInclude>test-dependencies/pom.xml</setupInclude>
</setupIncludes>
</configuration>
<executions>
<execution>
Expand All @@ -126,6 +129,24 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>${spotless-maven-plugin.version}</version>
<configuration>
<java>
<includes>
<include>src/main/java/**/*.java</include>
<include>src/test/java/**/*.java</include>
<include>src/it/**/src/main/java/**/*.java</include>
</includes>
</java>
<pom>
<includes>src/it/**/pom.xml</includes>
<sortPom/>
</pom>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Generated by Fabric8 CRDGenerator, manual edits might get overwritten!
apiVersion: "apiextensions.k8s.io/v1"
kind: "CustomResourceDefinition"
metadata:
name: "multiples.sample.fabric8.io"
spec:
group: "sample.fabric8.io"
names:
kind: "Multiple"
plural: "multiples"
singular: "multiple"
scope: "Cluster"
versions:
- name: "v2"
schema:
openAPIV3Schema:
properties:
spec:
properties:
v2:
type: "string"
type: "object"
status:
type: "object"
type: "object"
served: true
storage: true
- name: "v1"
schema:
openAPIV3Schema:
properties:
spec:
properties:
v1:
type: "string"
type: "object"
status:
type: "object"
type: "object"
served: true
storage: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# 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.
#

invoker.goals.1=clean package
invoker.mavenOpts=
invoker.debug=false
76 changes: 76 additions & 0 deletions crd-generator/maven-plugin/src/it/dependency-explicit/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>io.fabric8.crd.generator.samples</groupId>
<artifactId>dependency-scan</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-client-api</artifactId>
<version>@fabric8-client.version@</version>
</dependency>
<dependency>
<groupId>io.fabric8.crd.generator.maven.it</groupId>
<artifactId>custom-resources</artifactId>
<version>0.1-SNAPSHOT</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>crd-generator-maven-plugin</artifactId>
<version>@fabric8-client.version@</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<customResourceClasses>
<customResourceClass>io.fabric8.crd.maven.example.api.v1.Multiple</customResourceClass>
<customResourceClass>io.fabric8.crd.maven.example.api.v2.Multiple</customResourceClass>
</customResourceClasses>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>@maven.compiler.plugin.version@</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* 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.
*/
import io.fabric8.crd.generator.maven.plugin.Verify


[
"multiples.sample.fabric8.io-v1"
].each {
Verify.verifyContentEquals(
new File(basedir, sprintf("/target/classes/META-INF/fabric8/%s.yml",it)),
new File(basedir, sprintf("/expected/%s.yml",it)))
}

[
"mycustomresources.other.sample.fabric8.io-v1"
].each {
Verify.verifyAbsent(new File(basedir, sprintf("/target/classes/META-INF/fabric8/%s.yml", it)))
}

true
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Generated by Fabric8 CRDGenerator, manual edits might get overwritten!
apiVersion: "apiextensions.k8s.io/v1"
kind: "CustomResourceDefinition"
metadata:
name: "multiples.sample.fabric8.io"
spec:
group: "sample.fabric8.io"
names:
kind: "Multiple"
plural: "multiples"
singular: "multiple"
scope: "Cluster"
versions:
- name: "v2"
schema:
openAPIV3Schema:
properties:
spec:
properties:
v2:
type: "string"
type: "object"
status:
type: "object"
type: "object"
served: true
storage: true
- name: "v1"
schema:
openAPIV3Schema:
properties:
spec:
properties:
v1:
type: "string"
type: "object"
status:
type: "object"
type: "object"
served: true
storage: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Fabric8 CRDGenerator, manual edits might get overwritten!
apiVersion: "apiextensions.k8s.io/v1"
kind: "CustomResourceDefinition"
metadata:
name: "mycustomresources.other.sample.fabric8.io"
spec:
group: "other.sample.fabric8.io"
names:
kind: "MyCustomResource"
plural: "mycustomresources"
singular: "mycustomresource"
scope: "Cluster"
versions:
- name: "v1"
schema:
openAPIV3Schema:
properties:
spec:
type: "object"
status:
type: "object"
type: "object"
served: true
storage: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# 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.
#

invoker.goals.1=clean package
invoker.mavenOpts=
invoker.debug=false
78 changes: 78 additions & 0 deletions crd-generator/maven-plugin/src/it/dependency-indexed-scan/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>io.fabric8.crd.generator.samples</groupId>
<artifactId>dependency-indexed-scan</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-client-api</artifactId>
<version>@fabric8-client.version@</version>
</dependency>
<dependency>
<groupId>io.fabric8.crd.generator.maven.it</groupId>
<artifactId>custom-resources-with-index</artifactId>
<version>0.1-SNAPSHOT</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>crd-generator-maven-plugin</artifactId>
<version>@fabric8-client.version@</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<dependenciesToScan>
<dependency>
<groupId>io.fabric8.crd.generator.maven.it</groupId>
<artifactId>custom-resources-with-index</artifactId>
</dependency>
</dependenciesToScan>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>@maven.compiler.plugin.version@</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Loading

0 comments on commit 2492a6e

Please sign in to comment.