Fixed device api sql test
This commit is contained in:
parent
ea5f4d78f0
commit
3c3a4e4c74
@ -32,8 +32,9 @@ public class SystemSqlTestSuite {
|
|||||||
@ClassRule
|
@ClassRule
|
||||||
public static CustomSqlUnit sqlUnit = new CustomSqlUnit(
|
public static CustomSqlUnit sqlUnit = new CustomSqlUnit(
|
||||||
Arrays.asList("sql/schema.sql", "sql/system-data.sql"),
|
Arrays.asList("sql/schema.sql", "sql/system-data.sql"),
|
||||||
"sql-test.properties",
|
"sql/drop-all-tables.sql",
|
||||||
"sql/drop-all-tables.sql");
|
"sql-test.properties"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -228,7 +228,7 @@ CREATE TABLE IF NOT EXISTS widget_type (
|
|||||||
id uuid NOT NULL CONSTRAINT widget_type_pkey PRIMARY KEY,
|
id uuid NOT NULL CONSTRAINT widget_type_pkey PRIMARY KEY,
|
||||||
alias character varying(255),
|
alias character varying(255),
|
||||||
bundle_alias character varying(255),
|
bundle_alias character varying(255),
|
||||||
descriptor varchar(2000000),
|
descriptor varchar(1000000),
|
||||||
name character varying(255),
|
name character varying(255),
|
||||||
tenant_id uuid
|
tenant_id uuid
|
||||||
);
|
);
|
||||||
|
|||||||
@ -36,16 +36,24 @@ import java.util.Properties;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class CustomSqlUnit extends ExternalResource {
|
public class CustomSqlUnit extends ExternalResource {
|
||||||
|
|
||||||
private List<String> sqlFiles;
|
private final List<String> sqlFiles;
|
||||||
private String dropAllTablesSqlFile;
|
private final String dropAllTablesSqlFile;
|
||||||
private String dbUrl;
|
private final String dbUrl;
|
||||||
private String dbUserName;
|
private final String dbUserName;
|
||||||
private String dbPassword;
|
private final String dbPassword;
|
||||||
|
|
||||||
public CustomSqlUnit(List<String> sqlFiles, String configurationFileName, String dropAllTablesSqlFile) {
|
public CustomSqlUnit(List<String> sqlFiles, String dropAllTablesSqlFile, String configurationFileName) {
|
||||||
this.sqlFiles = sqlFiles;
|
this.sqlFiles = sqlFiles;
|
||||||
this.dropAllTablesSqlFile = dropAllTablesSqlFile;
|
this.dropAllTablesSqlFile = dropAllTablesSqlFile;
|
||||||
loadProperties(configurationFileName);
|
final Properties properties = new Properties();
|
||||||
|
try (final InputStream stream = this.getClass().getClassLoader().getResourceAsStream(configurationFileName)) {
|
||||||
|
properties.load(stream);
|
||||||
|
this.dbUrl = properties.getProperty("spring.datasource.url");
|
||||||
|
this.dbUserName = properties.getProperty("spring.datasource.username");
|
||||||
|
this.dbPassword = properties.getProperty("spring.datasource.password");
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e.getMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -91,17 +99,4 @@ public class CustomSqlUnit extends ExternalResource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadProperties(String fileName) {
|
|
||||||
final Properties properties = new Properties();
|
|
||||||
try (final InputStream stream = this.getClass().getClassLoader().getResourceAsStream(fileName)) {
|
|
||||||
properties.load(stream);
|
|
||||||
this.dbUrl = properties.getProperty("spring.datasource.url");
|
|
||||||
this.dbUserName = properties.getProperty("spring.datasource.username");
|
|
||||||
this.dbPassword = properties.getProperty("spring.datasource.password");
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,14 +24,15 @@ import java.util.Arrays;
|
|||||||
|
|
||||||
@RunWith(ClasspathSuite.class)
|
@RunWith(ClasspathSuite.class)
|
||||||
@ClassnameFilters({
|
@ClassnameFilters({
|
||||||
"org.thingsboard.server.dao.sql.*ABTest"
|
"org.thingsboard.server.dao.sql.*AASDTest"
|
||||||
})
|
})
|
||||||
public class JpaDaoTestSuite {
|
public class JpaDaoTestSuite {
|
||||||
|
|
||||||
@ClassRule
|
@ClassRule
|
||||||
public static CustomSqlUnit sqlUnit = new CustomSqlUnit(
|
public static CustomSqlUnit sqlUnit = new CustomSqlUnit(
|
||||||
Arrays.asList("sql/schema.sql", "sql/system-data.sql"),
|
Arrays.asList("sql/schema.sql", "sql/system-data.sql"),
|
||||||
"sql-test.properties",
|
"sql/drop-all-tables.sql",
|
||||||
"sql/drop-all-tables.sql");
|
"sql-test.properties"
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,7 +31,8 @@ public class SqlDaoServiceTestSuite {
|
|||||||
@ClassRule
|
@ClassRule
|
||||||
public static CustomSqlUnit sqlUnit = new CustomSqlUnit(
|
public static CustomSqlUnit sqlUnit = new CustomSqlUnit(
|
||||||
Arrays.asList("sql/schema.sql", "sql/system-data.sql", "sql/system-test.sql"),
|
Arrays.asList("sql/schema.sql", "sql/system-data.sql", "sql/system-test.sql"),
|
||||||
"sql-test.properties",
|
"sql/drop-all-tables.sql",
|
||||||
"sql/drop-all-tables.sql");
|
"sql-test.properties"
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user