Skip to content

Commit

Permalink
Merge pull request #9 from rnc/PORT
Browse files Browse the repository at this point in the history
Run copy-artifacts with custom port
  • Loading branch information
rnc authored Dec 23, 2024
2 parents fbca71d + 66fff6d commit 70a5719
Show file tree
Hide file tree
Showing 214 changed files with 6,090 additions and 2 deletions.
10 changes: 10 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@
</dependencyManagement>

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-config-yaml</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-picocli</artifactId>
Expand Down Expand Up @@ -128,6 +132,12 @@
<version>3.10.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.26.3</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public void run() {

Log.infof("Found %d POMs and %d JARs in %s", pomFiles.size(), jarFiles.size(), sourcePath);

Files.createDirectories(deployPath);

for (var entry : pomFiles.entrySet()) {
var gav = entry.getKey();
Log.debugf("POM has GAV %s", gavToCoords(gav));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public void run() {
}
}

private String getContainerFile() {
String getContainerFile() {
String containerFile = """
FROM %s
USER 0
Expand Down Expand Up @@ -295,7 +295,6 @@ private String getMavenSetup() {
<protocol>http</protocol>
<host>domain-proxy</host>
<port>80</port>
<!-- <username>build-ADDTW3JAGHYAA+tracking</username> -->
<username>${BUILD_ID}+tracking</username>
<password>${ACCESS_TOKEN}</password>
<nonProxyHosts>${PROXY_URL}|localhost</nonProxyHosts>
Expand Down
9 changes: 9 additions & 0 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
quarkus:
application:
name: konflux-tooling
log:
category:
"org.jboss.pnc.konfluxtooling":
level: INFO
http:
port: 8084
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
package org.jboss.pnc.konfluxtooling.deploy;

import static org.assertj.core.api.Assertions.assertThat;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import io.quarkus.test.LogCollectingTestResource;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.common.ResourceArg;
import io.quarkus.test.junit.QuarkusTest;

@QuarkusTest
@QuarkusTestResource(value = LogCollectingTestResource.class, restrictToAnnotatedClass = true, initArgs = @ResourceArg(name = LogCollectingTestResource.LEVEL, value = "FINE"))
class CopyArtifactsCommandTest {
@BeforeEach
void clearLogs() {
LogCollectingTestResource.current().clear();
}

void testDeployArtifacts(String dir, String logMessage, String... artifacts) throws IOException {
var command = new CopyArtifactsCommand();
command.sourcePath = Path.of("src/test/resources/copy-artifacts", dir).toAbsolutePath();
assertThat(command.sourcePath).isDirectory();
var tempDirectory = Files.createTempDirectory("copy-artifacts-test");
assertThat(tempDirectory).isDirectory();
command.deployPath = tempDirectory.resolve("artifacts");
assertThat(command.deployPath).doesNotExist();
command.run();

if (!logMessage.isEmpty()) {
assertThat(LogCollectingTestResource.current().getRecords()).map(LogCollectingTestResource::format)
.contains(logMessage);
}

try (var stream = Files.walk(command.deployPath)) {
assertThat(stream).filteredOn(Files::isRegularFile).map(path -> path.getFileName().toString())
.containsExactlyInAnyOrder(artifacts);
}
}

@Test
void testAsm() throws IOException {
testDeployArtifacts("asm", "Skipping POM asm-all.pom with invalid version @product.artifact@", "asm-5.0.3.jar",
"asm-5.0.3.pom", "asm-all-5.0.3.jar", "asm-all-5.0.3.pom",
"asm-analysis-5.0.3.jar", "asm-analysis-5.0.3.pom", "asm-commons-5.0.3.jar", "asm-commons-5.0.3.pom",
"asm-debug-all-5.0.3.jar", "asm-debug-all-5.0.3.pom", "asm-parent-5.0.3.pom", "asm-tree-5.0.3.jar",
"asm-tree-5.0.3.pom", "asm-util-5.0.3.jar", "asm-util-5.0.3.pom", "asm-xml-5.0.3.jar", "asm-xml-5.0.3.pom");
}

@Test
void testBeanshell() throws IOException {
testDeployArtifacts("beanshell", "", "bsh-2.0b6.jar", "bsh-2.0b6.pom");
}

@Test
void testIcu4J() throws IOException {
testDeployArtifacts("icu4j", "", "icu4j-71.1.jar", "icu4j-71.1.pom", "icu4j-charset-71.1.jar", "icu4j-charset-71.1.pom",
"icu4j-localespi-71.1.jar", "icu4j-localespi-71.1.pom");
}

@Test
void testJdom() throws IOException {
testDeployArtifacts("jdom", "Skipping POM maven.pom with invalid version @version@", "jdom2-2.x-2024.03.01.10.00.jar",
"jdom2-2.x-2024.03.01.10.00.pom");
}

@Test
void testLombok() throws IOException {
testDeployArtifacts("lombok", "Skipping POM pom.xml with invalid version 1.0-SNAPSHOT", "lombok-1.18.24.jar",
"lombok-1.18.24.pom");
}

@Test
void testLz4Java() throws IOException {
testDeployArtifacts("lz4-java", "", "lz4-java-1.8.0.jar", "lz4-java-1.8.0.pom", "lz4-pure-java-1.8.0.jar",
"lz4-pure-java-1.8.0.pom");
}

@Test
void testTomcat() throws IOException {
testDeployArtifacts("tomcat", "Skipping POM tomcat-annotations-api.pom with invalid version @MAVEN.DEPLOY.VERSION@",
"tomcat-annotations-api-10.1.19.jar", "tomcat-annotations-api-10.1.19.pom", "tomcat-api-10.1.19.jar",
"tomcat-api-10.1.19.pom", "tomcat-catalina-10.1.19.jar", "tomcat-catalina-10.1.19.pom",
"tomcat-catalina-ant-10.1.19.jar", "tomcat-catalina-ant-10.1.19.pom", "tomcat-catalina-ha-10.1.19.jar",
"tomcat-catalina-ha-10.1.19.pom", "tomcat-coyote-10.1.19.jar", "tomcat-coyote-10.1.19.pom",
"tomcat-dbcp-10.1.19.jar", "tomcat-dbcp-10.1.19.pom", "tomcat-el-api-10.1.19.jar", "tomcat-el-api-10.1.19.pom",
"tomcat-embed-core-10.1.19.jar", "tomcat-embed-core-10.1.19.pom", "tomcat-embed-el-10.1.19.jar",
"tomcat-embed-el-10.1.19.pom", "tomcat-embed-jasper-10.1.19.jar", "tomcat-embed-jasper-10.1.19.pom",
"tomcat-embed-programmatic-10.1.19.jar", "tomcat-embed-programmatic-10.1.19.pom",
"tomcat-embed-websocket-10.1.19.jar", "tomcat-embed-websocket-10.1.19.pom", "tomcat-jasper-10.1.19.jar",
"tomcat-jasper-10.1.19.pom", "tomcat-jasper-el-10.1.19.jar", "tomcat-jasper-el-10.1.19.pom",
"tomcat-jaspic-api-10.1.19.jar", "tomcat-jaspic-api-10.1.19.pom", "tomcat-jdbc-10.1.19.jar",
"tomcat-jdbc-10.1.19.pom", "tomcat-jni-10.1.19.jar", "tomcat-jni-10.1.19.pom", "tomcat-jsp-api-10.1.19.jar",
"tomcat-jsp-api-10.1.19.pom", "tomcat-juli-10.1.19.jar", "tomcat-juli-10.1.19.pom",
"tomcat-servlet-api-10.1.19.jar", "tomcat-servlet-api-10.1.19.pom", "tomcat-ssi-10.1.19.jar",
"tomcat-ssi-10.1.19.pom", "tomcat-storeconfig-10.1.19.jar", "tomcat-storeconfig-10.1.19.pom",
"tomcat-tribes-10.1.19.jar", "tomcat-tribes-10.1.19.pom", "tomcat-util-10.1.19.jar", "tomcat-util-10.1.19.pom",
"tomcat-util-scan-10.1.19.jar", "tomcat-util-scan-10.1.19.pom", "tomcat-websocket-10.1.19.jar",
"tomcat-websocket-10.1.19.pom", "tomcat-websocket-api-10.1.19.jar", "tomcat-websocket-api-10.1.19.pom",
"tomcat-websocket-client-api-10.1.19.jar", "tomcat-websocket-client-api-10.1.19.pom");
}
}
45 changes: 45 additions & 0 deletions src/test/resources/copy-artifacts/asm/archive/asm-all.pom
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!--
! ASM: a very small and fast Java bytecode manipulation framework
! Copyright (c) 2000-2011 INRIA, France Telecom
! All rights reserved.
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. Neither the name of the copyright holders nor the names of its
! contributors may be used to endorse or promote products derived from
! this software without specific prior written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
! LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
! THE POSSIBILITY OF SUCH DAMAGE.
-->

<project>
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-parent</artifactId>
<version>@product.artifact@</version>
</parent>

<name>ASM All</name>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-all</artifactId>
<packaging>jar</packaging>

</project>
51 changes: 51 additions & 0 deletions src/test/resources/copy-artifacts/asm/archive/asm-analysis.pom
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!--
! ASM: a very small and fast Java bytecode manipulation framework
! Copyright (c) 2000-2011 INRIA, France Telecom
! All rights reserved.
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. Neither the name of the copyright holders nor the names of its
! contributors may be used to endorse or promote products derived from
! this software without specific prior written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
! LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
! THE POSSIBILITY OF SUCH DAMAGE.
-->

<project>
<modelVersion>4.0.0</modelVersion>

<parent>
<artifactId>asm-parent</artifactId>
<groupId>org.ow2.asm</groupId>
<version>@product.artifact@</version>
</parent>

<name>ASM Analysis</name>
<artifactId>asm-analysis</artifactId>
<packaging>jar</packaging>

<dependencies>
<dependency>
<artifactId>asm-tree</artifactId>
<groupId>org.ow2.asm</groupId>
</dependency>
</dependencies>

</project>
51 changes: 51 additions & 0 deletions src/test/resources/copy-artifacts/asm/archive/asm-commons.pom
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!--
! ASM: a very small and fast Java bytecode manipulation framework
! Copyright (c) 2000-2011 INRIA, France Telecom
! All rights reserved.
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. Neither the name of the copyright holders nor the names of its
! contributors may be used to endorse or promote products derived from
! this software without specific prior written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
! LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
! THE POSSIBILITY OF SUCH DAMAGE.
-->

<project>
<modelVersion>4.0.0</modelVersion>

<parent>
<artifactId>asm-parent</artifactId>
<groupId>org.ow2.asm</groupId>
<version>@product.artifact@</version>
</parent>

<name>ASM Commons</name>
<artifactId>asm-commons</artifactId>
<packaging>jar</packaging>

<dependencies>
<dependency>
<artifactId>asm-tree</artifactId>
<groupId>org.ow2.asm</groupId>
</dependency>
</dependencies>

</project>
45 changes: 45 additions & 0 deletions src/test/resources/copy-artifacts/asm/archive/asm-debug-all.pom
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!--
! ASM: a very small and fast Java bytecode manipulation framework
! Copyright (c) 2000-2011 INRIA, France Telecom
! All rights reserved.
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. Neither the name of the copyright holders nor the names of its
! contributors may be used to endorse or promote products derived from
! this software without specific prior written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
! LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
! THE POSSIBILITY OF SUCH DAMAGE.
-->

<project>
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-parent</artifactId>
<version>@product.artifact@</version>
</parent>

<name>ASM Debug All</name>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-debug-all</artifactId>
<packaging>jar</packaging>

</project>
Loading

0 comments on commit 70a5719

Please sign in to comment.