Skip to content

Commit

Permalink
Added code for issue 400
Browse files Browse the repository at this point in the history
  • Loading branch information
Shobhit2884 committed Jun 4, 2018
1 parent 32ccd1d commit ef81dee
Show file tree
Hide file tree
Showing 13 changed files with 80 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,13 @@ public void performInstall() {

componentDiscoveryService.discoverComponents();

systemDataLoaderService.loadSystemThemes();
systemDataLoaderService.createSysAdmin();
systemDataLoaderService.createAdminSettings();
systemDataLoaderService.loadSystemWidgets();
systemDataLoaderService.loadSystemPlugins();
systemDataLoaderService.loadSystemRules();
systemDataLoaderService.loadSystemThemes();


if (loadDemo) {
log.info("Loading demo data...");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,18 +176,24 @@ public void createAdminSettings() throws Exception {

public void loadSystemThemes() throws Exception {

log.info("Loading theme data...");
Theme theme1 = new Theme();
theme1.setThemeName("Tempus Blue");
theme1.setThemeValue("themeBlue");
theme1.setThemeStatus(false);
themeService.saveTheme(theme1);

Theme theme2 = new Theme();
theme2.setThemeName("Tempus Dark");
theme2.setThemeValue("themeDark");
theme2.setThemeStatus(true);
themeService.saveTheme(theme2);
List<Theme> theme = themeService.findAll();

if(theme.size() < 2) {

log.info("Loading theme data...");
Theme theme1 = new Theme();
theme1.setThemeName("Tempus Blue");
theme1.setThemeValue("themeBlue");
theme1.setThemeStatus(false);
themeService.saveTheme(theme1);

Theme theme2 = new Theme();
theme2.setThemeName("Tempus Dark");
theme2.setThemeValue("themeDark");
theme2.setThemeStatus(true);
themeService.saveTheme(theme2);

}


}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ private static List<CQLDataSet> getDataSetLists(){
dataSets.addAll(Arrays.asList(
new ClassPathCQLDataSet("cassandra/upgrade/1.cql", false, false)
));

dataSets.addAll(Arrays.asList(
new ClassPathCQLDataSet("cassandra/upgrade/2.cql", false, false)
));

return dataSets;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ public class ControllerSqlTestSuite {
Arrays.asList("sql/schema.sql", "sql/system-data.sql"),
"sql/drop-all-tables.sql",
"sql-test.properties",
Arrays.asList("sql/upgrade/1.sql", "sql/upgrade/2.sql")
Arrays.asList("sql/upgrade/1.sql", "sql/upgrade/2.sql", "sql/upgrade/3.sql")
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ public class MqttSqlTestSuite {
Arrays.asList("sql/schema.sql", "sql/system-data.sql"),
"sql/drop-all-tables.sql",
"sql-test.properties",
Arrays.asList("sql/upgrade/1.sql", "sql/upgrade/2.sql"));
Arrays.asList("sql/upgrade/1.sql", "sql/upgrade/2.sql","sql/upgrade/3.sql"));
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class SystemSqlTestSuite {
Arrays.asList("sql/schema.sql", "sql/system-data.sql"),
"sql/drop-all-tables.sql",
"sql-test.properties",
Arrays.asList("sql/upgrade/1.sql", "sql/upgrade/2.sql")
Arrays.asList("sql/upgrade/1.sql", "sql/upgrade/2.sql", "sql/upgrade/3.sql")
);


Expand Down
7 changes: 0 additions & 7 deletions dao/src/main/resources/cassandra/schema.cql
Original file line number Diff line number Diff line change
Expand Up @@ -781,10 +781,3 @@ CREATE TABLE IF NOT EXISTS tempus.audit_log_by_tenant_id_partitions (
) WITH CLUSTERING ORDER BY ( partition ASC )
AND compaction = { 'class' : 'LeveledCompactionStrategy' };

CREATE TABLE IF NOT EXISTS tempus.theme (
id uuid,
name text,
value text,
is_enabled boolean,
PRIMARY KEY (id,name)
);
23 changes: 23 additions & 0 deletions dao/src/main/resources/cassandra/upgrade/2.cql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--
-- Copyright © 2017-2018 Hashmap, Inc
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--

CREATE TABLE IF NOT EXISTS tempus.theme (
id uuid,
name text,
value text,
is_enabled boolean,
PRIMARY KEY (id,name)
);
6 changes: 0 additions & 6 deletions dao/src/main/resources/sql/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,6 @@ CREATE TABLE IF NOT EXISTS computation_job (
tenant_id varchar(31)
);

CREATE TABLE IF NOT EXISTS theme (
id varchar (31) NOT NULL CONSTRAINT theme_pkey PRIMARY KEY,
name varchar,
value varchar,
is_enabled boolean
);



Expand Down
23 changes: 23 additions & 0 deletions dao/src/main/resources/sql/upgrade/3.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--
-- Copyright © 2017-2018 Hashmap, Inc
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--


CREATE TABLE IF NOT EXISTS theme (
id varchar (31) NOT NULL CONSTRAINT theme_pkey PRIMARY KEY,
name varchar,
value varchar,
is_enabled boolean
);
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class JpaDaoTestSuite {
Arrays.asList("sql/schema.sql", "sql/system-data.sql"),
"sql/drop-all-tables.sql",
"sql-test.properties",
Arrays.asList("sql/upgrade/1.sql", "sql/upgrade/2.sql")
Arrays.asList("sql/upgrade/1.sql", "sql/upgrade/2.sql", "sql/upgrade/3.sql")
);

}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ private static List<CQLDataSet> getDataSetLists(){
dataSets.addAll(Arrays.asList(
new ClassPathCQLDataSet("cassandra/upgrade/1.cql", false, false)
));
dataSets.addAll(Arrays.asList(
new ClassPathCQLDataSet("cassandra/upgrade/2.cql", false, false)
));

return dataSets;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ public class SqlDaoServiceTestSuite {
Arrays.asList("sql/schema.sql", "sql/system-data.sql"),
"sql/drop-all-tables.sql",
"sql-test.properties",
Arrays.asList("sql/upgrade/1.sql", "sql/upgrade/2.sql")
Arrays.asList("sql/upgrade/1.sql", "sql/upgrade/2.sql","sql/upgrade/3.sql")
);
}

0 comments on commit ef81dee

Please sign in to comment.