diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8220ExtensionWithDITest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8220ExtensionWithDITest.java index 51db74df0..d99bdbfd4 100644 --- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8220ExtensionWithDITest.java +++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8220ExtensionWithDITest.java @@ -41,7 +41,7 @@ public MavenITmng8220ExtensionWithDITest() { public void testitModel() throws Exception { File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-8220-extension-with-di"); - Verifier verifier = newVerifier(new File(testDir, "extension").getAbsolutePath()); + Verifier verifier = newVerifier(new File(testDir, "extensions").getAbsolutePath()); verifier.addCliArgument("install"); verifier.execute(); verifier.verifyErrorFreeLog(); @@ -50,6 +50,9 @@ public void testitModel() throws Exception { verifier.addCliArgument("validate"); verifier.execute(); verifier.verifyErrorFreeLog(); - verifier.verifyTextInLog("[MNG-8220] DumbModelParser Called from extension"); + verifier.verifyTextInLog("[MNG-8220] DumbModelParser1 Called from extension"); + verifier.verifyTextInLog("[MNG-8220] DumbModelParser2 Called from extension"); + verifier.verifyTextInLog("[MNG-8220] DumbModelParser3 Called from extension"); + verifier.verifyTextInLog("[MNG-8220] DumbModelParser4 Called from extension"); } } diff --git a/core-it-suite/src/test/resources/mng-8220-extension-with-di/extension/src/main/resources/META-INF/maven/org.apache.maven.api.di.Inject b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extension/src/main/resources/META-INF/maven/org.apache.maven.api.di.Inject deleted file mode 100644 index cb4312828..000000000 --- a/core-it-suite/src/test/resources/mng-8220-extension-with-di/extension/src/main/resources/META-INF/maven/org.apache.maven.api.di.Inject +++ /dev/null @@ -1 +0,0 @@ -org.apache.maven.its.mng8220.extension.DumbModelParser \ No newline at end of file diff --git a/core-it-suite/src/test/resources/mng-8220-extension-with-di/extension/pom.xml b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension1/pom.xml similarity index 97% rename from core-it-suite/src/test/resources/mng-8220-extension-with-di/extension/pom.xml rename to core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension1/pom.xml index ce8930fdf..c9a04440b 100644 --- a/core-it-suite/src/test/resources/mng-8220-extension-with-di/extension/pom.xml +++ b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension1/pom.xml @@ -19,7 +19,7 @@ under the License. --> org.apache.maven.its.mng8220 - extension + extension1 1.0-SNAPSHOT jar diff --git a/core-it-suite/src/test/resources/mng-8220-extension-with-di/extension/src/main/java/org/apache/maven/its/mng8220/extension/DumbModelParser.java b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension1/src/main/java/org/apache/maven/its/mng8220/extension1/DumbModelParser1.java similarity index 88% rename from core-it-suite/src/test/resources/mng-8220-extension-with-di/extension/src/main/java/org/apache/maven/its/mng8220/extension/DumbModelParser.java rename to core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension1/src/main/java/org/apache/maven/its/mng8220/extension1/DumbModelParser1.java index 10e240381..9c3233098 100644 --- a/core-it-suite/src/test/resources/mng-8220-extension-with-di/extension/src/main/java/org/apache/maven/its/mng8220/extension/DumbModelParser.java +++ b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension1/src/main/java/org/apache/maven/its/mng8220/extension1/DumbModelParser1.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.its.mng8220.extension; +package org.apache.maven.its.mng8220.extension1; import java.nio.file.Path; import java.util.Map; @@ -34,16 +34,16 @@ @Singleton @Named -final class DumbModelParser implements ModelParser { +final class DumbModelParser1 implements ModelParser { private final Logger logger = LoggerFactory.getLogger(getClass()); @Inject - public DumbModelParser() {} + public DumbModelParser1() {} @Override public Optional locate(Path dir) { - logger.warn("[MNG-8220] DumbModelParser Called from extension"); + logger.warn("[MNG-8220] DumbModelParser1 Called from extension"); return Optional.empty(); } diff --git a/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension1/src/main/resources/META-INF/maven/org.apache.maven.api.di.Inject b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension1/src/main/resources/META-INF/maven/org.apache.maven.api.di.Inject new file mode 100644 index 000000000..851c005a9 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension1/src/main/resources/META-INF/maven/org.apache.maven.api.di.Inject @@ -0,0 +1 @@ +org.apache.maven.its.mng8220.extension1.DumbModelParser1 \ No newline at end of file diff --git a/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension2/pom.xml b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension2/pom.xml new file mode 100644 index 000000000..fe30147d8 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension2/pom.xml @@ -0,0 +1,38 @@ + + + + org.apache.maven.its.mng8220 + extension2 + 1.0-SNAPSHOT + jar + + + + org.apache.maven + maven-api-di + 4.0.0-beta-3 + + + org.apache.maven + maven-api-impl + 4.0.0-beta-3 + + + diff --git a/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension2/src/main/java/org/apache/maven/its/mng8220/extension2/DumbModelParser2.java b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension2/src/main/java/org/apache/maven/its/mng8220/extension2/DumbModelParser2.java new file mode 100644 index 000000000..4148be2da --- /dev/null +++ b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension2/src/main/java/org/apache/maven/its/mng8220/extension2/DumbModelParser2.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.maven.its.mng8220.extension2; + +import java.nio.file.Path; +import java.util.Map; +import java.util.Optional; + +import org.apache.maven.api.di.Inject; +import org.apache.maven.api.di.Named; +import org.apache.maven.api.model.Model; +import org.apache.maven.api.services.Source; +import org.apache.maven.api.spi.ModelParser; +import org.apache.maven.api.spi.ModelParserException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Named("dumb") +final class DumbModelParser2 implements ModelParser { + + private final Logger logger = LoggerFactory.getLogger(getClass()); + + @Inject + public DumbModelParser2() {} + + @Override + public Optional locate(Path dir) { + logger.warn("[MNG-8220] DumbModelParser2 Called from extension"); + return Optional.empty(); + } + + @Override + public Model parse(Source source, Map options) throws ModelParserException { + return null; + } +} diff --git a/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension2/src/main/resources/META-INF/maven/org.apache.maven.api.di.Inject b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension2/src/main/resources/META-INF/maven/org.apache.maven.api.di.Inject new file mode 100644 index 000000000..04276f780 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension2/src/main/resources/META-INF/maven/org.apache.maven.api.di.Inject @@ -0,0 +1 @@ +org.apache.maven.its.mng8220.extension2.DumbModelParser2 \ No newline at end of file diff --git a/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension3/pom.xml b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension3/pom.xml new file mode 100644 index 000000000..9863e5096 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension3/pom.xml @@ -0,0 +1,43 @@ + + + + org.apache.maven.its.mng8220 + extension3 + 1.0-SNAPSHOT + jar + + + + org.apache.maven + maven-api-spi + 4.0.0-beta-3 + + + org.slf4j + slf4j-api + 2.0.16 + + + javax.inject + javax.inject + 1 + + + diff --git a/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension3/src/main/java/org/apache/maven/its/mng8220/extension3/DumbModelParser3.java b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension3/src/main/java/org/apache/maven/its/mng8220/extension3/DumbModelParser3.java new file mode 100644 index 000000000..4d33f4e1a --- /dev/null +++ b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension3/src/main/java/org/apache/maven/its/mng8220/extension3/DumbModelParser3.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.maven.its.mng8220.extension3; + +import javax.inject.Inject; +import javax.inject.Named; + +import java.nio.file.Path; +import java.util.Map; +import java.util.Optional; + +import org.apache.maven.api.model.Model; +import org.apache.maven.api.services.Source; +import org.apache.maven.api.spi.ModelParser; +import org.apache.maven.api.spi.ModelParserException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Named("dumb") +final class DumbModelParser3 implements ModelParser { + + private final Logger logger = LoggerFactory.getLogger(getClass()); + + @Inject + public DumbModelParser3() {} + + @Override + public Optional locate(Path dir) { + logger.warn("[MNG-8220] DumbModelParser3 Called from extension"); + return Optional.empty(); + } + + @Override + public Model parse(Source source, Map options) throws ModelParserException { + return null; + } +} diff --git a/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension3/src/main/resources/META-INF/sisu/javax.inject.Named b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension3/src/main/resources/META-INF/sisu/javax.inject.Named new file mode 100644 index 000000000..ad043f434 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension3/src/main/resources/META-INF/sisu/javax.inject.Named @@ -0,0 +1 @@ +org.apache.maven.its.mng8220.extension3.DumbModelParser3 \ No newline at end of file diff --git a/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension4/pom.xml b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension4/pom.xml new file mode 100644 index 000000000..7f1c50f0d --- /dev/null +++ b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension4/pom.xml @@ -0,0 +1,43 @@ + + + + org.apache.maven.its.mng8220 + extension4 + 1.0-SNAPSHOT + jar + + + + org.apache.maven + maven-api-spi + 4.0.0-beta-3 + + + org.slf4j + slf4j-api + 2.0.16 + + + javax.inject + javax.inject + 1 + + + diff --git a/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension4/src/main/java/org/apache/maven/its/mng8220/extension4/DumbModelParser4.java b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension4/src/main/java/org/apache/maven/its/mng8220/extension4/DumbModelParser4.java new file mode 100644 index 000000000..a6c4951f5 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension4/src/main/java/org/apache/maven/its/mng8220/extension4/DumbModelParser4.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.maven.its.mng8220.extension4; + +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + +import java.nio.file.Path; +import java.util.Map; +import java.util.Optional; + +import org.apache.maven.api.model.Model; +import org.apache.maven.api.services.Source; +import org.apache.maven.api.spi.ModelParser; +import org.apache.maven.api.spi.ModelParserException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Named +@Singleton +final class DumbModelParser4 implements ModelParser { + + private final Logger logger = LoggerFactory.getLogger(getClass()); + + @Inject + public DumbModelParser4() {} + + @Override + public Optional locate(Path dir) { + logger.warn("[MNG-8220] DumbModelParser4 Called from extension"); + return Optional.empty(); + } + + @Override + public Model parse(Source source, Map options) throws ModelParserException { + return null; + } +} diff --git a/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension4/src/main/resources/META-INF/sisu/javax.inject.Named b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension4/src/main/resources/META-INF/sisu/javax.inject.Named new file mode 100644 index 000000000..a7e1eca30 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/extension4/src/main/resources/META-INF/sisu/javax.inject.Named @@ -0,0 +1 @@ +org.apache.maven.its.mng8220.extension4.DumbModelParser4 \ No newline at end of file diff --git a/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/pom.xml b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/pom.xml new file mode 100644 index 000000000..d5162b99e --- /dev/null +++ b/core-it-suite/src/test/resources/mng-8220-extension-with-di/extensions/pom.xml @@ -0,0 +1,33 @@ + + + + org.apache.maven.its.mng8220 + parent + 1.0-SNAPSHOT + pom + + + extension1 + extension2 + extension3 + extension4 + + + diff --git a/core-it-suite/src/test/resources/mng-8220-extension-with-di/test/.mvn/extensions.xml b/core-it-suite/src/test/resources/mng-8220-extension-with-di/test/.mvn/extensions.xml index 32b3b4ea3..5a77b5385 100644 --- a/core-it-suite/src/test/resources/mng-8220-extension-with-di/test/.mvn/extensions.xml +++ b/core-it-suite/src/test/resources/mng-8220-extension-with-di/test/.mvn/extensions.xml @@ -1,7 +1,22 @@ org.apache.maven.its.mng8220 - extension + extension1 + 1.0-SNAPSHOT + + + org.apache.maven.its.mng8220 + extension2 + 1.0-SNAPSHOT + + + org.apache.maven.its.mng8220 + extension3 + 1.0-SNAPSHOT + + + org.apache.maven.its.mng8220 + extension4 1.0-SNAPSHOT