use of org.sonatype.nexus.repository.view.Status in project nexus-repository-r by sonatype-nexus-community.
the class PackagesGroupHandlerTest method setupRepository.
// Commented out until GroupHandler.DispactchedRepositories is made public
/* @Test
public void okWhenGetPackagesWithSingleResponse() throws Exception {
Response response = underTest.doGet(context, dispatchedRepositories);
assertThat(response.getStatus().getCode(), is(equalTo(200)));
}
@Test
public void okWhenGetPackagesWithMultipleResponses() throws Exception {
members.add(repository2);
Response response = underTest.doGet(context, dispatchedRepositories);
assertThat(response.getStatus().getCode(), is(equalTo(200)));
}
@Test
public void notFoundWhenNoResponses() throws Exception {
members.clear();
Response response = underTest.doGet(context, dispatchedRepositories);
assertThat(response.getStatus().getCode(), is(equalTo(404)));
}*/
private void setupRepository(final Repository repository) throws Exception {
ViewFacet viewFacet = mock(ViewFacet.class);
Response response = mock(Response.class);
Payload payload = mock(Payload.class);
GroupFacet groupFacet = mock(GroupFacet.class);
when(groupFacet.members()).thenReturn(members);
when(repository.facet(GroupFacet.class)).thenReturn(groupFacet);
when(repository.facet(ViewFacet.class)).thenReturn(viewFacet);
when(viewFacet.dispatch(any(), any())).thenReturn(response);
when(response.getPayload()).thenReturn(payload);
when(payload.openInputStream()).thenReturn(new FileInputStream(packages));
when(response.getStatus()).thenReturn(new Status(true, 200));
}
use of org.sonatype.nexus.repository.view.Status in project nexus-repository-r by sonatype-nexus-community.
the class PackagesGroupHandlerTest method setupRepository.
// Commented out until GroupHandler.DispactchedRepositories is made public
/* @Test
public void okWhenGetPackagesWithSingleResponse() throws Exception {
Response response = underTest.doGet(context, dispatchedRepositories);
assertThat(response.getStatus().getCode(), is(equalTo(200)));
}
@Test
public void okWhenGetPackagesWithMultipleResponses() throws Exception {
members.add(repository2);
Response response = underTest.doGet(context, dispatchedRepositories);
assertThat(response.getStatus().getCode(), is(equalTo(200)));
}
@Test
public void notFoundWhenNoResponses() throws Exception {
members.clear();
Response response = underTest.doGet(context, dispatchedRepositories);
assertThat(response.getStatus().getCode(), is(equalTo(404)));
}*/
private void setupRepository(final Repository repository) throws Exception {
ViewFacet viewFacet = mock(ViewFacet.class);
Response response = mock(Response.class);
Payload payload = mock(Payload.class);
GroupFacet groupFacet = mock(GroupFacet.class);
when(groupFacet.members()).thenReturn(members);
when(repository.facet(GroupFacet.class)).thenReturn(groupFacet);
when(repository.facet(ViewFacet.class)).thenReturn(viewFacet);
when(viewFacet.dispatch(any(), any())).thenReturn(response);
when(response.getPayload()).thenReturn(payload);
when(payload.openInputStream()).thenReturn(new FileInputStream(packages));
when(response.getStatus()).thenReturn(new Status(true, 200));
}
Aggregations