Search in sources :

Example 21 with CreateRequest

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));
}
Also used : CreateRequest(ddf.catalog.operation.CreateRequest) Test(org.junit.Test)

Example 22 with CreateRequest

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));
}
Also used : CreateRequest(ddf.catalog.operation.CreateRequest) Test(org.junit.Test)

Example 23 with CreateRequest

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));
}
Also used : CreateRequest(ddf.catalog.operation.CreateRequest) Test(org.junit.Test)

Example 24 with CreateRequest

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));
}
Also used : CreateRequest(ddf.catalog.operation.CreateRequest) Subject(ddf.security.Subject) Test(org.junit.Test)

Example 25 with CreateRequest

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));
}
Also used : CreateRequest(ddf.catalog.operation.CreateRequest) Subject(ddf.security.Subject) Test(org.junit.Test)

Aggregations

CreateRequest (ddf.catalog.operation.CreateRequest)63 Test (org.junit.Test)49 Metacard (ddf.catalog.data.Metacard)38 CreateRequestImpl (ddf.catalog.operation.impl.CreateRequestImpl)36 CreateResponse (ddf.catalog.operation.CreateResponse)26 ArrayList (java.util.ArrayList)16 HashMap (java.util.HashMap)16 CreateResponseImpl (ddf.catalog.operation.impl.CreateResponseImpl)12 Subject (ddf.security.Subject)12 Serializable (java.io.Serializable)10 IngestException (ddf.catalog.source.IngestException)9 List (java.util.List)9 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)8 HashSet (java.util.HashSet)7 UpdateRequest (ddf.catalog.operation.UpdateRequest)6 SourceUnavailableException (ddf.catalog.source.SourceUnavailableException)6 IOException (java.io.IOException)6 InputStream (java.io.InputStream)6 CatalogFramework (ddf.catalog.CatalogFramework)4 QueryRequest (ddf.catalog.operation.QueryRequest)4