use of com.artipie.asto.test.TestResource in project artipie by artipie.
the class MavenProxyAuthIT method shouldGetDependency.
@Test
void shouldGetDependency() throws Exception {
this.containers.putResourceToArtipie("artipie", "com/artipie/helloworld/maven-metadata.xml", "/var/artipie/data/my-maven/com/artipie/helloworld/maven-metadata.xml");
MavenITCase.getResourceFiles("com/artipie/helloworld/0.1").stream().map(item -> String.join("/", "com/artipie/helloworld/0.1", item)).forEach(item -> this.containers.putResourceToArtipie(item, String.join("/", "/var/artipie/data/my-maven", item)));
this.containers.assertExec("Helloworld was not installed", new ContainerResultMatcher(new IsEqual<>(0), new StringContains("BUILD SUCCESS")), "mvn", "-s", "settings.xml", "dependency:get", "-Dartifact=com.artipie:helloworld:0.1:jar");
this.containers.assertArtipieContent("artipie-proxy", "Artifact was not cached in proxy", "/var/artipie/data/my-maven-proxy/com/artipie/helloworld/0.1/helloworld-0.1.jar", new IsEqual<>(new TestResource("com/artipie/helloworld/0.1/helloworld-0.1.jar").asBytes()));
}
use of com.artipie.asto.test.TestResource in project artipie by artipie.
the class PypiProxyITCase method installFromProxy.
@Test
void installFromProxy() throws Exception {
final byte[] data = new TestResource("pypi-repo/alarmtime-0.1.5.tar.gz").asBytes();
this.containers.putBinaryToArtipie("artipie", data, "/var/artipie/data/my-pypi/alarmtime/alarmtime-0.1.5.tar.gz");
this.containers.assertExec("Package was not installed", new ContainerResultMatcher(new IsEqual<>(0), Matchers.containsString("Successfully installed alarmtime-0.1.5")), "pip", "install", "--no-deps", "--trusted-host", "artipie-proxy", "--index-url", "http://alice:123@artipie-proxy:8080/my-pypi-proxy/", "alarmtime");
this.containers.assertArtipieContent("artipie-proxy", "/var/artipie/data/my-pypi-proxy/alarmtime/alarmtime-0.1.5.tar.gz", new IsEqual<>(data));
}
use of com.artipie.asto.test.TestResource in project artipie by artipie.
the class NpmProxyITCase method installFromProxy.
@Test
void installFromProxy() throws Exception {
this.containers.putBinaryToArtipie("artipie", new TestResource(String.format("npm/storage/%s/meta.json", NpmProxyITCase.PROJ)).asBytes(), String.format("/var/artipie/data/my-npm/%s/meta.json", NpmProxyITCase.PROJ));
final byte[] tgz = new TestResource(String.format("npm/storage/%s/-/%s-1.0.1.tgz", NpmProxyITCase.PROJ, NpmProxyITCase.PROJ)).asBytes();
this.containers.putBinaryToArtipie("artipie", tgz, String.format("/var/artipie/data/my-npm/%s/-/%s-1.0.1.tgz", NpmProxyITCase.PROJ, NpmProxyITCase.PROJ));
this.containers.assertExec("Package was not installed", new ContainerResultMatcher(new IsEqual<>(0), new StringContainsInOrder(Arrays.asList(NpmProxyITCase.ADDED_PROJ, "added 1 package"))), "npm", "install", NpmProxyITCase.PROJ, "--registry", "http://artipie-proxy:8080/my-npm-proxy");
this.containers.assertArtipieContent("artipie-proxy", "Package was not cached in proxy", String.format("/var/artipie/data/my-npm-proxy/%s/-/%s-1.0.1.tgz", NpmProxyITCase.PROJ, NpmProxyITCase.PROJ), new IsEqual<>(tgz));
}
use of com.artipie.asto.test.TestResource in project artipie by artipie.
the class NpmITCase method npmInstall.
@Test
void npmInstall() throws Exception {
this.containers.putBinaryToArtipie(new TestResource(String.format("npm/storage/%s/meta.json", NpmITCase.PROJ)).asBytes(), String.format("/var/artipie/data/my-npm/%s/meta.json", NpmITCase.PROJ));
this.containers.putBinaryToArtipie(new TestResource(String.format("npm/storage/%s/-/%s-1.0.1.tgz", NpmITCase.PROJ, NpmITCase.PROJ)).asBytes(), String.format("/var/artipie/data/my-npm/%s/-/%s-1.0.1.tgz", NpmITCase.PROJ, NpmITCase.PROJ));
this.containers.assertExec("Package was not installed", new ContainerResultMatcher(new IsEqual<>(0), new StringContainsInOrder(Arrays.asList(NpmITCase.ADDED_PROJ, "added 1 package"))), "npm", "install", NpmITCase.PROJ, "--registry", NpmITCase.REPO);
this.containers.assertExec("Package was installed", new ContainerResultMatcher(new IsEqual<>(0), new StringContains("@hello/simple-npm-project@1.0.1")), "npm", "list");
}
use of com.artipie.asto.test.TestResource in project artipie by artipie.
the class NpmITCase method npmPublish.
@Test
void npmPublish() throws Exception {
final String tgz = String.format("%s/-/%s-1.0.1.tgz", NpmITCase.PROJ, NpmITCase.PROJ);
this.containers.putBinaryToClient(new TestResource("npm/simple-npm-project/index.js").asBytes(), String.format("/w/%s/index.js", NpmITCase.PROJ));
this.containers.putBinaryToClient(new TestResource("npm/simple-npm-project/package.json").asBytes(), String.format("/w/%s/package.json", NpmITCase.PROJ));
this.containers.assertExec("Package was published", new ContainerResultMatcher(new IsEqual<>(0), new StringContains(NpmITCase.ADDED_PROJ)), "npm", "publish", NpmITCase.PROJ, "--registry", NpmITCase.REPO);
this.containers.assertArtipieContent("Meta json is incorrect", String.format("/var/artipie/data/my-npm/%s/meta.json", NpmITCase.PROJ), new MatcherOf<>(bytes -> {
return Json.createReader(new ByteArrayInputStream(bytes)).readObject().getJsonObject("versions").getJsonObject("1.0.1").getJsonObject("dist").getString("tarball").equals(String.format("/%s", tgz));
}));
this.containers.assertArtipieContent("Tarball should be added to storage", String.format("/var/artipie/data/my-npm/%s", tgz), new IsAnything<>());
}
Aggregations