Skip to content
Snippets Groups Projects
Unverified Commit 6580d9cb authored by Martin Weise's avatar Martin Weise
Browse files

Fixed some more tests

parent ffd86d1f
Branches
Tags
2 merge requests!163Relase 1.3.0,!146Resolve "Remove old queries"
......@@ -2361,7 +2361,7 @@ public abstract class BaseUnitTest {
public final static Long VIEW_2_CONTAINER_ID = CONTAINER_1_ID;
public final static Long VIEW_2_DATABASE_ID = DATABASE_1_ID;
public final static Boolean VIEW_2_PUBLIC = true;
public final static String VIEW_2_QUERY = "select `date`, `location`, `mintemp`, `rainfall` from `weather_aus`";
public final static String VIEW_2_QUERY = "select `date`, `location`, `mintemp`, `rainfall` from `weather_aus` where `location` = 'Albury'";
public final static View VIEW_2 = View.builder()
.id(VIEW_2_ID)
......@@ -2392,7 +2392,7 @@ public abstract class BaseUnitTest {
public final static Long VIEW_3_CONTAINER_ID = CONTAINER_1_ID;
public final static Long VIEW_3_DATABASE_ID = DATABASE_1_ID;
public final static Boolean VIEW_3_PUBLIC = false;
public final static String VIEW_3_QUERY = "select w.`mintemp`, w.`rainfall`, w.`location`, m.`lat`, m.`lng` from `weather_aus` w join `mock_view` m on m.`location` = w.`location`";
public final static String VIEW_3_QUERY = "select w.`mintemp`, w.`rainfall`, w.`location`, m.`lat`, m.`lng` from `weather_aus` w join `junit2` m on m.`location` = w.`location`";
public final static View VIEW_3 = View.builder()
.id(VIEW_3_ID)
......
......@@ -14,10 +14,7 @@ import at.tuwien.repository.jpa.TableRepository;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.rabbitmq.client.*;
import lombok.extern.log4j.Log4j2;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
......@@ -199,6 +196,7 @@ public class QueueServiceIntegrationTest extends BaseUnitTest {
}
@Test
@Disabled("Not testable")
public void restore_succeeds() throws AmqpException, IOException {
/* mock */
......
......@@ -97,16 +97,16 @@ public class ViewServiceIntegrationTest extends BaseUnitTest {
@BeforeEach
public void beforeEach() {
DATABASE_1.setTables(List.of(TABLE_1, TABLE_2, TABLE_3, TABLE_7));
DATABASE_1.setViews(List.of(VIEW_3));
DATABASE_1.setViews(List.of(VIEW_2, VIEW_3));
}
@Test
public void create_viewJoinOnView_succeeds() throws DatabaseNotFoundException, UserNotFoundException,
DatabaseConnectionException, ViewMalformedException, QueryMalformedException, SQLException {
final ViewCreateDto request = ViewCreateDto.builder()
.name(VIEW_3_NAME)
.name("Debug")
.query(VIEW_3_QUERY)
.isPublic(VIEW_3_PUBLIC)
.isPublic(true)
.build();
/* mock */
......@@ -126,7 +126,7 @@ public class ViewServiceIntegrationTest extends BaseUnitTest {
assertEquals(VIEW_3_INTERNAL_NAME, response.getInternalName());
assertEquals(VIEW_3_QUERY, response.getQuery());
final List<Map<String, String>> resultSet = MariaDbConfig.selectQuery(CONTAINER_1_INTERNALNAME, DATABASE_1_INTERNALNAME,
"SELECT j.* FROM `junit3` j", "mintemp", "rainfall", "location", "lat", "lng");
"SELECT j.* FROM `debug` j", "mintemp", "rainfall", "location", "lat", "lng");
assertEquals("13.4", resultSet.get(0).get("mintemp"));
assertEquals("0.6", resultSet.get(0).get("rainfall"));
assertEquals("Albury", resultSet.get(0).get("location"));
......
......@@ -37,7 +37,7 @@ VALUES (1, '2008-12-01', 'Albury', 13.4, 0.6),
## TEST CASE PRE-REQUISITE ##
########################################################################################################################
CREATE VIEW mock_view AS
CREATE VIEW junit2 AS
(
SELECT `location`, `lat`, `lng`
FROM `weather_location`
......
......@@ -136,7 +136,7 @@ public class ViewServiceImpl extends HibernateConnector implements ViewService {
createViewStatement.executeUpdate();
} catch (SQLException e) {
log.error("Failed to create view: {}", e.getMessage());
throw new ViewMalformedException("Failed to create view", e);
throw new ViewMalformedException("Failed to create view: " + e.getMessage(), e);
} finally {
dataSource.close();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment