Search in sources :

Example 1 with ContainerResultMatcher

use of com.artipie.test.ContainerResultMatcher 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 ContainerResultMatcher

use of com.artipie.test.ContainerResultMatcher 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 ContainerResultMatcher

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

the class PypiITCase method setUp.

@BeforeEach
void setUp() throws IOException {
    this.containers.assertExec("Apt-get update failed", new ContainerResultMatcher(), "apt-get", "update");
    this.containers.assertExec("Failed to install twine", new ContainerResultMatcher(), "python", "-m", "pip", "install", "twine");
    this.containers.assertExec("Failed to upgrade pip", new ContainerResultMatcher(), "python", "-m", "pip", "install", "--upgrade", "pip");
}
Also used : ContainerResultMatcher(com.artipie.test.ContainerResultMatcher) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 4 with ContainerResultMatcher

use of com.artipie.test.ContainerResultMatcher 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 5 with ContainerResultMatcher

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

the class MavenITCase method downloadsArtifact.

@ParameterizedTest
@CsvSource({ "helloworld,0.1", "snapshot,1.0-SNAPSHOT" })
void downloadsArtifact(final String type, final String vers) throws Exception {
    final String meta = String.format("com/artipie/%s/maven-metadata.xml", type);
    this.containers.putResourceToArtipie(meta, String.join("/", "/var/artipie/data/my-maven", meta));
    final String base = String.format("com/artipie/%s/%s", type, vers);
    MavenITCase.getResourceFiles(base).stream().map(r -> String.join("/", base, r)).forEach(item -> this.containers.putResourceToArtipie(item, String.join("/", "/var/artipie/data/my-maven", item)));
    this.containers.assertExec("Failed to get dependency", new ContainerResultMatcher(), "mvn", "-B", "-q", "-s", "settings.xml", "-e", "dependency:get", String.format("-Dartifact=com.artipie:%s:%s", type, vers));
}
Also used : ContainerResultMatcher(com.artipie.test.ContainerResultMatcher) TestDeployment(com.artipie.test.TestDeployment) CsvSource(org.junit.jupiter.params.provider.CsvSource) BindMode(org.testcontainers.containers.BindMode) OS(org.junit.jupiter.api.condition.OS) IOException(java.io.IOException) InputStreamReader(java.io.InputStreamReader) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) ArrayList(java.util.ArrayList) UncheckedIOException(java.io.UncheckedIOException) List(java.util.List) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) RegisterExtension(org.junit.jupiter.api.extension.RegisterExtension) Optional(java.util.Optional) BufferedReader(java.io.BufferedReader) TestResource(com.artipie.asto.test.TestResource) InputStream(java.io.InputStream) ContainerResultMatcher(com.artipie.test.ContainerResultMatcher) CsvSource(org.junit.jupiter.params.provider.CsvSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

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