107 for (ModuleId mid : mids) {
108 assert equals(rr.readModuleInfo(mid),
109 pr.readModuleInfo(mid));
110 assert equals(rr.fetch(mid), pr.fetch(mid));
111 }
112 }
113
114 static List<URI> locations(RemoteRepositoryList rl)
115 throws IOException
116 {
117 List<URI> us = new ArrayList<>();
118 for (RemoteRepository rr : rl.repositories())
119 us.add(rr.location());
120 return us;
121 }
122
123 static String localHost;
124
125 static URI local(int port, String path) throws Exception {
126 if (localHost == null)
127 localHost = InetAddress.getLocalHost().getHostName();
128 return URI.create("http://" + localHost + ":" + port + path);
129 }
130
131 static void testAddRemove(int port) throws Exception {
132
133 File LIB = new File("z.lib.addrem");
134 Set<StorageOption> opts = Collections.emptySet();
135 Library lib = SimpleLibrary.create(LIB, opts);
136 RemoteRepositoryList rl = lib.repositoryList();
137 assert rl.repositories().isEmpty();
138
139 URI u1 = local(port, "/foo");
140 RemoteRepository rr = rl.add(u1, 0);
141 assert rr != null;
142 u1 = URI.create(u1.toString() + "/");
143 System.out.printf("url: %s%n", u1);
144 System.out.printf("repository: %s%n", rr.location());
145 assert rr.location().equals(u1);
146 assertEquals(rl.repositories(), rr);
147
|
107 for (ModuleId mid : mids) {
108 assert equals(rr.readModuleInfo(mid),
109 pr.readModuleInfo(mid));
110 assert equals(rr.fetch(mid), pr.fetch(mid));
111 }
112 }
113
114 static List<URI> locations(RemoteRepositoryList rl)
115 throws IOException
116 {
117 List<URI> us = new ArrayList<>();
118 for (RemoteRepository rr : rl.repositories())
119 us.add(rr.location());
120 return us;
121 }
122
123 static String localHost;
124
125 static URI local(int port, String path) throws Exception {
126 if (localHost == null)
127 localHost = InetAddress.getLocalHost().getCanonicalHostName();
128 return URI.create("http://" + localHost + ":" + port + path);
129 }
130
131 static void testAddRemove(int port) throws Exception {
132
133 File LIB = new File("z.lib.addrem");
134 Set<StorageOption> opts = Collections.emptySet();
135 Library lib = SimpleLibrary.create(LIB, opts);
136 RemoteRepositoryList rl = lib.repositoryList();
137 assert rl.repositories().isEmpty();
138
139 URI u1 = local(port, "/foo");
140 RemoteRepository rr = rl.add(u1, 0);
141 assert rr != null;
142 u1 = URI.create(u1.toString() + "/");
143 System.out.printf("url: %s%n", u1);
144 System.out.printf("repository: %s%n", rr.location());
145 assert rr.location().equals(u1);
146 assertEquals(rl.repositories(), rr);
147
|