Search in sources :

Example 11 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 updateHosted_noAuthc.

@Test
public void updateHosted_noAuthc() throws Exception {
    setBadCredentials();
    AbstractRepositoryApiRequest request = createHostedRequest(false);
    Response response = put(getUpdateRepositoryPathUrl(HostedType.NAME, HOSTED_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 12 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 createProxy.

@Test
public void createProxy() throws Exception {
    AbstractRepositoryApiRequest request = createProxyRequest(true);
    Response response = post(getCreateRepositoryPathUrl(ProxyType.NAME), request);
    assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
    Repository repository = repositoryManager.get(request.getName());
    assertNotNull(repository);
    assertEquals(RFormat.NAME, repository.getFormat().getValue());
    assertEquals(ProxyType.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 13 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_noAuthz.

@Test
public void createGroup_noAuthz() throws Exception {
    setUnauthorizedUser();
    AbstractRepositoryApiRequest request = createGroupRequest(true);
    Response response = post(getCreateRepositoryPathUrl(GroupType.NAME), request);
    assertEquals(Status.FORBIDDEN.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 14 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 updateHosted.

@Test
public void updateHosted() throws Exception {
    repos.createRHosted(HOSTED_NAME);
    AbstractRepositoryApiRequest request = createHostedRequest(false);
    Response response = put(getUpdateRepositoryPathUrl(HostedType.NAME, HOSTED_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(HOSTED_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 15 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_noAuthz.

@Test
public void updateProxy_noAuthz() throws Exception {
    repos.createRProxy(PROXY_NAME, REMOTE_URL);
    setUnauthorizedUser();
    AbstractRepositoryApiRequest request = createProxyRequest(false);
    Response response = put(getUpdateRepositoryPathUrl(ProxyType.NAME, PROXY_NAME), request);
    assertEquals(Status.FORBIDDEN.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