Search in sources :

Example 1 with IsAnything

use of org.hamcrest.core.IsAnything 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)

Aggregations

TestResource (com.artipie.asto.test.TestResource)1 ContainerResultMatcher (com.artipie.test.ContainerResultMatcher)1 TestDeployment (com.artipie.test.TestDeployment)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 Arrays (java.util.Arrays)1 Json (javax.json.Json)1 IsAnything (org.hamcrest.core.IsAnything)1 IsEqual (org.hamcrest.core.IsEqual)1 StringContains (org.hamcrest.core.StringContains)1 StringContainsInOrder (org.hamcrest.text.StringContainsInOrder)1 Test (org.junit.jupiter.api.Test)1 EnabledOnOs (org.junit.jupiter.api.condition.EnabledOnOs)1 OS (org.junit.jupiter.api.condition.OS)1 RegisterExtension (org.junit.jupiter.api.extension.RegisterExtension)1 MatcherOf (org.llorllale.cactoos.matchers.MatcherOf)1