Skip to content
Snippets Groups Projects
Commit c8f94dbc authored by Moritz Staudinger's avatar Moritz Staudinger
Browse files

removed tests for saving

parent 7c45cb16
No related branches found
No related tags found
2 merge requests!81New stable release,!43Merge dev to master
...@@ -156,29 +156,5 @@ public class QueryEndpointIntegrationTest extends BaseUnitTest { ...@@ -156,29 +156,5 @@ public class QueryEndpointIntegrationTest extends BaseUnitTest {
assertEquals(QUERY_1_ID, response.getBody().getId()); assertEquals(QUERY_1_ID, response.getBody().getId());
} }
@Test
public void save_succeeds() throws QueryStoreException, DatabaseNotFoundException, ImageNotSupportedException,
InterruptedException, SQLException, ContainerNotFoundException {
final SaveStatementDto statement = SaveStatementDto.builder()
.statement(QUERY_1_STATEMENT)
.build();
/* mock */
DockerConfig.startContainer(CONTAINER_1);
MariaDbConfig.clearQueryStore(TABLE_1);
/* test */
final ResponseEntity<QueryDto> response = queryEndpoint.save(CONTAINER_1_ID, DATABASE_1_ID, statement);
assertEquals(HttpStatus.ACCEPTED, response.getStatusCode());
assertNotNull(response.getBody());
assertEquals(QUERY_1_ID, response.getBody().getId());
assertEquals(CONTAINER_1_ID, response.getBody().getCid());
assertEquals(DATABASE_1_ID, response.getBody().getDbid());
assertEquals(QUERY_1_STATEMENT, response.getBody().getQuery());
assertEquals(QUERY_1_STATEMENT, response.getBody().getQueryNormalized());
assertNull(response.getBody().getResultNumber());
assertNull(response.getBody().getResultHash());
}
} }
...@@ -116,38 +116,4 @@ public class QueryEndpointUnitTest extends BaseUnitTest { ...@@ -116,38 +116,4 @@ public class QueryEndpointUnitTest extends BaseUnitTest {
}); });
} }
@Test
public void save_succeeds() throws QueryStoreException, DatabaseNotFoundException, ImageNotSupportedException,
ContainerNotFoundException {
final SaveStatementDto request = SaveStatementDto.builder()
.statement(QUERY_1_STATEMENT)
.build();
/* mock */
when(storeService.insert(CONTAINER_1_ID, DATABASE_1_ID, null, request))
.thenReturn(QUERY_1);
/* test */
final ResponseEntity<QueryDto> response = queryEndpoint.save(CONTAINER_1_ID, DATABASE_1_ID, request);
assertEquals(HttpStatus.ACCEPTED, response.getStatusCode());
assertEquals(QUERY_1_DTO, response.getBody());
}
@Test
public void save_dbNotFound_fails() throws QueryStoreException, DatabaseNotFoundException,
ImageNotSupportedException, ContainerNotFoundException {
final SaveStatementDto request = SaveStatementDto.builder()
.statement(QUERY_1_STATEMENT)
.build();
/* mock */
when(storeService.insert(CONTAINER_1_ID, DATABASE_1_ID, null, request))
.thenThrow(DatabaseNotFoundException.class);
/* test */
assertThrows(DatabaseNotFoundException.class, () -> {
queryEndpoint.save(CONTAINER_1_ID, DATABASE_1_ID, request);
});
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment