Search in sources :

Example 1 with ArtifactoryClientImpl

use of net.nemerosa.ontrack.extension.artifactory.client.ArtifactoryClientImpl in project ontrack by nemerosa.

the class ArtifactoryClientImplTest method buildNumbersEmptyForBuildNotFound.

@Test
public void buildNumbersEmptyForBuildNotFound() {
    JsonClient jsonClient = mock(JsonClient.class);
    when(jsonClient.get("/api/build/%s", "PROJECT")).thenThrow(new ClientNotFoundException("Not found"));
    ArtifactoryClientImpl client = new ArtifactoryClientImpl(jsonClient);
    assertEquals(Collections.<String>emptyList(), client.getBuildNumbers("PROJECT"));
}
Also used : JsonClient(net.nemerosa.ontrack.client.JsonClient) ClientNotFoundException(net.nemerosa.ontrack.client.ClientNotFoundException) ArtifactoryClientImpl(net.nemerosa.ontrack.extension.artifactory.client.ArtifactoryClientImpl) Test(org.junit.Test)

Example 2 with ArtifactoryClientImpl

use of net.nemerosa.ontrack.extension.artifactory.client.ArtifactoryClientImpl in project ontrack by nemerosa.

the class ArtifactoryClientImplTest method buildNumbers.

@Test
public void buildNumbers() {
    JsonClient jsonClient = mock(JsonClient.class);
    when(jsonClient.get("/api/build/%s", "PROJECT")).thenReturn(object().with("buildsNumbers", array().with(object().with("uri", "/1").end()).with(object().with("uri", "/2").end()).end()).end());
    ArtifactoryClientImpl client = new ArtifactoryClientImpl(jsonClient);
    assertEquals(Arrays.asList("1", "2"), client.getBuildNumbers("PROJECT"));
}
Also used : JsonClient(net.nemerosa.ontrack.client.JsonClient) ArtifactoryClientImpl(net.nemerosa.ontrack.extension.artifactory.client.ArtifactoryClientImpl) Test(org.junit.Test)

Aggregations

JsonClient (net.nemerosa.ontrack.client.JsonClient)2 ArtifactoryClientImpl (net.nemerosa.ontrack.extension.artifactory.client.ArtifactoryClientImpl)2 Test (org.junit.Test)2 ClientNotFoundException (net.nemerosa.ontrack.client.ClientNotFoundException)1