Search in sources :

Example 1 with AbstractRepositoryApiRequest

use of org.sonatype.nexus.repository.rest.api.model.AbstractRepositoryApiRequest in project nexus-repository-r by sonatype-nexus-community.

the class RResourceIT method updateProxy.

@Test
public void updateProxy() throws Exception {
    repos.createRProxy(PROXY_NAME, REMOTE_URL);
    AbstractRepositoryApiRequest request = createProxyRequest(false);
    Response response = put(getUpdateRepositoryPathUrl(ProxyType.NAME, PROXY_NAME), request);
    assertEquals(Status.NO_CONTENT.getStatusCode(), response.getStatus());
    Repository repository = repositoryManager.get(request.getName());
    assertNotNull(repository);
    assertThat(repository.getConfiguration().attributes("storage").get("strictContentTypeValidation"), is(false));
    repositoryManager.delete(PROXY_NAME);
}
Also used : Response(javax.ws.rs.core.Response) Repository(org.sonatype.nexus.repository.Repository) AbstractRepositoryApiRequest(org.sonatype.nexus.repository.rest.api.model.AbstractRepositoryApiRequest) Test(org.junit.Test)

Example 2 with AbstractRepositoryApiRequest

use of org.sonatype.nexus.repository.rest.api.model.AbstractRepositoryApiRequest in project nexus-repository-r by sonatype-nexus-community.

the class RResourceIT method updateProxy_noAuthc.

@Test
public void updateProxy_noAuthc() throws Exception {
    setBadCredentials();
    AbstractRepositoryApiRequest request = createProxyRequest(false);
    Response response = put(getUpdateRepositoryPathUrl(ProxyType.NAME, PROXY_NAME), request);
    assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
}
Also used : Response(javax.ws.rs.core.Response) AbstractRepositoryApiRequest(org.sonatype.nexus.repository.rest.api.model.AbstractRepositoryApiRequest) Test(org.junit.Test)

Example 3 with AbstractRepositoryApiRequest

use of org.sonatype.nexus.repository.rest.api.model.AbstractRepositoryApiRequest in project nexus-repository-r by sonatype-nexus-community.

the class RResourceIT method createHosted.

@Test
public void createHosted() throws Exception {
    AbstractRepositoryApiRequest request = createHostedRequest(true);
    Response response = post(getCreateRepositoryPathUrl(HostedType.NAME), request);
    assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
    Repository repository = repositoryManager.get(request.getName());
    assertNotNull(repository);
    assertEquals(RFormat.NAME, repository.getFormat().getValue());
    assertEquals(HostedType.NAME, repository.getType().getValue());
    repositoryManager.delete(request.getName());
}
Also used : Response(javax.ws.rs.core.Response) Repository(org.sonatype.nexus.repository.Repository) AbstractRepositoryApiRequest(org.sonatype.nexus.repository.rest.api.model.AbstractRepositoryApiRequest) Test(org.junit.Test)

Example 4 with AbstractRepositoryApiRequest

use of org.sonatype.nexus.repository.rest.api.model.AbstractRepositoryApiRequest in project nexus-repository-r by sonatype-nexus-community.

the class RResourceIT method createGroup_noAuthc.

@Test
public void createGroup_noAuthc() throws Exception {
    setBadCredentials();
    AbstractRepositoryApiRequest request = createGroupRequest(true);
    Response response = post(getCreateRepositoryPathUrl(GroupType.NAME), request);
    assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
}
Also used : Response(javax.ws.rs.core.Response) AbstractRepositoryApiRequest(org.sonatype.nexus.repository.rest.api.model.AbstractRepositoryApiRequest) Test(org.junit.Test)

Example 5 with AbstractRepositoryApiRequest

use of org.sonatype.nexus.repository.rest.api.model.AbstractRepositoryApiRequest in project nexus-repository-r by sonatype-nexus-community.

the class RResourceIT method createHosted_noAuthc.

@Test
public void createHosted_noAuthc() throws Exception {
    setBadCredentials();
    AbstractRepositoryApiRequest request = createHostedRequest(true);
    Response response = post(getCreateRepositoryPathUrl(HostedType.NAME), request);
    assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
}
Also used : Response(javax.ws.rs.core.Response) AbstractRepositoryApiRequest(org.sonatype.nexus.repository.rest.api.model.AbstractRepositoryApiRequest) Test(org.junit.Test)

Aggregations

Response (javax.ws.rs.core.Response)15 Test (org.junit.Test)15 AbstractRepositoryApiRequest (org.sonatype.nexus.repository.rest.api.model.AbstractRepositoryApiRequest)15 Repository (org.sonatype.nexus.repository.Repository)4