Search in sources :

Example 31 with ContainerResultMatcher

use of com.artipie.test.ContainerResultMatcher in project artipie by artipie.

the class MavenMultiProxyIT method shouldGetDependency.

@Test
void shouldGetDependency() throws Exception {
    this.containers.putResourceToArtipie("artipie-origin", "com/artipie/helloworld/maven-metadata.xml", "/var/artipie/data/origin-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("artipie-origin", item, String.join("/", "/var/artipie/data/origin-maven", item)));
    this.containers.assertExec("Artifact wasn't downloaded", new ContainerResultMatcher(new IsEqual<>(0), new StringContains("BUILD SUCCESS")), "mvn", "-s", "settings.xml", "dependency:get", "-Dartifact=com.artipie:helloworld:0.1:jar");
}
Also used : ContainerResultMatcher(com.artipie.test.ContainerResultMatcher) Test(org.junit.jupiter.api.Test) TestDeployment(com.artipie.test.TestDeployment) BindMode(org.testcontainers.containers.BindMode) StringContains(org.hamcrest.core.StringContains) RegisterExtension(org.junit.jupiter.api.extension.RegisterExtension) OS(org.junit.jupiter.api.condition.OS) MapOf(org.cactoos.map.MapOf) IsEqual(org.hamcrest.core.IsEqual) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) MapEntry(org.cactoos.map.MapEntry) ContainerResultMatcher(com.artipie.test.ContainerResultMatcher) IsEqual(org.hamcrest.core.IsEqual) StringContains(org.hamcrest.core.StringContains) Test(org.junit.jupiter.api.Test)

Example 32 with ContainerResultMatcher

use of com.artipie.test.ContainerResultMatcher 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");
}
Also used : StringContainsInOrder(org.hamcrest.text.StringContainsInOrder) TestResource(com.artipie.asto.test.TestResource) ContainerResultMatcher(com.artipie.test.ContainerResultMatcher) IsEqual(org.hamcrest.core.IsEqual) StringContains(org.hamcrest.core.StringContains) Test(org.junit.jupiter.api.Test)

Example 33 with ContainerResultMatcher

use of com.artipie.test.ContainerResultMatcher 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<>());
}
Also used : ContainerResultMatcher(com.artipie.test.ContainerResultMatcher) TestDeployment(com.artipie.test.TestDeployment) Arrays(java.util.Arrays) OS(org.junit.jupiter.api.condition.OS) StringContainsInOrder(org.hamcrest.text.StringContainsInOrder) Test(org.junit.jupiter.api.Test) StringContains(org.hamcrest.core.StringContains) ByteArrayInputStream(java.io.ByteArrayInputStream) RegisterExtension(org.junit.jupiter.api.extension.RegisterExtension) IsAnything(org.hamcrest.core.IsAnything) IsEqual(org.hamcrest.core.IsEqual) EnabledOnOs(org.junit.jupiter.api.condition.EnabledOnOs) Json(javax.json.Json) MatcherOf(org.llorllale.cactoos.matchers.MatcherOf) TestResource(com.artipie.asto.test.TestResource) ByteArrayInputStream(java.io.ByteArrayInputStream) TestResource(com.artipie.asto.test.TestResource) ContainerResultMatcher(com.artipie.test.ContainerResultMatcher) IsEqual(org.hamcrest.core.IsEqual) StringContains(org.hamcrest.core.StringContains) Test(org.junit.jupiter.api.Test)

Example 34 with ContainerResultMatcher

use of com.artipie.test.ContainerResultMatcher in project artipie by artipie.

the class RpmITCase method setUp.

@BeforeEach
void setUp() throws IOException {
    this.containers.assertExec("Dnf install curl failed", new ContainerResultMatcher(), "dnf", "-y", "install", "curl");
    this.containers.putBinaryToClient(String.join("\n", "[example]", "name=Example Repository", "baseurl=http://artipie:8080/my-rpm", "enabled=1", "gpgcheck=0").getBytes(), "/etc/yum.repos.d/example.repo");
}
Also used : ContainerResultMatcher(com.artipie.test.ContainerResultMatcher) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ContainerResultMatcher (com.artipie.test.ContainerResultMatcher)34 Test (org.junit.jupiter.api.Test)27 IsEqual (org.hamcrest.core.IsEqual)20 StringContains (org.hamcrest.core.StringContains)14 TestResource (com.artipie.asto.test.TestResource)10 StringContainsInOrder (org.hamcrest.text.StringContainsInOrder)10 BeforeEach (org.junit.jupiter.api.BeforeEach)8 TestDeployment (com.artipie.test.TestDeployment)7 OS (org.junit.jupiter.api.condition.OS)7 RegisterExtension (org.junit.jupiter.api.extension.RegisterExtension)7 DisabledOnOs (org.junit.jupiter.api.condition.DisabledOnOs)6 IOException (java.io.IOException)4 UncheckedIOException (java.io.UncheckedIOException)4 List (java.util.List)4 BindMode (org.testcontainers.containers.BindMode)3 Pair (wtf.g4s8.tuples.Pair)3 MapEntry (org.cactoos.map.MapEntry)2 MapOf (org.cactoos.map.MapOf)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 CsvSource (org.junit.jupiter.params.provider.CsvSource)2