Skip to content

Commit

Permalink
Merge pull request bndtools#5515 from bjhargrave/https-domains
Browse files Browse the repository at this point in the history
Some test fixes to use https URLs
  • Loading branch information
bjhargrave committed Jan 14, 2023
2 parents c06cb4e + 6f58927 commit 2ec7755
Show file tree
Hide file tree
Showing 17 changed files with 51 additions and 58 deletions.
4 changes: 2 additions & 2 deletions aQute.libg/test/aQute/libg/uri/URIUtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public class URIUtilsTest {
@Test
public void testResolveAbsolute() throws Exception {
// reference is absolute, so base is irrelevant
URI result = URIUtil.resolve(URI.create("http://example.com/foo.xml"), "http://example.org/bar.xml");
assertThat(result).hasToString("http://example.org/bar.xml");
URI result = URIUtil.resolve(URI.create("http://example.com/foo.xml"), "https://example.org/bar.xml");
assertThat(result).hasToString("https://example.org/bar.xml");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
import aQute.bnd.test.jupiter.InjectTemporaryDirectory;
import aQute.lib.collections.MultiMap;
import aQute.lib.io.IO;
import aQute.libg.map.MAP;
import aQute.libg.map.MAP.MAPX;

@ExtendWith(SoftAssertionsExtension.class)
public class ClassIndexTest {
Expand All @@ -41,9 +39,9 @@ public void setUp() throws Exception {
ws = Workspace.getWorkspace(testDir);

MavenBndRepository mbr = new MavenBndRepository();
MAPX<String, String> map = MAP.$("releaseUrl", "https://repo1.maven.org/maven2/")
.$("readOnly", "true")
.$("source", IO.collect(IO.getFile(home, "test-1.mvn")));
Map<String, String> map = Map.of("releaseUrl", "https://repo.maven.apache.org/maven2/", //
"readOnly", "true", //
"source", IO.collect(IO.getFile(home, "test-1.mvn")));

mbr.setProperties(map);
mbr.setRegistry(ws);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.assertj.core.api.Assertions.assertThat;

import java.io.File;
import java.util.Map;

import org.junit.jupiter.api.Test;

Expand All @@ -15,8 +16,6 @@
import aQute.bnd.repository.maven.provider.MavenBndRepository;
import aQute.bnd.test.jupiter.InjectTemporaryDirectory;
import aQute.lib.io.IO;
import aQute.libg.map.MAP;
import aQute.libg.map.MAP.MAPX;

public class WorkspaceRepositoryTest {
@InjectTemporaryDirectory
Expand Down Expand Up @@ -173,9 +172,9 @@ void test(ConsumerWithException<Workspace> consumer) throws Exception {

try (Workspace ws = Workspace.getWorkspace(testDir)) {
MavenBndRepository mbr = new MavenBndRepository();
MAPX<String, String> map = MAP.$("releaseUrl", "https://repo1.maven.org/maven2/")
.$("readOnly", "true")
.$("source", IO.collect(IO.getFile(home, "test-1.mvn")));
Map<String, String> map = Map.of("releaseUrl", "https://repo.maven.apache.org/maven2/", //
"readOnly", "true", //
"source", IO.collect(IO.getFile(home, "test-1.mvn")));

mbr.setProperties(map);
mbr.setRegistry(ws);
Expand Down
10 changes: 5 additions & 5 deletions biz.aQute.bndlib.tests/test/test/MavenTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,12 @@ public void testMavenRepo1() throws Exception {
public void testMavenx() throws Exception {
Maven maven = new Maven(null);
CachedPom pom = maven.getPom("javax.xml.bind", "com.springsource.javax.xml.bind", "2.2.0",
new URI("http://repository.springsource.com/maven/bundles/release"),
new URI("http://repository.springsource.com/maven/bundles/external"));
new URI("https://repository.springsource.com/maven/bundles/release"),
new URI("https://repository.springsource.com/maven/bundles/external"));
// Pom pom = maven.getPom("javax.xml.ws",
// "com.springsource.javax.xml.ws", "2.1.1", new
// URL("http://repository.springsource.com/maven/bundles/release"), new
// URL("http://repository.springsource.com/maven/bundles/external"));
// URL("https://repository.springsource.com/maven/bundles/release"), new
// URL("https://repository.springsource.com/maven/bundles/external"));
System.err.println(pom.getGroupId() + " + " + pom.getArtifactId() + "-" + pom.getVersion());

System.err.println(pom.getDependencies(Pom.Scope.compile));
Expand Down Expand Up @@ -229,7 +229,7 @@ public void testPomParser() throws Exception {
//
// graph.addRepository( new URL("https://repo.maven.apache.org/maven2/"));
// graph.addRepository( new
// URL("http://repository.springsource.com/maven/bundles/external"));
// URL("https://repository.springsource.com/maven/bundles/external"));
// // graph.root.add(
// IO.getFile("testresources/poms/pom-1.xml").toURI().toURL());
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#NOTE: This is an internal implementation file, its format can be changed without prior notice.
#Wed Mar 30 11:38:26 CEST 2011
http\://repository.springsource.com/maven/bundles/external/.lastUpdated=1301477906233
http\://repository.jboss.com/maven2/.lastUpdated=1301477905614
http\://maven.springframework.org/snapshot/.lastUpdated=1301477904839
http\://repository.springsource.com/maven/bundles/release/.lastUpdated=1301477905759
http\://repository.jboss.com/maven2/.error=
http\://maven.springframework.org/snapshot/.error=
http\://repository.springsource.com/maven/bundles/release/.error=
https\://repository.springsource.com/maven/bundles/external/.lastUpdated=1301477906233
https\://repository.jboss.com/maven2/.lastUpdated=1301477905614
https\://maven.springframework.org/snapshot/.lastUpdated=1301477904839
https\://repository.springsource.com/maven/bundles/release/.lastUpdated=1301477905759
https\://repository.jboss.com/maven2/.error=
https\://maven.springframework.org/snapshot/.error=
https\://repository.springsource.com/maven/bundles/release/.error=
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#NOTE: This is an internal implementation file, its format can be changed without prior notice.
#Wed Mar 30 11:39:38 CEST 2011
http\://repository.springsource.com/maven/bundles/external/.lastUpdated=1301477978052
http\://repository.jboss.com/maven2/.lastUpdated=1301477977430
http\://maven.springframework.org/snapshot/.lastUpdated=1301477976616
http\://repository.springsource.com/maven/bundles/release/.lastUpdated=1301477977582
http\://repository.jboss.com/maven2/.error=
http\://maven.springframework.org/snapshot/.error=
http\://repository.springsource.com/maven/bundles/release/.error=
https\://repository.springsource.com/maven/bundles/external/.lastUpdated=1301477978052
https\://repository.jboss.com/maven2/.lastUpdated=1301477977430
https\://maven.springframework.org/snapshot/.lastUpdated=1301477976616
https\://repository.springsource.com/maven/bundles/release/.lastUpdated=1301477977582
https\://repository.jboss.com/maven2/.error=
https\://maven.springframework.org/snapshot/.error=
https\://repository.springsource.com/maven/bundles/release/.error=
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#NOTE: This is an internal implementation file, its format can be changed without prior notice.
#Mon Apr 11 15:25:58 CEST 2011
http\://repository.springsource.com/maven/bundles/external/.lastUpdated=1302528358636
http\://repository.springsource.com/maven/bundles/release/.lastUpdated=1302528352816
http\://repository.springsource.com/maven/bundles/release/.error=
https\://repository.springsource.com/maven/bundles/external/.lastUpdated=1302528358636
https\://repository.springsource.com/maven/bundles/release/.lastUpdated=1302528352816
https\://repository.springsource.com/maven/bundles/release/.error=
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#NOTE: This is an internal implementation file, its format can be changed without prior notice.
#Mon Apr 11 15:25:50 CEST 2011
http\://repository.springsource.com/maven/bundles/external/.lastUpdated=1302528350745
http\://repository.springsource.com/maven/bundles/release/.lastUpdated=1302528350108
http\://repository.springsource.com/maven/bundles/release/.error=
https\://repository.springsource.com/maven/bundles/external/.lastUpdated=1302528350745
https\://repository.springsource.com/maven/bundles/release/.lastUpdated=1302528350108
https\://repository.springsource.com/maven/bundles/release/.error=
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#NOTE: This is an internal implementation file, its format can be changed without prior notice.
#Wed Apr 13 12:42:00 CEST 2011
http\://repository.springsource.com/maven/bundles/external/.lastUpdated=1302691320835
http\://repository.springsource.com/maven/bundles/release/.lastUpdated=1302691318506
http\://repository.springsource.com/maven/bundles/release/.error=
https\://repository.springsource.com/maven/bundles/external/.lastUpdated=1302691320835
https\://repository.springsource.com/maven/bundles/release/.lastUpdated=1302691318506
https\://repository.springsource.com/maven/bundles/release/.error=
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#NOTE: This is an internal implementation file, its format can be changed without prior notice.
#Wed Apr 13 12:41:57 CEST 2011
http\://repository.springsource.com/maven/bundles/external/.lastUpdated=1302691317770
http\://repository.springsource.com/maven/bundles/release/.lastUpdated=1302691317425
http\://repository.springsource.com/maven/bundles/release/.error=
https\://repository.springsource.com/maven/bundles/external/.lastUpdated=1302691317770
https\://repository.springsource.com/maven/bundles/release/.lastUpdated=1302691317425
https\://repository.springsource.com/maven/bundles/release/.error=
4 changes: 0 additions & 4 deletions biz.aQute.bndlib/src/aQute/bnd/maven/support/Maven.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
import aQute.libg.reporter.ReporterAdapter;
import aQute.service.reporter.Reporter;

/*
http://repository.springsource.com/maven/bundles/external/org/apache/coyote/com.springsource.org.apache.coyote/6.0.24/com.springsource.org.apache.coyote-6.0.24.pom
http://repository.springsource.com/maven/bundles/external/org/apache/coyote/com.springsource.org.apache.coyote/6.0.24/com.springsource.org.apache.coyote-6.0.24.pom
*/
public class Maven {

final Map<String, MavenEntry> entries = new ConcurrentHashMap<>();
Expand Down
10 changes: 5 additions & 5 deletions biz.aQute.resolve/test/biz/aQute/resolve/StandaloneTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void testStandalone() throws Exception {

OSGiRepository f0 = (OSGiRepository) repositories.get(0);
assertEquals("foo", f0.getName());
assertEquals("http://example.org/index.xml", f0.getLocation());
assertEquals("https://example.org/index.xml", f0.getLocation());
}

@Test
Expand All @@ -43,11 +43,11 @@ public void testMultipleUrls() throws Exception {

OSGiRepository f0 = (OSGiRepository) repositories.get(0);
assertEquals("repo01", f0.getName());
assertEquals("http://example.org/index1.xml", f0.getLocation());
assertEquals("https://example.org/index1.xml", f0.getLocation());

OSGiRepository f1 = (OSGiRepository) repositories.get(1);
assertEquals("second", f1.getName());
assertEquals("http://example.org/index2.xml", f1.getLocation());
assertEquals("https://example.org/index2.xml", f1.getLocation());
}

@Test
Expand All @@ -71,7 +71,7 @@ public void testRelativeUrl() throws Exception {
OSGiRepository f1 = (OSGiRepository) repositories.get(1);
assertEquals("repo02", f1.getName());

assertEquals("http://example.org/index2.xml", f1.getLocation());
assertEquals("https://example.org/index2.xml", f1.getLocation());
}

@Test
Expand All @@ -86,7 +86,7 @@ public void testExtraAttribs() throws Exception {

OSGiRepository f0 = (OSGiRepository) repositories.get(0);
assertEquals("foo", f0.getName());
assertEquals("http://example.org/index.xml", f0.getLocation());
assertEquals("https://example.org/index.xml", f0.getLocation());

File cacheDir = IO.getFile(System.getProperty("user.home") + "/.custom_cache_dir");
assertEquals(cacheDir, f0.getRoot());
Expand Down
2 changes: 1 addition & 1 deletion biz.aQute.resolve/testdata/defltversions/index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</capability>
<capability namespace="osgi.content">
<attribute name="osgi.content" value="307bc7bbd89d16d6bc487c77825e89f4225b0914fc6b3d3b91772162eee3e0c0"/>
<attribute name="url" value="http://repository.springsource.com.s3.amazonaws.com/maven/bundles/external/org/apache/ant/com.springsource.org.apache.tools.ant.launch/1.8.1/com.springsource.org.apache.tools.ant.launch-1.8.1.jar"/>
<attribute name="url" value="https://repository.springsource.com/maven/bundles/external/org/apache/ant/com.springsource.org.apache.tools.ant.launch/1.8.1/com.springsource.org.apache.tools.ant.launch-1.8.1.jar"/>
<attribute name="size" type="Long" value="1336253"/>
<attribute name="mime" value="application/vnd.osgi.bundle"/>
</capability>
Expand Down
2 changes: 1 addition & 1 deletion biz.aQute.resolve/testdata/standalone/attribs.bndrun
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-standalone: http://example.org/index.xml; name=foo; cache=${user.home}/.custom_cache_dir
-standalone: https://example.org/index.xml; name=foo; cache=${user.home}/.custom_cache_dir
4 changes: 2 additions & 2 deletions biz.aQute.resolve/testdata/standalone/multi.bndrun
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-standalone:\
http://example.org/index1.xml,\
http://example.org/index2.xml; name=second
https://example.org/index1.xml,\
https://example.org/index2.xml; name=second
2 changes: 1 addition & 1 deletion biz.aQute.resolve/testdata/standalone/relative_url.bndrun
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-standalone:\
../larger-repo.xml,\
http://example.org/index2.xml
https://example.org/index2.xml
2 changes: 1 addition & 1 deletion biz.aQute.resolve/testdata/standalone/simple.bndrun
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-standalone: http://example.org/index.xml; name=foo
-standalone: https://example.org/index.xml; name=foo

0 comments on commit 2ec7755

Please sign in to comment.