Skip to content

Commit

Permalink
Add testdata
Browse files Browse the repository at this point in the history
  • Loading branch information
fabapp2 committed Nov 28, 2023
1 parent 29e9613 commit b981868
Show file tree
Hide file tree
Showing 24 changed files with 307 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cwa-server
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
**/target
**/.rewrite-cache
/dependency-project/pom.xml
/dependent-project/pom.xml
/user.home/.config/
/user.home/apache-maven-3.9.5/
/user.home/.m2/repository
/user.home/.m2/settings.xml
!/user.home/.m2/settings.xml.template
!/user.home/.m2/settings-security.xml
/reposilite-data/static
/reposilite-data/.local
/reposilite-data/plugins
/reposilite-data/reposilite.db
/reposilite-data/configuration.cdn
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Artifact Repository Test

Test that artifacts available in a private artifact repository configured in `~/.m2/settings.xml` can be accessed.
This is important as many enterprise projects use their private artifact repository to retrieve private dependencies.

- A private artifact repository using (https://github.com/dzikoysk/reposilite[reposilite]) is started in a Docker container.
The reposilite instance has a user configured (admin:secret) which can deploy and access artifacts.
- The repositories in the artifact repository (e.g. snapshot) require successful authentication (deploy + download).
- `dependency-project` has a simple class `DependencyClass` and gets deployed to the artifact repository.
- `dependent-project` depends on `dependency-project` and has a class `DependentClass` that uses `DependencyClass`
- `dependent-project` gets parsed
- The resulting AST has the type information of `dependency-project` resolved when the repository information and credentials were read from `settings.xml` and `security-settings.xml`.
Technical requirements:

- The port of the Docker container is dynamic and used in settings.xml and pom.xml.
- The local Maven installation of any system should not be affected by this test.
- The location of the Maven dir `.m2` must therefore point to a different location while the test is running.
This requires temporarily a different `.m2` location, here `testcode/maven-projects/private-repository/user.home/.m2`.
When deploying the `dependency-project` the path to `settings.xml` is provided, pointing to `testcode/maven-projects/private-repository/user.home/.m2/settings.xml`.
This file declares the location of the local Maven repository pointing to the same dir.
Because these paths can't be relative for this test and absolute paths


The `user.home` is set to point to `testcode/maven-projects/private-repository/user.home` which contains a `.m2` directory providing access configuration to the reposilite instance through `.m2/settings.xml` and `.m2/security-settings.xml`,
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>com.example.dependency</groupId>
<artifactId>dependency-project</artifactId>
<version>1.0-SNAPSHOT</version>

<name>dependency-project</name>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>

<distributionManagement>
<repository>
<id>repository-snapshots</id>
<name>Snapshots Repository</name>
<url>http://localhost:${port}/snapshots</url>
</repository>
</distributionManagement>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.example.dependency;
public class DependencyClass
{
private String value;

public String getValue() {
return value;
}

public void setValue(String value) {
this.value = value;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>com.example.dependent</groupId>
<artifactId>dependent-project</artifactId>
<version>1.0-SNAPSHOT</version>

<name>dependent-project</name>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>com.example.dependency</groupId>
<artifactId>dependency-project</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>

<repositories>
<repository>
<id>repository-snapshots</id>
<name>Snapshots Repository</name>
<url>http://localhost:${port}/snapshots</url>
</repository>
</repositories>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.example.dependent;

import com.example.dependency.DependencyClass;

public class DependentClass {
private DependencyClass dependencyClass;
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5c1fa9eb9814ca94bec1d507acb02910
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
453d6aa069f223e17d5505601a3a3a7f576d61f4
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>com.example.dependency</groupId>
<artifactId>dependency-project</artifactId>
<version>1.0-SNAPSHOT</version>

<name>dependency-project</name>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>

<distributionManagement>
<repository>
<id>repository-snapshots</id>
<name>Snapshots Repository</name>
<url>http://localhost:52260/snapshots</url>
</repository>
</distributionManagement>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b5e883c0ee08ff935cf96727bb8623f4
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
534f31aa5ef763fe4562871d4dbb167a5cdc26f0
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata modelVersion="1.1.0">
<groupId>com.example.dependency</groupId>
<artifactId>dependency-project</artifactId>
<versioning>
<lastUpdated>20231105102337</lastUpdated>
<snapshot>
<timestamp>20231105.102337</timestamp>
<buildNumber>1</buildNumber>
</snapshot>
<snapshotVersions>
<snapshotVersion>
<extension>pom</extension>
<value>1.0-20231105.102337-1</value>
<updated>20231105102337</updated>
</snapshotVersion>
<snapshotVersion>
<extension>jar</extension>
<value>1.0-20231105.102337-1</value>
<updated>20231105102337</updated>
</snapshotVersion>
</snapshotVersions>
</versioning>
<version>1.0-SNAPSHOT</version>
</metadata>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
40910b0eb66467f44ca8792bfe5a847e
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6262ab25ed0f7e2128fb26fab1acd090c535abaf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>com.example.dependency</groupId>
<artifactId>dependency-project</artifactId>
<versioning>
<versions>
<version>1.0-SNAPSHOT</version>
</versions>
<lastUpdated>20231105102337</lastUpdated>
</versioning>
</metadata>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9bf1c816b6c0f8166efd71605db83682
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4fa1150761b6af92a0b232fe8ec688b9e90d0f88
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"statistics": {
"enabled": true,
"resolvedRequestsInterval": "MONTHLY"
},
"web": {
"forwardedIp": "X-Forwarded-For"
},
"frontend": {
"id": "reposilite-repository",
"title": "Reposilite Repository",
"description": "Public Maven repository hosted through the Reposilite",
"organizationWebsite": "https://reposilite.com",
"organizationLogo": "https://avatars.githubusercontent.com/u/88636591",
"icpLicense": ""
},
"authentication": {
"ldap": {
"enabled": false,
"ssl": false,
"hostname": "ldap.domain.com",
"port": 389,
"baseDn": "dc=company,dc=com",
"searchUserDn": "cn=reposilite,ou=admins,dc=domain,dc=com",
"searchUserPassword": "reposilite-admin-secret",
"typeAttribute": "person",
"userAttribute": "cn",
"userFilter": "(&(objectClass=person)(ou=Maven Users))",
"userType": "PERSISTENT"
}
},
"maven": {
"repositories": [
{
"id": "releases",
"visibility": "PRIVATE",
"redeployment": false,
"preserveSnapshots": false,
"storageProvider": {
"type": "fs",
"quota": "100%",
"mount": ""
},
"storagePolicy": "PRIORITIZE_UPSTREAM_METADATA",
"proxied": []
},
{
"id": "snapshots",
"visibility": "PRIVATE",
"redeployment": true,
"preserveSnapshots": false,
"storageProvider": {
"type": "fs",
"quota": "100%",
"mount": "./snapshots"
},
"storagePolicy": "PRIORITIZE_UPSTREAM_METADATA",
"proxied": []
},
{
"id": "private",
"visibility": "PRIVATE",
"redeployment": false,
"preserveSnapshots": false,
"storageProvider": {
"type": "fs",
"quota": "100%",
"mount": ""
},
"storagePolicy": "PRIORITIZE_UPSTREAM_METADATA",
"proxied": []
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<settings xsi:schemaLocation='http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd'
xmlns='http://maven.apache.org/SETTINGS/1.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<localRepository>/Users/fkrueger/projects/spring-boot-migrator/sbm-support-rewrite/testcode/maven-projects/private-repository/user.home/.m2/repository</localRepository>
<servers>
<server>
<!-- must match the id in pom.xml -->
<id>repository-snapshots</id>
<username>user</username>
<!-- password is 'secret' -->
<password>secret</password>
</server>
</servers>
</settings>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<settingsSecurity>
<!-- password is 'password' -->
<master>{BzCEWWQMgMkHk0P8+Rr+hsscSisZT6A4+G9Mub7f/m4=}</master>
</settingsSecurity>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<settings xsi:schemaLocation='http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd'
xmlns='http://maven.apache.org/SETTINGS/1.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<localRepository>${user.home}/.m2/repository</localRepository>
<servers>
<server>
<!-- must match the id in pom.xml -->
<id>repository-snapshots</id>
<username>user</username>
<!-- password is 'secret' -->
<password>{iKYxpFKiVu0HTAe4w0RAzev3TAav0DG8wEom2qNoRws=}</password>
<!--password>secret</password-->
</server>
</servers>
</settings>

0 comments on commit b981868

Please sign in to comment.