use of ddf.catalog.operation.CreateRequest in project ddf by codice.
the class MetacardIngestNetworkPluginTest method testClientInfoMapNotMap.
@Test
public void testClientInfoMapNotMap() throws Exception {
ThreadContext.put(CLIENT_INFO_KEY, new Object());
CreateRequest createRequest = plugin.processPreCreate(mockCreateRequest);
verifyZeroInteractions(mockMetacardServices, mockMetacardCondition);
assertThat(createRequest, is(mockCreateRequest));
}
use of ddf.catalog.operation.CreateRequest in project ddf by codice.
the class MetacardIngestNetworkPluginTest method testApplyFails.
@Test
public void testApplyFails() throws Exception {
ThreadContext.put(CLIENT_INFO_KEY, INFO_MAP);
when(mockMetacardCondition.applies(INFO_MAP)).thenReturn(false);
CreateRequest createRequest = plugin.processPreCreate(mockCreateRequest);
verifyZeroInteractions(mockMetacardServices);
assertThat(createRequest, is(mockCreateRequest));
}
use of ddf.catalog.operation.CreateRequest in project ddf by codice.
the class SecurityPluginTest method testWrongSubjectCase.
@Test
public void testWrongSubjectCase() throws Exception {
org.apache.shiro.subject.Subject wrongSubject = mock(org.apache.shiro.subject.Subject.class);
ThreadContext.bind(wrongSubject);
CreateRequest request = new MockCreateRequest();
SecurityPlugin plugin = new SecurityPlugin();
request = plugin.processPreCreate(request);
assertThat(request.getPropertyValue(SecurityConstants.SECURITY_SUBJECT), equalTo(null));
}
use of ddf.catalog.operation.CreateRequest in project ddf by codice.
the class SecurityPluginTest method testBadSubjectCase.
@Test
public void testBadSubjectCase() throws Exception {
Subject mockSubject = mock(Subject.class);
ThreadContext.bind(mockSubject);
CreateRequest request = new MockCreateRequest();
request.getProperties().put(SecurityConstants.SECURITY_SUBJECT, new HashMap<>());
SecurityPlugin plugin = new SecurityPlugin();
request = plugin.processPreCreate(request);
assertThat(request.getPropertyValue(SecurityConstants.SECURITY_SUBJECT), equalTo(mockSubject));
}
use of ddf.catalog.operation.CreateRequest in project ddf by codice.
the class SecurityPluginTest method testSubjectExists.
@Test
public void testSubjectExists() throws Exception {
Subject mockSubject = mock(Subject.class);
CreateRequest request = new MockCreateRequest();
request.getProperties().put(SecurityConstants.SECURITY_SUBJECT, mockSubject);
SecurityPlugin plugin = new SecurityPlugin();
request = plugin.processPreCreate(request);
assertThat(request.getPropertyValue(SecurityConstants.SECURITY_SUBJECT), equalTo(mockSubject));
}
Aggregations