-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for Issue #93, Introduce a rule to discover layer based on Annota…
…tion field value
- Loading branch information
Showing
9 changed files
with
216 additions
and
0 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
core/src/main/java/org/wildfly/glow/AnnotationFieldValue.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,64 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2024 Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. | ||
* | ||
* 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 org.wildfly.glow; | ||
|
||
/** | ||
* | ||
* @author jdenise | ||
*/ | ||
public class AnnotationFieldValue { | ||
|
||
private final String annotation; | ||
private final String fieldName; | ||
private final String fieldValue; | ||
private final Layer layer; | ||
|
||
public AnnotationFieldValue(String annotation, String fieldName, String fieldValue, Layer layer) { | ||
this.annotation = annotation; | ||
this.fieldName = fieldName; | ||
this.fieldValue = fieldValue; | ||
this.layer = layer; | ||
} | ||
|
||
/** | ||
* @return the annotation | ||
*/ | ||
public String getAnnotation() { | ||
return annotation; | ||
} | ||
|
||
/** | ||
* @return the fieldName | ||
*/ | ||
public String getFieldName() { | ||
return fieldName; | ||
} | ||
|
||
/** | ||
* @return the fieldValue | ||
*/ | ||
public String getFieldValue() { | ||
return fieldValue; | ||
} | ||
|
||
/** | ||
* @return the layer | ||
*/ | ||
public Layer getLayer() { | ||
return layer; | ||
} | ||
} |
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
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
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
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
22 changes: 22 additions & 0 deletions
22
...k/galleon-pack/src/main/resources/layers/standalone/annotation-field-value/layer-spec.xml
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,22 @@ | ||
<!-- | ||
~ JBoss, Home of Professional Open Source. | ||
~ Copyright 2024 Red Hat, Inc., and individual contributors | ||
~ as indicated by the @author tags. | ||
~ | ||
~ 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. | ||
--> | ||
|
||
<layer-spec xmlns="urn:jboss:galleon:layer-spec:2.0" name="annotation-field-value"> | ||
<props> | ||
<prop name="org.wildfly.rule.annotation.field.value-prop" value="org.wildfly.glow.test.rules.classes.annotation.field.value.FieldValue,prop=foo*"/> | ||
</props> | ||
</layer-spec> |
30 changes: 30 additions & 0 deletions
30
...java/org/wildfly/glow/rules/test/annotation/field/value/FieldValueAnnotationTestCase.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,30 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2024 Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. | ||
* | ||
* 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 org.wildfly.glow.rules.test.annotation.field.value; | ||
|
||
import org.junit.Test; | ||
import org.wildfly.glow.rules.test.AbstractLayerMetaDataTestCase; | ||
|
||
public class FieldValueAnnotationTestCase extends AbstractLayerMetaDataTestCase { | ||
|
||
@Test | ||
public void testValueAnnotationUsage() { | ||
testSingleClassWar(FieldValueAnnotationUsage.class, "annotation-field-value"); | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
...st/java/org/wildfly/glow/rules/test/annotation/field/value/FieldValueAnnotationUsage.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,24 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2024 Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. | ||
* | ||
* 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 org.wildfly.glow.rules.test.annotation.field.value; | ||
|
||
import org.wildfly.glow.test.rules.classes.annotation.field.value.FieldValue; | ||
|
||
@FieldValue(prop = "foo bar") | ||
public class FieldValueAnnotationUsage { | ||
} |
29 changes: 29 additions & 0 deletions
29
.../src/main/java/org/wildfly/glow/test/rules/classes/annotation/field/value/FieldValue.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,29 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2024 Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. | ||
* | ||
* 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 org.wildfly.glow.test.rules.classes.annotation.field.value; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Target({ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface FieldValue { | ||
public String prop() default ""; | ||
} |