Search in sources :

Example 6 with QueryImplListResponse

use of datawave.webservice.result.QueryImplListResponse in project datawave by NationalSecurityAgency.

the class ExtendedQueryExecutorBeanTest method testListUserQueries_HappyPath.

@Test
public void testListUserQueries_HappyPath() throws Exception {
    // Set expectations
    expect(this.persister.findByUser()).andReturn(Arrays.asList(this.query));
    // Run the test
    PowerMock.replayAll();
    QueryExecutorBean subject = new QueryExecutorBean();
    setInternalState(subject, Persister.class, persister);
    setInternalState(subject, QueryMetricFactory.class, new QueryMetricFactoryImpl());
    QueryImplListResponse result1 = subject.listUserQueries();
    subject.close();
    PowerMock.verifyAll();
    // Verify results
    assertNotNull("Query response should not be returned null", result1);
}
Also used : QueryImplListResponse(datawave.webservice.result.QueryImplListResponse) QueryMetricFactoryImpl(datawave.microservice.querymetric.QueryMetricFactoryImpl) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 7 with QueryImplListResponse

use of datawave.webservice.result.QueryImplListResponse in project datawave by NationalSecurityAgency.

the class ExtendedQueryExecutorBeanTest method testListQueriesForUser_HappyPath.

@Test
public void testListQueriesForUser_HappyPath() throws Exception {
    // Set local test input
    String userSid = "userSid";
    // Set expectations
    expect(this.persister.findByUser(userSid)).andReturn(Arrays.asList(this.query));
    // Run the test
    PowerMock.replayAll();
    QueryExecutorBean subject = new QueryExecutorBean();
    setInternalState(subject, Persister.class, persister);
    setInternalState(subject, QueryMetricFactory.class, new QueryMetricFactoryImpl());
    QueryImplListResponse result1 = subject.listQueriesForUser(userSid);
    PowerMock.verifyAll();
    // Verify results
    assertNotNull("Expected a non-null response", result1);
}
Also used : QueryImplListResponse(datawave.webservice.result.QueryImplListResponse) QueryMetricFactoryImpl(datawave.microservice.querymetric.QueryMetricFactoryImpl) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

QueryImplListResponse (datawave.webservice.result.QueryImplListResponse)7 QueryMetricFactoryImpl (datawave.microservice.querymetric.QueryMetricFactoryImpl)4 Query (datawave.webservice.query.Query)4 Test (org.junit.Test)4 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)4 ArrayList (java.util.ArrayList)3 GET (javax.ws.rs.GET)3 Path (javax.ws.rs.Path)3 Timed (com.codahale.metrics.annotation.Timed)2 BadRequestException (datawave.webservice.common.exception.BadRequestException)2 DatawaveWebApplicationException (datawave.webservice.common.exception.DatawaveWebApplicationException)2 NoResultsException (datawave.webservice.common.exception.NoResultsException)2 UnauthorizedException (datawave.webservice.common.exception.UnauthorizedException)2 BadRequestQueryException (datawave.webservice.query.exception.BadRequestQueryException)2 NoResultsQueryException (datawave.webservice.query.exception.NoResultsQueryException)2 NotFoundQueryException (datawave.webservice.query.exception.NotFoundQueryException)2 PreConditionFailedQueryException (datawave.webservice.query.exception.PreConditionFailedQueryException)2 QueryException (datawave.webservice.query.exception.QueryException)2 UnauthorizedQueryException (datawave.webservice.query.exception.UnauthorizedQueryException)2 IOException (java.io.IOException)2