Search in sources :

Example 1 with StringContainsInOrder

use of org.hamcrest.text.StringContainsInOrder in project artipie by artipie.

the class NugetITCase method shouldPushAndInstallPackage.

@Test
void shouldPushAndInstallPackage() throws Exception {
    final String pckgname = UUID.randomUUID().toString();
    this.containers.putBinaryToClient(new TestResource("nuget/newtonsoft.json/12.0.3/newtonsoft.json.12.0.3.nupkg").asBytes(), String.format("/w/%s", pckgname));
    this.containers.assertExec("Package was not pushed", new ContainerResultMatcher(new IsEqual<>(0), new StringContains("Your package was pushed.")), "dotnet", "nuget", "push", pckgname, "-s", "http://artipie:8080/my-nuget/index.json");
    this.containers.assertExec("New project was not created", new ContainerResultMatcher(), "dotnet", "new", "console", "-n", "TestProj");
    this.containers.assertExec("Package was not added", new ContainerResultMatcher(new IsEqual<>(0), new StringContainsInOrder(Arrays.asList(// @checkstyle LineLengthCheck (1 line)
    "PackageReference for package 'newtonsoft.json' version '12.0.3' added to file '/w/TestProj/TestProj.csproj'", "Restored /w/TestProj/TestProj.csproj"))), "dotnet", "add", "TestProj", "package", "newtonsoft.json", "--version", "12.0.3", "-s", "http://artipie:8080/my-nuget/index.json");
}
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 2 with StringContainsInOrder

use of org.hamcrest.text.StringContainsInOrder in project artipie by artipie.

the class PypiITCase method canUpload.

@Test
void canUpload() throws Exception {
    this.containers.assertExec("Failed to upload", new ContainerResultMatcher(Matchers.is(0), new StringContainsInOrder(new ListOf<>("Uploading artipietestpkg-0.0.3.tar.gz", "100%"))), "python3", "-m", "twine", "upload", "--repository-url", "http://artipie:8080/my-python/", "-u", "alice", "-p", "123", "/var/artipie/data/artipie/pypi/example-pckg/dist/artipietestpkg-0.0.3.tar.gz");
    this.containers.assertArtipieContent("Bad content after upload", "/var/artipie/data/my-python/artipietestpkg/artipietestpkg-0.0.3.tar.gz", Matchers.not("123".getBytes()));
}
Also used : StringContainsInOrder(org.hamcrest.text.StringContainsInOrder) ContainerResultMatcher(com.artipie.test.ContainerResultMatcher) Test(org.junit.jupiter.api.Test)

Example 3 with StringContainsInOrder

use of org.hamcrest.text.StringContainsInOrder in project artipie by artipie.

the class RpmITCase method uploadsAndInstallsThePackage.

@Test
void uploadsAndInstallsThePackage() throws Exception {
    this.containers.assertExec("Failed to upload rpm package", new ContainerResultMatcher(), "curl", "http://artipie:8080/my-rpm/time-1.7-45.el7.x86_64.rpm", "--upload-file", "/w/time-1.7-45.el7.x86_64.rpm");
    this.containers.assertExec("Failed to install time package", new ContainerResultMatcher(new IsEqual<>(0), new StringContainsInOrder(new ListOf<>("time-1.7-45.el7.x86_64", "Complete!"))), "dnf", "-y", "repository-packages", "example", "install");
}
Also used : StringContainsInOrder(org.hamcrest.text.StringContainsInOrder) ContainerResultMatcher(com.artipie.test.ContainerResultMatcher) IsEqual(org.hamcrest.core.IsEqual) Test(org.junit.jupiter.api.Test)

Example 4 with StringContainsInOrder

use of org.hamcrest.text.StringContainsInOrder in project artipie by artipie.

the class DebianITCase method pushAndInstallWorks.

@Test
void pushAndInstallWorks() throws Exception {
    this.containers.assertExec("Failed to upload deb package", new ContainerResultMatcher(), "curl", "http://artipie:8080/my-debian/main/aglfn_1.7-3_amd64.deb", "--upload-file", "/w/aglfn_1.7-3_amd64.deb");
    this.containers.assertExec("Apt-get update failed", new ContainerResultMatcher(), "apt-get", "update");
    this.containers.assertExec("Package was not downloaded and unpacked", new ContainerResultMatcher(new IsEqual<>(0), new StringContainsInOrder(new ListOf<>("Unpacking aglfn", "Setting up aglfn"))), "apt-get", "install", "-y", "aglfn");
}
Also used : StringContainsInOrder(org.hamcrest.text.StringContainsInOrder) ContainerResultMatcher(com.artipie.test.ContainerResultMatcher) IsEqual(org.hamcrest.core.IsEqual) Test(org.junit.jupiter.api.Test)

Example 5 with StringContainsInOrder

use of org.hamcrest.text.StringContainsInOrder in project maven-adapter by artipie.

the class MavenITCase method downloadsDependency.

@ParameterizedTest
@ValueSource(booleans = { true, false })
void downloadsDependency(final boolean anonymous) throws Exception {
    this.init(anonymous);
    this.addHellowordToArtipie();
    MatcherAssert.assertThat(this.exec("mvn", "-s", "/home/settings.xml", "dependency:get", "-Dartifact=com.artipie:helloworld:0.1"), new StringContainsInOrder(new ListOf<String>(// @checkstyle LineLengthCheck (1 line)
    String.format("Downloaded from my-repo: http://host.testcontainers.internal:%d/com/artipie/helloworld/0.1/helloworld-0.1.jar (11 B", this.port), "BUILD SUCCESS")));
}
Also used : ListOf(org.cactoos.list.ListOf) StringContainsInOrder(org.hamcrest.text.StringContainsInOrder) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

StringContainsInOrder (org.hamcrest.text.StringContainsInOrder)10 ContainerResultMatcher (com.artipie.test.ContainerResultMatcher)9 Test (org.junit.jupiter.api.Test)9 IsEqual (org.hamcrest.core.IsEqual)7 TestResource (com.artipie.asto.test.TestResource)4 StringContains (org.hamcrest.core.StringContains)3 ListOf (org.cactoos.list.ListOf)1 Base64Encoded (org.cactoos.text.Base64Encoded)1 Matcher (org.hamcrest.Matcher)1 AllOf (org.hamcrest.core.AllOf)1 IsNot (org.hamcrest.core.IsNot)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 ValueSource (org.junit.jupiter.params.provider.ValueSource)1