-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chore: Add Keycloak model as a dependency to crd-generator tests
And generate crd from it to verify that it can be done without StackOverwlows and other errors. No other verifications are performed.
- Loading branch information
Showing
4 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
crd-generator/test/src/test/java/io/fabric8/crd/generator/keycloak/KeycloakRealm.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* 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.generator.keycloak; | ||
|
||
import io.fabric8.crd.generator.annotation.SchemaSwap; | ||
import io.fabric8.kubernetes.api.model.Namespaced; | ||
import io.fabric8.kubernetes.client.CustomResource; | ||
import io.fabric8.kubernetes.model.annotation.Group; | ||
import io.fabric8.kubernetes.model.annotation.Version; | ||
import org.keycloak.representations.idm.ComponentExportRepresentation; | ||
import org.keycloak.representations.idm.GroupRepresentation; | ||
import org.keycloak.representations.idm.RealmRepresentation; | ||
import org.keycloak.representations.idm.authorization.ScopeRepresentation; | ||
|
||
@Group("sample.fabric8.io") | ||
@Version("v1alpha1") | ||
@SchemaSwap(originalType = ComponentExportRepresentation.class, fieldName = "subComponents") | ||
@SchemaSwap(originalType = GroupRepresentation.class, fieldName = "subGroups") | ||
@SchemaSwap(originalType = ScopeRepresentation.class, fieldName = "policies") | ||
@SchemaSwap(originalType = ScopeRepresentation.class, fieldName = "resources") | ||
public class KeycloakRealm extends CustomResource<RealmRepresentation, Void> implements Namespaced { | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
crd-generator/test/src/test/java/io/fabric8/crd/generator/keycloak/KeycloakRealmCRDTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* 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.generator.keycloak; | ||
|
||
import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinition; | ||
import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinitionVersion; | ||
import io.fabric8.kubernetes.api.model.apiextensions.v1.JSONSchemaProps; | ||
import io.fabric8.kubernetes.client.utils.Serialization; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.Map; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
class KeycloakRealmCRDTest { | ||
|
||
@Test | ||
void testCrd() { | ||
CustomResourceDefinition d = Serialization.unmarshal(getClass().getClassLoader() | ||
.getResourceAsStream("META-INF/fabric8/keycloakrealms.sample.fabric8.io-v1.yml"), | ||
CustomResourceDefinition.class); | ||
assertNotNull(d); // just make sure it generates | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters