wildfly / wildfly-glow

Galleon Layers Output from War: Automatic discover of WildFly provisioning information from an application.
Apache License 2.0
7 stars 5 forks source link

config-name has no effect with wildfly-glow-arquillian-plugin #77

Closed jamezp closed 1 week ago

jamezp commented 4 weeks ago

Migrated from: https://issues.redhat.com/browse/WFARQ-172

I specified standalone-full.xml on wildfly-glow-arquillian-plugin configuration, but it seems to be ignored. I need to specify into maven-surefire-plugin systemPropertyVariable the variable jboss.server.config.file.name

Please take a look to my pom.xml

<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>ch.nda.test</groupId>
  <artifactId>arquillian-tutorial</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>arquillian-tutorial</name>
  <url>http://maven.apache.org</url>

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

  <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.11.0</version>
                <configuration>
                    <release>17</release>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.2.5</version>
                <configuration>
                    <systemPropertyVariables>
                        <jboss.home>${project.build.directory}/server</jboss.home>
                        <!-- need to be specified even if already specified in wildfly-glow-arquillian-plugin -->
                        <jboss.server.config.file.name>standalone-full.xml</jboss.server.config.file.name>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.wildfly.glow</groupId>
                <artifactId>wildfly-glow-arquillian-plugin</artifactId>
                <version>1.0.6.Final</version>
                <configuration>
                    <verbose>true</verbose>
                    <!-- no effect -->
                    <config-name>standalone-full.xml</config-name>
                    <add-ons>
                        <add-on>mariadb</add-on>
                        <add-on>wildfly-cli</add-on>
                        <add-on>remote-activemq</add-on>
                    </add-ons>
                    <server-version>31.0.1.Final</server-version>
                </configuration>
                <executions>
                    <execution>
                        <id>scan</id>
                        <goals>
                            <goal>scan</goal>
                        </goals>
                        <phase>test-compile</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.wildfly.plugins</groupId>
                <artifactId>wildfly-maven-plugin</artifactId>
                <version>5.0.0.Final</version>
                <configuration>
                    <overwrite-provisioned-server>true</overwrite-provisioned-server>
                    <provisioning-file>${project.build.directory}/glow-scan/provisioning.xml</provisioning-file>
                    <server-config>standalone-full.xml</server-config>
                    <env>
                        <MARIADB_DATASOURCE>testDS</MARIADB_DATASOURCE>
                        <MARIADB_JNDI>java:/jdbc/testDS</MARIADB_JNDI>
                        <MARIADB_URL>jdbc:mariadb://testsrv:3306/test</MARIADB_URL>
                        <MARIADB_USER>test</MARIADB_USER>
                        <MARIADB_PASSWORD>test</MARIADB_PASSWORD>
                    </env>
                    <discover-provisioning-info>
                        <version>31.0.1.Final</version>
                        <verbose>true</verbose>
                    </discover-provisioning-info>
                </configuration>
                <executions>
                    <execution>
                        <id>test-provisioning</id>
                        <goals>
                            <goal>provision</goal>
                        </goals>
                        <phase>test-compile</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>org.jboss.ejb3</groupId>
            <artifactId>jboss-ejb3-ext-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.persistence</groupId>
            <artifactId>jakarta.persistence-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.annotation</groupId>
            <artifactId>jakarta.annotation-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.ejb</groupId>
            <artifactId>jakarta.ejb-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.jms</groupId>
            <artifactId>jakarta.jms-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.inject</groupId>
            <artifactId>jakarta.inject-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.enterprise</groupId>
            <artifactId>jakarta.enterprise.cdi-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.arquillian.junit</groupId>
            <artifactId>arquillian-junit-container</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.wildfly.arquillian</groupId>
            <artifactId>wildfly-arquillian-container-managed</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.wildfly.bom</groupId>
                <artifactId>wildfly-ee-with-tools</artifactId>
                <version>31.0.1.Final</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.jboss.arquillian</groupId>
                <artifactId>arquillian-bom</artifactId>
                <version>1.8.0.Final</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
        </dependencies>
    </dependencyManagement>
</project>
jfdenise commented 4 weeks ago

@jamezp , I think the issue is in the wildfly-maven-plugin You should remove:

<server-config>standalone-full.xml</server-config>
<discover-provisioning-info>
 <version>31.0.1.Final</version>
 <verbose>true</verbose>
</discover-provisioning-info>

I suspect the provisioning.xml generated by the first plugin is ignored.

jamezp commented 4 weeks ago

Thanks @jfdenise. I've linked the comment on the JIRA.

deamn commented 4 weeks ago

Hello, I tested like jfdenise's suggestion but it's the same error. If I omit system variable jboss.server.config.file.name and remove the line like suggested, I have this error

ERROR [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0055: Caught exception during boot: org.jboss.as.controller.persistence.ConfigurationPersistenceException: WFLYCTL0085: Failed to parse configuration at org.jboss.as.controller@23.0.3.Final//org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:123) at org.jboss.as.server@23.0.3.Final//org.jboss.as.server.ServerService.boot(ServerService.java:386) at org.jboss.as.controller@23.0.3.Final//org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:362) at java.base/java.lang.Thread.run(Thread.java:840) Caused by: java.io.FileNotFoundException: /home/deamn/git/arquillian-tutorial/target/server/standalone/configuration/standalone.xml (Aucun fichier ou dossier de ce nom)

But with the system variable jboss.server.config.file.name it works.

jfdenise commented 3 weeks ago

Could you share the pom that you updated following the suggestions? Thank-you.

deamn commented 3 weeks ago
<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>ch.nda.test</groupId>
  <artifactId>arquillian-tutorial</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>arquillian-tutorial</name>
  <url>http://maven.apache.org</url>

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

  <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.11.0</version>
                <configuration>
                    <release>17</release>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.2.5</version>
                <configuration>
                    <systemPropertyVariables>
                        <jboss.home>${project.build.directory}/server</jboss.home>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.wildfly.glow</groupId>
                <artifactId>wildfly-glow-arquillian-plugin</artifactId>
                <version>1.0.6.Final</version>
                <configuration>
                    <verbose>true</verbose>
                    <!-- no effect -->
                    <config-name>standalone-full.xml</config-name>
                    <add-ons>
                        <add-on>mariadb</add-on>
                        <add-on>wildfly-cli</add-on>
                        <add-on>remote-activemq</add-on>
                    </add-ons>
                    <server-version>31.0.1.Final</server-version>
                </configuration>
                <executions>
                    <execution>
                        <id>scan</id>
                        <goals>
                            <goal>scan</goal>
                        </goals>
                        <phase>test-compile</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.wildfly.plugins</groupId>
                <artifactId>wildfly-maven-plugin</artifactId>
                <version>5.0.0.Final</version>
                <configuration>
                    <overwrite-provisioned-server>true</overwrite-provisioned-server>
                    <provisioning-file>${project.build.directory}/glow-scan/provisioning.xml</provisioning-file>
                    <env>
                        <MARIADB_DATASOURCE>testDS</MARIADB_DATASOURCE>
                        <MARIADB_JNDI>java:/jdbc/testDS</MARIADB_JNDI>
                        <MARIADB_URL>jdbc:mariadb://testsrv:3306/test</MARIADB_URL>
                        <MARIADB_USER>test</MARIADB_USER>
                        <MARIADB_PASSWORD>test</MARIADB_PASSWORD>
                    </env>
                </configuration>
                <executions>
                    <execution>
                        <id>test-provisioning</id>
                        <goals>
                            <goal>provision</goal>
                        </goals>
                        <phase>test-compile</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>org.jboss.ejb3</groupId>
            <artifactId>jboss-ejb3-ext-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.persistence</groupId>
            <artifactId>jakarta.persistence-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.annotation</groupId>
            <artifactId>jakarta.annotation-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.ejb</groupId>
            <artifactId>jakarta.ejb-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.jms</groupId>
            <artifactId>jakarta.jms-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.inject</groupId>
            <artifactId>jakarta.inject-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.enterprise</groupId>
            <artifactId>jakarta.enterprise.cdi-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.arquillian.junit</groupId>
            <artifactId>arquillian-junit-container</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.wildfly.arquillian</groupId>
            <artifactId>wildfly-arquillian-container-managed</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.wildfly.bom</groupId>
                <artifactId>wildfly-ee-with-tools</artifactId>
                <version>31.0.1.Final</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.jboss.arquillian</groupId>
                <artifactId>arquillian-bom</artifactId>
                <version>1.8.0.Final</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
        </dependencies>
    </dependencyManagement>
</project>
jfdenise commented 3 weeks ago

@deamn , I just ran this pom.xml with some src and I can see:

What is the name of the generated file there for you?

deamn commented 3 weeks ago

@jfdenise it's the same file. I would like to run with standalone-full.xml and it's that file being generated. But when the provisioned wildfly is started for the test, it's seems that it is the standalone.xml that is passed for running wildfly

jfdenise commented 3 weeks ago

Ah, you need to start the server in your test with -c standalone-full.xml option.

deamn commented 3 weeks ago

Where I need to add this argument? I trying to apply your blog example WildFly testing with WildFly Glow. A simple and comprehensive example would be great. Is not wildfly-maven-plugin that starts the provisioned wildfly server for testing?

jfdenise commented 2 weeks ago

The servers are started by maven-surefire-plugin during test execution Look at this example:

jfdenise commented 2 weeks ago

@deamn , can we close this issue? To me the problem is unrelated to Glow that works as expected. Thank-you.

jfdenise commented 1 week ago

@deamn I am closing it, feel free to re-open in case of problem.

deamn commented 1 week ago

@jfdenise Thanks for the example, I'm quiet busy and I didn't have time to test it. I will not available next weeks, I will try soon as possible.