use of com.artipie.asto.test.TestResource in project artipie by artipie.
the class RepositoriesFromStorageCacheTest method readAliasesFromCache.
@Test
void readAliasesFromCache() {
final Key alias = new Key.From("_storages.yaml");
final Key config = new Key.From("bin.yaml");
new TestResource(alias.string()).saveTo(this.storage);
new BlockingStorage(this.storage).save(config, "repo:\n storage: default".getBytes());
final ClientSlices http = new JettyClientSlices();
new RepositoriesFromStorage(http, this.storage).config(config.string()).toCompletableFuture().join();
this.storage.save(alias, Content.EMPTY).join();
MatcherAssert.assertThat(new RepositoriesFromStorage(http, this.storage).config(config.string()).toCompletableFuture().join().storageOpt().isPresent(), new IsEqual<>(true));
}
use of com.artipie.asto.test.TestResource in project artipie by artipie.
the class CondaITCase method canInstallFromArtipie.
@Test
void canInstallFromArtipie() throws IOException {
this.moveCondarc();
this.containers.putBinaryToArtipie(new TestResource("conda/packages.json").asBytes(), "/var/artipie/data/my-conda/linux-64/repodata.json");
this.containers.putBinaryToArtipie(new TestResource("conda/snappy-1.1.3-0.tar.bz2").asBytes(), "/var/artipie/data/my-conda/linux-64/snappy-1.1.3-0.tar.bz2");
this.containers.assertExec("Package snappy-1.1.3-0 was not installed successfully", new ContainerResultMatcher(new IsEqual<>(0), Matchers.allOf(new StringContains("http://artipie:8080/my-conda"), new StringContains("linux-64::snappy-1.1.3-0"))), "conda", "install", "--verbose", "-y", "snappy");
}
use of com.artipie.asto.test.TestResource in project maven-adapter by artipie.
the class MavenITCase method copyHellowordSourceToContainer.
private void copyHellowordSourceToContainer() throws IOException {
FileUtils.copyDirectory(new TestResource("helloworld-src").asPath().toFile(), this.tmp.resolve("helloworld-src").toFile());
Files.write(this.tmp.resolve("helloworld-src/pom.xml"), String.format(Files.readString(this.tmp.resolve("helloworld-src/pom.xml.template")), this.port).getBytes());
}
use of com.artipie.asto.test.TestResource in project maven-adapter by artipie.
the class AstoMavenTest method addFilesToStorage.
private void addFilesToStorage(final Predicate<String> condition, final Key base) {
final Storage resources = new FileStorage(new TestResource("com/artipie/asto").asPath());
final BlockingStorage bsto = new BlockingStorage(resources);
bsto.list(Key.ROOT).stream().map(Key::string).filter(condition).forEach(item -> new BlockingStorage(this.storage).save(new Key.From(base, item), bsto.value(new Key.From(item))));
}
use of com.artipie.asto.test.TestResource in project maven-adapter by artipie.
the class AstoMavenTest method generatesMetadataForFirstArtifact.
@Test
void generatesMetadataForFirstArtifact() {
final String version = "1.0";
new TestResource("maven-metadata.xml.example").saveTo(this.storage, new Key.From(AstoMavenTest.LGR_UPLOAD, version, PutMetadataSlice.SUB_META, "maven-metadata.xml"));
new AstoMaven(this.storage).update(new Key.From(AstoMavenTest.LGR_UPLOAD, version), AstoMavenTest.LGR).toCompletableFuture().join();
MatcherAssert.assertThat("Maven metadata xml is not correct", new XMLDocument(this.storage.value(new Key.From(AstoMavenTest.LGR, "maven-metadata.xml")).thenCompose(content -> new PublisherAs(content).string(StandardCharsets.UTF_8)).join()), new AllOf<>(new ListOf<Matcher<? super XML>>(XhtmlMatchers.hasXPath("/metadata/groupId[text() = 'com.test']"), XhtmlMatchers.hasXPath("/metadata/artifactId[text() = 'logger']"), XhtmlMatchers.hasXPath("/metadata/versioning/latest[text() = '1.0']"), XhtmlMatchers.hasXPath("/metadata/versioning/release[text() = '1.0']"), XhtmlMatchers.hasXPath("/metadata/versioning/versions/version[text() = '1.0']"), XhtmlMatchers.hasXPath("/metadata/versioning/versions[count(//version) = 1]"), XhtmlMatchers.hasXPath("/metadata/versioning/lastUpdated"))));
MatcherAssert.assertThat("Upload directory was not cleaned up", this.storage.list(new Key.From(AstoMavenTest.LGR_UPLOAD, version)).join().size(), new IsEqual<>(0));
}
Aggregations