tables = deviceTypeConfiguration.getDataSource().getTableConfig().getTable();
+ Table deviceDefinitionTable = null;
+ for (Table table : tables) {
+ if (tableName.equals(table.getName())) {
+ deviceDefinitionTable = table;
+ break;
+ }
+ }
+ if (deviceDefinitionTable != null) {
+ deviceDAODefinition = new DeviceDAODefinition(deviceDefinitionTable);
+ }
+ }
+ }
+ return deviceDAODefinition;
+ }
+
+ /**
+ * To get the registry service.
+ * @return RegistryService
+ * @throws RegistryException Registry Exception
+ */
+ public static RegistryService getRegistryService() throws RegistryException {
+ RealmService realmService = new InMemoryRealmService();
+ RegistryDataHolder.getInstance().setRealmService(realmService);
+ DeviceManagementDataHolder.getInstance().setRealmService(realmService);
+ InputStream is = Utils.class.getClassLoader().getResourceAsStream("carbon-home/repository/conf/registry.xml");
+ RegistryContext context = RegistryContext.getBaseInstance(is, realmService);
+ context.setSetup(true);
+ return context.getEmbeddedRegistryService();
+ }
+}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/carbon-home/dbscripts/h2.sql b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/carbon-home/dbscripts/h2.sql
new file mode 100644
index 0000000000..f6b31c78d9
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/carbon-home/dbscripts/h2.sql
@@ -0,0 +1,429 @@
+CREATE TABLE IF NOT EXISTS REG_CLUSTER_LOCK (
+ REG_LOCK_NAME VARCHAR (20),
+ REG_LOCK_STATUS VARCHAR (20),
+ REG_LOCKED_TIME TIMESTAMP,
+ REG_TENANT_ID INTEGER DEFAULT 0,
+ PRIMARY KEY (REG_LOCK_NAME)
+);
+
+CREATE TABLE IF NOT EXISTS REG_LOG (
+ REG_LOG_ID INTEGER AUTO_INCREMENT,
+ REG_PATH VARCHAR (2000),
+ REG_USER_ID VARCHAR (31) NOT NULL,
+ REG_LOGGED_TIME TIMESTAMP NOT NULL,
+ REG_ACTION INTEGER NOT NULL,
+ REG_ACTION_DATA VARCHAR (500),
+ REG_TENANT_ID INTEGER DEFAULT 0,
+ PRIMARY KEY (REG_LOG_ID, REG_TENANT_ID)
+);
+
+CREATE INDEX IF NOT EXISTS REG_LOG_IND_BY_REG_LOGTIME ON REG_LOG(REG_LOGGED_TIME, REG_TENANT_ID);
+
+CREATE TABLE IF NOT EXISTS REG_PATH(
+ REG_PATH_ID INTEGER NOT NULL AUTO_INCREMENT,
+ REG_PATH_VALUE VARCHAR(2000) NOT NULL,
+ REG_PATH_PARENT_ID INT,
+ REG_TENANT_ID INTEGER DEFAULT 0,
+ CONSTRAINT PK_REG_PATH PRIMARY KEY(REG_PATH_ID, REG_TENANT_ID)
+);
+CREATE INDEX IF NOT EXISTS REG_PATH_IND_BY_NAME ON REG_PATH(REG_PATH_VALUE, REG_TENANT_ID);
+CREATE INDEX IF NOT EXISTS REG_PATH_IND_BY_PARENT_ID ON REG_PATH(REG_PATH_PARENT_ID, REG_TENANT_ID);
+
+
+CREATE TABLE IF NOT EXISTS REG_CONTENT (
+ REG_CONTENT_ID INTEGER NOT NULL AUTO_INCREMENT,
+ REG_CONTENT_DATA LONGBLOB,
+ REG_TENANT_ID INTEGER DEFAULT 0,
+ CONSTRAINT PK_REG_CONTENT PRIMARY KEY(REG_CONTENT_ID, REG_TENANT_ID)
+);
+
+CREATE TABLE IF NOT EXISTS REG_CONTENT_HISTORY (
+ REG_CONTENT_ID INTEGER NOT NULL,
+ REG_CONTENT_DATA LONGBLOB,
+ REG_DELETED SMALLINT,
+ REG_TENANT_ID INTEGER DEFAULT 0,
+ CONSTRAINT PK_REG_CONTENT_HISTORY PRIMARY KEY(REG_CONTENT_ID, REG_TENANT_ID)
+);
+
+CREATE TABLE IF NOT EXISTS REG_RESOURCE (
+ REG_PATH_ID INTEGER NOT NULL,
+ REG_NAME VARCHAR(256),
+ REG_VERSION INTEGER NOT NULL AUTO_INCREMENT,
+ REG_MEDIA_TYPE VARCHAR(500),
+ REG_CREATOR VARCHAR(31) NOT NULL,
+ REG_CREATED_TIME TIMESTAMP NOT NULL,
+ REG_LAST_UPDATOR VARCHAR(31),
+ REG_LAST_UPDATED_TIME TIMESTAMP NOT NULL,
+ REG_DESCRIPTION VARCHAR(1000),
+ REG_CONTENT_ID INTEGER,
+ REG_TENANT_ID INTEGER DEFAULT 0,
+ REG_UUID VARCHAR(100) NOT NULL,
+ CONSTRAINT PK_REG_RESOURCE PRIMARY KEY(REG_VERSION, REG_TENANT_ID)
+);
+
+ALTER TABLE REG_RESOURCE ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);
+ALTER TABLE REG_RESOURCE ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_FK_BY_CONTENT_ID FOREIGN KEY (REG_CONTENT_ID, REG_TENANT_ID) REFERENCES REG_CONTENT (REG_CONTENT_ID, REG_TENANT_ID);
+CREATE INDEX IF NOT EXISTS REG_RESOURCE_IND_BY_NAME ON REG_RESOURCE(REG_NAME, REG_TENANT_ID);
+CREATE INDEX IF NOT EXISTS REG_RESOURCE_IND_BY_PATH_ID_NAME ON REG_RESOURCE(REG_PATH_ID, REG_NAME, REG_TENANT_ID);
+CREATE INDEX IF NOT EXISTS REG_RESOURCE_IND_BY_UUID ON REG_RESOURCE(REG_UUID);
+CREATE INDEX IF NOT EXISTS REG_RESOURCE_IND_BY_TENANT ON REG_RESOURCE(REG_TENANT_ID, REG_UUID);
+CREATE INDEX IF NOT EXISTS REG_RESOURCE_IND_BY_TYPE ON REG_RESOURCE(REG_TENANT_ID, REG_MEDIA_TYPE);
+
+CREATE TABLE IF NOT EXISTS REG_RESOURCE_HISTORY (
+ REG_PATH_ID INTEGER NOT NULL,
+ REG_NAME VARCHAR(256),
+ REG_VERSION INTEGER NOT NULL,
+ REG_MEDIA_TYPE VARCHAR(500),
+ REG_CREATOR VARCHAR(31) NOT NULL,
+ REG_CREATED_TIME TIMESTAMP NOT NULL,
+ REG_LAST_UPDATOR VARCHAR(31),
+ REG_LAST_UPDATED_TIME TIMESTAMP NOT NULL,
+ REG_DESCRIPTION VARCHAR(1000),
+ REG_CONTENT_ID INTEGER,
+ REG_DELETED SMALLINT,
+ REG_TENANT_ID INTEGER DEFAULT 0,
+ REG_UUID VARCHAR(100) NOT NULL,
+ CONSTRAINT PK_REG_RESOURCE_HISTORY PRIMARY KEY(REG_VERSION, REG_TENANT_ID)
+);
+
+ALTER TABLE REG_RESOURCE_HISTORY ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_HIST_FK_BY_PATHID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);
+ALTER TABLE REG_RESOURCE_HISTORY ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_HIST_FK_BY_CONTENT_ID FOREIGN KEY (REG_CONTENT_ID, REG_TENANT_ID) REFERENCES REG_CONTENT_HISTORY (REG_CONTENT_ID, REG_TENANT_ID);
+CREATE INDEX IF NOT EXISTS REG_RESOURCE_HISTORY_IND_BY_NAME ON REG_RESOURCE_HISTORY(REG_NAME, REG_TENANT_ID);
+CREATE INDEX IF NOT EXISTS REG_RESOURCE_HISTORY_IND_BY_PATH_ID_NAME ON REG_RESOURCE(REG_PATH_ID, REG_NAME, REG_TENANT_ID);
+
+CREATE TABLE IF NOT EXISTS REG_COMMENT (
+ REG_ID INTEGER NOT NULL AUTO_INCREMENT,
+ REG_COMMENT_TEXT VARCHAR(500) NOT NULL,
+ REG_USER_ID VARCHAR(31) NOT NULL,
+ REG_COMMENTED_TIME TIMESTAMP NOT NULL,
+ REG_TENANT_ID INTEGER DEFAULT 0,
+ CONSTRAINT PK_REG_COMMENT PRIMARY KEY(REG_ID, REG_TENANT_ID)
+);
+
+CREATE TABLE IF NOT EXISTS REG_RESOURCE_COMMENT (
+ REG_COMMENT_ID INTEGER NOT NULL,
+ REG_VERSION INTEGER,
+ REG_PATH_ID INTEGER,
+ REG_RESOURCE_NAME VARCHAR(256),
+ REG_TENANT_ID INTEGER DEFAULT 0
+);
+
+ALTER TABLE REG_RESOURCE_COMMENT ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_COMMENT_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);
+ALTER TABLE REG_RESOURCE_COMMENT ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_COMMENT_FK_BY_COMMENT_ID FOREIGN KEY (REG_COMMENT_ID, REG_TENANT_ID) REFERENCES REG_COMMENT (REG_ID, REG_TENANT_ID);
+CREATE INDEX IF NOT EXISTS REG_RESOURCE_COMMENT_IND_BY_PATH_ID_AND_RESOURCE_NAME ON REG_RESOURCE_COMMENT(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID);
+CREATE INDEX IF NOT EXISTS REG_RESOURCE_COMMENT_IND_BY_VERSION ON REG_RESOURCE_COMMENT(REG_VERSION, REG_TENANT_ID);
+
+CREATE TABLE IF NOT EXISTS REG_RATING (
+ REG_ID INTEGER NOT NULL AUTO_INCREMENT,
+ REG_RATING INTEGER NOT NULL,
+ REG_USER_ID VARCHAR(31) NOT NULL,
+ REG_RATED_TIME TIMESTAMP NOT NULL,
+ REG_TENANT_ID INTEGER DEFAULT 0,
+ CONSTRAINT PK_REG_RATING PRIMARY KEY(REG_ID, REG_TENANT_ID)
+);
+
+CREATE TABLE IF NOT EXISTS REG_RESOURCE_RATING (
+ REG_RATING_ID INTEGER NOT NULL,
+ REG_VERSION INTEGER,
+ REG_PATH_ID INTEGER,
+ REG_RESOURCE_NAME VARCHAR(256),
+ REG_TENANT_ID INTEGER DEFAULT 0
+);
+
+ALTER TABLE REG_RESOURCE_RATING ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_RATING_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);
+ALTER TABLE REG_RESOURCE_RATING ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_RATING_FK_BY_RATING_ID FOREIGN KEY (REG_RATING_ID, REG_TENANT_ID) REFERENCES REG_RATING (REG_ID, REG_TENANT_ID);
+CREATE INDEX IF NOT EXISTS REG_RESOURCE_RATING_IND_BY_PATH_ID_AND_RESOURCE_NAME ON REG_RESOURCE_RATING(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID);
+CREATE INDEX IF NOT EXISTS REG_RESOURCE_RATING_IND_BY_VERSION ON REG_RESOURCE_RATING(REG_VERSION, REG_TENANT_ID);
+
+
+CREATE TABLE IF NOT EXISTS REG_TAG (
+ REG_ID INTEGER NOT NULL AUTO_INCREMENT,
+ REG_TAG_NAME VARCHAR(500) NOT NULL,
+ REG_USER_ID VARCHAR(31) NOT NULL,
+ REG_TAGGED_TIME TIMESTAMP NOT NULL,
+ REG_TENANT_ID INTEGER DEFAULT 0,
+ CONSTRAINT PK_REG_TAG PRIMARY KEY(REG_ID, REG_TENANT_ID)
+);
+
+CREATE TABLE IF NOT EXISTS REG_RESOURCE_TAG (
+ REG_TAG_ID INTEGER NOT NULL,
+ REG_VERSION INTEGER,
+ REG_PATH_ID INTEGER,
+ REG_RESOURCE_NAME VARCHAR(256),
+ REG_TENANT_ID INTEGER DEFAULT 0
+);
+
+ALTER TABLE REG_RESOURCE_TAG ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_TAG_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);
+ALTER TABLE REG_RESOURCE_TAG ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_TAG_FK_BY_TAG_ID FOREIGN KEY (REG_TAG_ID, REG_TENANT_ID) REFERENCES REG_TAG (REG_ID, REG_TENANT_ID);
+CREATE INDEX IF NOT EXISTS REG_RESOURCE_TAG_IND_BY_PATH_ID_AND_RESOURCE_NAME ON REG_RESOURCE_TAG(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID);
+CREATE INDEX IF NOT EXISTS REG_RESOURCE_TAG_IND_BY_VERSION ON REG_RESOURCE_TAG(REG_VERSION, REG_TENANT_ID);
+
+CREATE TABLE IF NOT EXISTS REG_PROPERTY (
+ REG_ID INTEGER NOT NULL AUTO_INCREMENT,
+ REG_NAME VARCHAR(100) NOT NULL,
+ REG_VALUE VARCHAR(1000),
+ REG_TENANT_ID INTEGER DEFAULT 0,
+ CONSTRAINT PK_REG_PROPERTY PRIMARY KEY(REG_ID, REG_TENANT_ID)
+);
+
+CREATE TABLE IF NOT EXISTS REG_RESOURCE_PROPERTY (
+ REG_PROPERTY_ID INTEGER NOT NULL,
+ REG_VERSION INTEGER,
+ REG_PATH_ID INTEGER,
+ REG_RESOURCE_NAME VARCHAR(256),
+ REG_TENANT_ID INTEGER DEFAULT 0
+);
+
+ALTER TABLE REG_RESOURCE_PROPERTY ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_PROPERTY_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);
+ALTER TABLE REG_RESOURCE_PROPERTY ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_PROPERTY_FK_BY_TAG_ID FOREIGN KEY (REG_PROPERTY_ID, REG_TENANT_ID) REFERENCES REG_PROPERTY (REG_ID, REG_TENANT_ID);
+CREATE INDEX IF NOT EXISTS REG_RESOURCE_PROPERTY_IND_BY_PATH_ID_AND_RESOURCE_NAME ON REG_RESOURCE_PROPERTY(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID);
+CREATE INDEX IF NOT EXISTS REG_RESOURCE_PROPERTY_IND_BY_VERSION ON REG_RESOURCE_PROPERTY(REG_VERSION, REG_TENANT_ID);
+
+CREATE TABLE IF NOT EXISTS REG_ASSOCIATION (
+ REG_ASSOCIATION_ID INTEGER AUTO_INCREMENT,
+ REG_SOURCEPATH VARCHAR (2000) NOT NULL,
+ REG_TARGETPATH VARCHAR (2000) NOT NULL,
+ REG_ASSOCIATION_TYPE VARCHAR (2000) NOT NULL,
+ REG_TENANT_ID INTEGER DEFAULT 0,
+ PRIMARY KEY (REG_ASSOCIATION_ID, REG_TENANT_ID)
+);
+
+CREATE TABLE IF NOT EXISTS REG_SNAPSHOT (
+ REG_SNAPSHOT_ID INTEGER NOT NULL AUTO_INCREMENT,
+ REG_PATH_ID INTEGER NOT NULL,
+ REG_RESOURCE_NAME VARCHAR (256),
+ REG_RESOURCE_VIDS LONGBLOB NOT NULL,
+ REG_TENANT_ID INTEGER DEFAULT 0,
+ CONSTRAINT PK_REG_SNAPSHOT PRIMARY KEY(REG_SNAPSHOT_ID, REG_TENANT_ID)
+);
+
+ALTER TABLE REG_SNAPSHOT ADD CONSTRAINT IF NOT EXISTS REG_SNAPSHOT_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);
+CREATE INDEX IF NOT EXISTS REG_SNAPSHOT_IND_BY_PATH_ID_AND_RESOURCE_NAME ON REG_SNAPSHOT(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID);
+
+-- ################################
+-- USER MANAGER TABLES
+-- ################################
+
+CREATE TABLE IF NOT EXISTS UM_TENANT (
+ UM_ID INTEGER NOT NULL AUTO_INCREMENT,
+ UM_DOMAIN_NAME VARCHAR(255) NOT NULL,
+ UM_EMAIL VARCHAR(255),
+ UM_ACTIVE BOOLEAN DEFAULT FALSE,
+ UM_CREATED_DATE TIMESTAMP NOT NULL,
+ UM_USER_CONFIG LONGBLOB NOT NULL,
+ PRIMARY KEY (UM_ID),
+ UNIQUE(UM_DOMAIN_NAME));
+
+CREATE TABLE IF NOT EXISTS UM_DOMAIN(
+ UM_DOMAIN_ID INTEGER NOT NULL AUTO_INCREMENT,
+ UM_DOMAIN_NAME VARCHAR(255),
+ UM_TENANT_ID INTEGER DEFAULT 0,
+ PRIMARY KEY (UM_DOMAIN_ID, UM_TENANT_ID)
+);
+
+CREATE INDEX IF NOT EXISTS INDEX_UM_TENANT_UM_DOMAIN_NAME ON UM_TENANT (UM_DOMAIN_NAME);
+
+CREATE TABLE IF NOT EXISTS UM_USER (
+ UM_ID INTEGER NOT NULL AUTO_INCREMENT,
+ UM_USER_NAME VARCHAR(255) NOT NULL,
+ UM_USER_PASSWORD VARCHAR(255) NOT NULL,
+ UM_SALT_VALUE VARCHAR(31),
+ UM_REQUIRE_CHANGE BOOLEAN DEFAULT FALSE,
+ UM_CHANGED_TIME TIMESTAMP NOT NULL,
+ UM_TENANT_ID INTEGER DEFAULT 0,
+ PRIMARY KEY (UM_ID, UM_TENANT_ID),
+ UNIQUE(UM_USER_NAME, UM_TENANT_ID));
+
+CREATE TABLE IF NOT EXISTS UM_SYSTEM_USER (
+ UM_ID INTEGER NOT NULL AUTO_INCREMENT,
+ UM_USER_NAME VARCHAR(255) NOT NULL,
+ UM_USER_PASSWORD VARCHAR(255) NOT NULL,
+ UM_SALT_VALUE VARCHAR(31),
+ UM_REQUIRE_CHANGE BOOLEAN DEFAULT FALSE,
+ UM_CHANGED_TIME TIMESTAMP NOT NULL,
+ UM_TENANT_ID INTEGER DEFAULT 0,
+ PRIMARY KEY (UM_ID, UM_TENANT_ID),
+ UNIQUE(UM_USER_NAME, UM_TENANT_ID));
+
+CREATE TABLE IF NOT EXISTS UM_USER_ATTRIBUTE (
+ UM_ID INTEGER NOT NULL AUTO_INCREMENT,
+ UM_ATTR_NAME VARCHAR(255) NOT NULL,
+ UM_ATTR_VALUE VARCHAR(1024),
+ UM_PROFILE_ID VARCHAR(255),
+ UM_USER_ID INTEGER,
+ UM_TENANT_ID INTEGER DEFAULT 0,
+ PRIMARY KEY (UM_ID, UM_TENANT_ID),
+ FOREIGN KEY (UM_USER_ID, UM_TENANT_ID) REFERENCES UM_USER(UM_ID, UM_TENANT_ID));
+
+CREATE INDEX IF NOT EXISTS UM_USER_ID_INDEX ON UM_USER_ATTRIBUTE(UM_USER_ID);
+
+CREATE TABLE IF NOT EXISTS UM_ROLE (
+ UM_ID INTEGER NOT NULL AUTO_INCREMENT,
+ UM_ROLE_NAME VARCHAR(255) NOT NULL,
+ UM_TENANT_ID INTEGER DEFAULT 0,
+ UM_SHARED_ROLE BOOLEAN DEFAULT FALSE,
+ PRIMARY KEY (UM_ID, UM_TENANT_ID),
+ UNIQUE(UM_ROLE_NAME, UM_TENANT_ID));
+
+CREATE TABLE IF NOT EXISTS UM_MODULE(
+ UM_ID INTEGER NOT NULL AUTO_INCREMENT,
+ UM_MODULE_NAME VARCHAR(100),
+ UNIQUE(UM_MODULE_NAME),
+ PRIMARY KEY(UM_ID)
+);
+
+CREATE TABLE IF NOT EXISTS UM_MODULE_ACTIONS(
+ UM_ACTION VARCHAR(255) NOT NULL,
+ UM_MODULE_ID INTEGER NOT NULL,
+ PRIMARY KEY(UM_ACTION, UM_MODULE_ID),
+ FOREIGN KEY (UM_MODULE_ID) REFERENCES UM_MODULE(UM_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE IF NOT EXISTS UM_PERMISSION (
+ UM_ID INTEGER NOT NULL AUTO_INCREMENT,
+ UM_RESOURCE_ID VARCHAR(255) NOT NULL,
+ UM_ACTION VARCHAR(255) NOT NULL,
+ UM_TENANT_ID INTEGER DEFAULT 0,
+ UM_MODULE_ID INTEGER DEFAULT 0,
+ UNIQUE(UM_RESOURCE_ID,UM_ACTION, UM_TENANT_ID),
+ PRIMARY KEY (UM_ID, UM_TENANT_ID));
+
+CREATE INDEX IF NOT EXISTS INDEX_UM_PERMISSION_UM_RESOURCE_ID_UM_ACTION ON UM_PERMISSION (UM_RESOURCE_ID, UM_ACTION, UM_TENANT_ID);
+
+CREATE TABLE IF NOT EXISTS UM_ROLE_PERMISSION (
+ UM_ID INTEGER NOT NULL AUTO_INCREMENT,
+ UM_PERMISSION_ID INTEGER NOT NULL,
+ UM_ROLE_NAME VARCHAR(255) NOT NULL,
+ UM_IS_ALLOWED SMALLINT NOT NULL,
+ UM_TENANT_ID INTEGER DEFAULT 0,
+ UM_DOMAIN_ID INTEGER,
+ FOREIGN KEY (UM_PERMISSION_ID, UM_TENANT_ID) REFERENCES UM_PERMISSION(UM_ID, UM_TENANT_ID) ON DELETE CASCADE,
+ FOREIGN KEY (UM_DOMAIN_ID, UM_TENANT_ID) REFERENCES UM_DOMAIN(UM_DOMAIN_ID, UM_TENANT_ID) ON DELETE CASCADE,
+ PRIMARY KEY (UM_ID, UM_TENANT_ID));
+
+CREATE TABLE IF NOT EXISTS UM_USER_PERMISSION (
+ UM_ID INTEGER NOT NULL AUTO_INCREMENT,
+ UM_PERMISSION_ID INTEGER NOT NULL,
+ UM_USER_NAME VARCHAR(255) NOT NULL,
+ UM_IS_ALLOWED SMALLINT NOT NULL,
+ UNIQUE (UM_PERMISSION_ID, UM_USER_NAME, UM_TENANT_ID),
+ UM_TENANT_ID INTEGER DEFAULT 0,
+ FOREIGN KEY (UM_PERMISSION_ID, UM_TENANT_ID) REFERENCES UM_PERMISSION(UM_ID, UM_TENANT_ID) ON DELETE CASCADE,
+ PRIMARY KEY (UM_ID, UM_TENANT_ID));
+
+CREATE TABLE IF NOT EXISTS UM_USER_ROLE (
+ UM_ID INTEGER NOT NULL AUTO_INCREMENT,
+ UM_ROLE_ID INTEGER NOT NULL,
+ UM_USER_ID INTEGER NOT NULL,
+ UM_TENANT_ID INTEGER DEFAULT 0,
+ UNIQUE (UM_USER_ID, UM_ROLE_ID, UM_TENANT_ID),
+ FOREIGN KEY (UM_ROLE_ID, UM_TENANT_ID) REFERENCES UM_ROLE(UM_ID, UM_TENANT_ID),
+ FOREIGN KEY (UM_USER_ID, UM_TENANT_ID) REFERENCES UM_USER(UM_ID, UM_TENANT_ID),
+ PRIMARY KEY (UM_ID, UM_TENANT_ID));
+
+
+CREATE TABLE IF NOT EXISTS UM_SHARED_USER_ROLE(
+ UM_ROLE_ID INTEGER NOT NULL,
+ UM_USER_ID INTEGER NOT NULL,
+ UM_USER_TENANT_ID INTEGER NOT NULL,
+ UM_ROLE_TENANT_ID INTEGER NOT NULL,
+ UNIQUE(UM_USER_ID,UM_ROLE_ID,UM_USER_TENANT_ID, UM_ROLE_TENANT_ID),
+ FOREIGN KEY(UM_ROLE_ID,UM_ROLE_TENANT_ID) REFERENCES UM_ROLE(UM_ID,UM_TENANT_ID) ON DELETE CASCADE ,
+ FOREIGN KEY(UM_USER_ID,UM_USER_TENANT_ID) REFERENCES UM_USER(UM_ID,UM_TENANT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE IF NOT EXISTS UM_ACCOUNT_MAPPING(
+ UM_ID INTEGER NOT NULL AUTO_INCREMENT,
+ UM_USER_NAME VARCHAR(255) NOT NULL,
+ UM_TENANT_ID INTEGER NOT NULL,
+ UM_USER_STORE_DOMAIN VARCHAR(100),
+ UM_ACC_LINK_ID INTEGER NOT NULL,
+ UNIQUE(UM_USER_NAME, UM_TENANT_ID, UM_USER_STORE_DOMAIN, UM_ACC_LINK_ID),
+ FOREIGN KEY (UM_TENANT_ID) REFERENCES UM_TENANT(UM_ID) ON DELETE CASCADE,
+ PRIMARY KEY (UM_ID)
+);
+
+
+CREATE TABLE IF NOT EXISTS UM_DIALECT(
+ UM_ID INTEGER NOT NULL AUTO_INCREMENT,
+ UM_DIALECT_URI VARCHAR(255) NOT NULL,
+ UM_TENANT_ID INTEGER DEFAULT 0,
+ UNIQUE(UM_DIALECT_URI, UM_TENANT_ID),
+ PRIMARY KEY (UM_ID, UM_TENANT_ID)
+);
+
+
+CREATE TABLE IF NOT EXISTS UM_CLAIM(
+ UM_ID INTEGER NOT NULL AUTO_INCREMENT,
+ UM_DIALECT_ID INTEGER NOT NULL,
+ UM_CLAIM_URI VARCHAR(255) NOT NULL,
+ UM_DISPLAY_TAG VARCHAR(255),
+ UM_DESCRIPTION VARCHAR(255),
+ UM_MAPPED_ATTRIBUTE_DOMAIN VARCHAR(255),
+ UM_MAPPED_ATTRIBUTE VARCHAR(255),
+ UM_REG_EX VARCHAR(255),
+ UM_SUPPORTED SMALLINT,
+ UM_REQUIRED SMALLINT,
+ UM_DISPLAY_ORDER INTEGER,
+ UM_CHECKED_ATTRIBUTE SMALLINT,
+ UM_READ_ONLY SMALLINT,
+ UM_TENANT_ID INTEGER DEFAULT 0,
+ UNIQUE(UM_DIALECT_ID, UM_CLAIM_URI,UM_MAPPED_ATTRIBUTE_DOMAIN, UM_TENANT_ID),
+ FOREIGN KEY(UM_DIALECT_ID, UM_TENANT_ID) REFERENCES UM_DIALECT(UM_ID, UM_TENANT_ID),
+ PRIMARY KEY (UM_ID, UM_TENANT_ID)
+);
+
+CREATE TABLE IF NOT EXISTS UM_PROFILE_CONFIG(
+ UM_ID INTEGER NOT NULL AUTO_INCREMENT,
+ UM_DIALECT_ID INTEGER,
+ UM_PROFILE_NAME VARCHAR(255),
+ UM_TENANT_ID INTEGER DEFAULT 0,
+ FOREIGN KEY(UM_DIALECT_ID, UM_TENANT_ID) REFERENCES UM_DIALECT(UM_ID, UM_TENANT_ID),
+ PRIMARY KEY (UM_ID, UM_TENANT_ID)
+);
+
+
+CREATE TABLE IF NOT EXISTS UM_HYBRID_ROLE(
+ UM_ID INTEGER NOT NULL AUTO_INCREMENT,
+ UM_ROLE_NAME VARCHAR(255),
+ UM_TENANT_ID INTEGER DEFAULT 0,
+ PRIMARY KEY (UM_ID, UM_TENANT_ID)
+);
+
+CREATE TABLE IF NOT EXISTS UM_HYBRID_USER_ROLE(
+ UM_ID INTEGER NOT NULL AUTO_INCREMENT,
+ UM_USER_NAME VARCHAR(255),
+ UM_ROLE_ID INTEGER NOT NULL,
+ UM_TENANT_ID INTEGER DEFAULT 0,
+ UM_DOMAIN_ID INTEGER,
+ UNIQUE (UM_USER_NAME, UM_ROLE_ID, UM_TENANT_ID,UM_DOMAIN_ID),
+ FOREIGN KEY (UM_ROLE_ID, UM_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID, UM_TENANT_ID) ON DELETE CASCADE,
+ FOREIGN KEY (UM_DOMAIN_ID, UM_TENANT_ID) REFERENCES UM_DOMAIN(UM_DOMAIN_ID, UM_TENANT_ID) ON DELETE CASCADE,
+ PRIMARY KEY (UM_ID, UM_TENANT_ID)
+);
+
+CREATE TABLE IF NOT EXISTS UM_HYBRID_REMEMBER_ME (
+ UM_ID INTEGER NOT NULL AUTO_INCREMENT,
+ UM_USER_NAME VARCHAR(255) NOT NULL,
+ UM_COOKIE_VALUE VARCHAR(1024),
+ UM_CREATED_TIME TIMESTAMP,
+ UM_TENANT_ID INTEGER DEFAULT 0,
+ PRIMARY KEY (UM_ID, UM_TENANT_ID)
+);
+
+CREATE TABLE IF NOT EXISTS UM_SYSTEM_ROLE(
+ UM_ID INTEGER NOT NULL AUTO_INCREMENT,
+ UM_ROLE_NAME VARCHAR(255),
+ UM_TENANT_ID INTEGER DEFAULT 0,
+ PRIMARY KEY (UM_ID, UM_TENANT_ID)
+);
+
+CREATE TABLE IF NOT EXISTS UM_SYSTEM_USER_ROLE(
+ UM_ID INTEGER NOT NULL AUTO_INCREMENT,
+ UM_USER_NAME VARCHAR(255),
+ UM_ROLE_ID INTEGER NOT NULL,
+ UM_TENANT_ID INTEGER DEFAULT 0,
+ UNIQUE (UM_USER_NAME, UM_ROLE_ID, UM_TENANT_ID),
+ FOREIGN KEY (UM_ROLE_ID, UM_TENANT_ID) REFERENCES UM_SYSTEM_ROLE(UM_ID, UM_TENANT_ID),
+ PRIMARY KEY (UM_ID, UM_TENANT_ID)
+);
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/carbon-home/repository/conf/carbon.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/carbon-home/repository/conf/carbon.xml
new file mode 100644
index 0000000000..31752cf9b4
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/carbon-home/repository/conf/carbon.xml
@@ -0,0 +1,656 @@
+
+
+
+
+
+
+
+
+ ${product.name}
+
+
+ ${product.key}
+
+
+ ${product.version}
+
+
+
+
+
+
+
+
+ local:/${carbon.context}/services/
+
+
+
+
+
+
+ ${default.server.role}
+
+
+
+
+
+
+ org.wso2.carbon
+
+
+ /
+
+
+
+
+
+
+
+
+ 15
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ 9999
+
+ 11111
+
+
+
+
+
+ 10389
+
+ 8000
+
+
+
+
+
+ 10500
+
+
+
+
+
+
+ org.wso2.carbon.tomcat.jndi.CarbonJavaURLContextFactory
+
+
+
+
+
+
+
+
+ java
+
+
+
+
+
+
+
+
+
+ false
+
+
+ false
+
+
+ 600
+
+
+
+ false
+
+
+
+
+
+
+
+ 30
+
+
+
+
+
+
+
+
+ 15
+
+
+
+
+
+ ${carbon.home}/repository/deployment/server/
+
+
+ 15
+
+
+ ${carbon.home}/repository/conf/axis2/axis2.xml
+
+
+ 30000
+
+
+ ${carbon.home}/repository/deployment/client/
+
+ ${carbon.home}/repository/conf/axis2/axis2_client.xml
+
+ true
+
+
+
+
+
+
+
+
+
+ admin
+ Default Administrator Role
+
+
+ user
+ Default User Role
+
+
+
+
+
+
+
+
+
+
+
+ ${carbon.home}/repository/resources/security/wso2carbon.jks
+
+ JKS
+
+ wso2carbon
+
+ wso2carbon
+
+ wso2carbon
+
+
+
+
+
+ ${carbon.home}/repository/resources/security/client-truststore.jks
+
+ JKS
+
+ wso2carbon
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ UserManager
+
+
+ false
+
+
+
+
+
+
+ ${carbon.home}/tmp/work
+
+
+
+
+
+ true
+
+
+ 10
+
+
+ 30
+
+
+
+
+
+ 100
+
+
+
+ keystore
+ certificate
+ *
+
+ org.wso2.carbon.ui.transports.fileupload.AnyFileUploadExecutor
+
+
+
+
+ jarZip
+
+ org.wso2.carbon.ui.transports.fileupload.JarZipUploadExecutor
+
+
+
+ dbs
+
+ org.wso2.carbon.ui.transports.fileupload.DBSFileUploadExecutor
+
+
+
+ tools
+
+ org.wso2.carbon.ui.transports.fileupload.ToolsFileUploadExecutor
+
+
+
+ toolsAny
+
+ org.wso2.carbon.ui.transports.fileupload.ToolsAnyFileUploadExecutor
+
+
+
+
+
+
+ - info
+ org.wso2.carbon.core.transports.util.InfoProcessor
+
+
+ - wsdl
+ org.wso2.carbon.core.transports.util.Wsdl11Processor
+
+
+ - wsdl2
+ org.wso2.carbon.core.transports.util.Wsdl20Processor
+
+
+ - xsd
+ org.wso2.carbon.core.transports.util.XsdProcessor
+
+
+
+
+
+ false
+ false
+ true
+ svn
+ http://svnrepo.example.com/repos/
+ username
+ password
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${require.carbon.servlet}
+
+
+
+
+ true
+
+
+
+
+
+
+ default repository
+ ${p2.repo.url}
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ true
+
+
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/carbon-home/repository/conf/etc/device-mgt-plugin-configs/mobile/sample-default-platform-configuration.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/carbon-home/repository/conf/etc/device-mgt-plugin-configs/mobile/sample-default-platform-configuration.xml
new file mode 100644
index 0000000000..5c529cdfa9
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/carbon-home/repository/conf/etc/device-mgt-plugin-configs/mobile/sample-default-platform-configuration.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+ sample
+
+ test
+ String
+ test
+
+
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/carbon-home/repository/conf/registry.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/carbon-home/repository/conf/registry.xml
new file mode 100644
index 0000000000..0bb97a7dc9
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/carbon-home/repository/conf/registry.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+ wso2registry
+ false
+ true
+ /
+
+
+ jdbc:h2:./target/databasetest/CARBON_TEST
+
+ org.h2.Driver
+ 80
+ 60000
+ 5
+
+
+ false
+
+
+
+ true
+ true
+ true
+ true
+
+
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/android.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/android.xml
new file mode 100644
index 0000000000..176469c329
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/android.xml
@@ -0,0 +1,381 @@
+
+
+
+
+
+
+
+
+ en_US
+ 1.0.0
+ This End User License Agreement ("Agreement") is a legal agreement between you ("You") and WSO2,
+ Inc., regarding the enrollment of Your personal mobile device ("Device") in SoR's mobile device
+ management program, and the loading to and removal from Your Device and Your use of certain
+ applications and any associated software and user documentation, whether provided in "online" or
+ electronic format, used in connection with the operation of or provision of services to WSO2,
+ Inc., BY SELECTING "I ACCEPT" DURING INSTALLATION, YOU ARE ENROLLING YOUR DEVICE, AND THEREBY
+ AUTHORIZING SOR OR ITS AGENTS TO INSTALL, UPDATE AND REMOVE THE APPS FROM YOUR DEVICE AS DESCRIBED
+ IN THIS AGREEMENT. YOU ARE ALSO EXPLICITLY ACKNOWLEDGING AND AGREEING THAT (1) THIS IS A BINDING
+ CONTRACT AND (2) YOU HAVE READ AND AGREE TO THE TERMS OF THIS AGREEMENT.
+
+ IF YOU DO NOT ACCEPT THESE TERMS, DO NOT ENROLL YOUR DEVICE AND DO NOT PROCEED ANY FURTHER.
+
+ You agree that: (1) You understand and agree to be bound by the terms and conditions contained in
+ this Agreement, and (2) You are at least 21 years old and have the legal capacity to enter into
+ this Agreement as defined by the laws of Your jurisdiction. SoR shall have the right, without
+ prior notice, to terminate or suspend (i) this Agreement, (ii) the enrollment of Your Device, or
+ (iii) the functioning of the Apps in the event of a violation of this Agreement or the cessation
+ of Your relationship with SoR (including termination of Your employment if You are an employee or
+ expiration or termination of Your applicable franchise or supply agreement if You are a franchisee
+ of or supplier to the WSO2 WSO2, Inc., system). SoR expressly reserves all rights not expressly
+ granted herein.
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+ jdbc/MobileAndroidDM_DS
+
+
+
+ DEVICE_ID
+
+ FCM_TOKEN
+ DEVICE_INFO
+ IMEI
+ IMSI
+ OS_VERSION
+ DEVICE_MODEL
+ VENDOR
+ LATITUDE
+ LONGITUDE
+ SERIAL
+ MAC_ADDRESS
+ DEVICE_NAME
+ OS_BUILD_DATE
+
+
+
+
+
+
+
+ Ring
+ Ring the device
+
+
+
+
+ Device Lock
+ Lock the device
+
+
+
+
+ Location
+ Request coordinates of device location
+
+
+
+
+ Clear Password
+ Clear current password
+
+
+
+
+ Reboot
+ Reboot the device
+
+
+
+
+ Upgrade Firmware
+ Upgrade Firmware
+
+
+
+
+ Mute
+ Enable mute in the device
+
+
+
+
+ Message
+ Send message
+
+
+
+
+ Change Lock-code
+ Change current lock code
+
+
+
+
+ Enterprise Wipe
+ Remove enterprise applications
+
+
+
+
+ Wipe Data
+ Factory reset the device
+
+
+
+
+ Wifi
+ Setting up wifi configuration
+
+
+ Camera
+ Enable or disable camera
+
+
+ Email
+ Configure email settings
+
+
+ Device info
+ Request device information
+
+
+ Application List
+ Request list of current installed applications
+
+
+ Install App
+ Install App
+
+
+ Uninstall App
+ Uninstall App
+
+
+ Blacklist app
+ Blacklist applications
+
+
+ Encrypt Storage
+ Encrypt storage
+
+
+ Password Policy
+ Set passcode policy
+
+
+ Configure VPN
+ Configure VPN settings
+
+
+ Disallow user to change volume
+ Allow or disallow user to change volume"
+
+
+ Disallow bluetooth configuration
+ Allow or disallow bluetooth configuration
+
+
+ Disallow user to change cell broadcast configurations
+ Allow or disallow user to change cell broadcast configurations
+
+
+ Disallow user to change user credentials
+ Allow or disallow user to change user credentials
+
+
+ Disallow user to change mobile networks configurations
+ Allow or disallow user to change mobile networks configurations
+
+
+ Disallow user to change tethering configurations
+ Allow or disallow user to change tethering configurations
+
+
+ Disallow user to change VPN configurations
+ Allow or disallow user to change VPN configurations
+
+
+ Disallow user to change WIFI configurations
+ Allow or disallow user to change WIFI configurations
+
+
+ Disallow user to change app control
+ Allow or disallow user to change app control
+
+
+ Disallow window creation
+ Allow or disallow window creation
+
+
+ Disallow user to change app control configurations
+ Allow or disallow user to change app control configurations
+
+
+ Disallow cross profile copy paste
+ Allow or disallow cross profile copy paste
+
+
+ Disallow debugging features
+ Allow or disallow debugging features
+
+
+ Disallow factory reset
+ Allow or disallow factory reset
+
+
+ Disallow add user
+ Allow or disallow add user
+
+
+ Disallow install apps
+ Allow or disallow install apps
+
+
+ Disallow install unknown sources
+ Allow or disallow install unknown sources
+
+
+ Disallow modify account
+ Allow or disallow modify account
+
+
+ Disallow mount physical media
+ Allow or disallow mount physical media
+
+
+ Disallow network reset
+ Allow or disallow network reset
+
+
+ Disallow outgoing beam
+ Allow or disallow outgoing beam
+
+
+ Disallow outgoing calls
+ Allow or disallow outgoing calls
+
+
+ Disallow remove users
+ Allow or disallow remove users
+
+
+ Disallow safe boot
+ Allow or disallow safe boot
+
+
+ Disallow share location
+ Allow or disallow share location
+
+
+ Disallow sms
+ Allow or disallow sms
+
+
+ Disallow uninstall app
+ Allow or disallow uninstall app
+
+
+ Disallow unmute mic
+ Allow or disallow unmute mic
+
+
+ Disallow usb file transfer
+ Allow or disallow usb file transfer
+
+
+ Disallow parent profile app linking
+ Allow or disallow parent profile app linking
+
+
+ Disallow ensure verify apps
+ Allow or disallow ensure verify apps
+
+
+ Disallow auto timing
+ Allow or disallow auto timing
+
+
+ Remove device owner
+ Remove device owner
+
+
+ Fetch device logcat
+ Fetch device logcat
+
+
+ Unlock the device
+ Unlock the device
+
+
+
+ true
+ 60000
+
+
+ DEVICE_INFO
+ 1
+
+
+ APPLICATION_LIST
+ 5
+
+
+ DEVICE_LOCATION
+ 1
+
+
+
+
+
+ DEVICE_INFO
+ APPLICATION_LIST
+ DEVICE_LOCATION
+
+
+ true
+ 300
+ 900
+ 600
+
+
+
+ false
+
+
+
+
+ admin
+
+
+
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/android_sense.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/android_sense.xml
new file mode 100644
index 0000000000..fbc58a1115
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/android_sense.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+ Add Keywords
+ Send keywords to the device
+
+
+ Add Threshold
+ Send Threshold to the device
+
+
+ Remove words
+ Remove Threshold from the device
+
+
+
+
+ true
+
+
+
+ true
+
+
+
+ en_US
+ 1.0.0
+ This is license text
+
+
+
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/arduino.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/arduino.xml
new file mode 100644
index 0000000000..eb12e9ccb3
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/arduino.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+ Control Bulb
+ Control Bulb on Arduino Uno
+
+
+ state
+
+
+
+
+
+
+ true
+
+
+
+ en_US
+ 1.0.0
+ This is license text
+
+
+
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/defective-devicetype.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/defective-devicetype.xml
new file mode 100644
index 0000000000..965b0cebe2
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/defective-devicetype.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+ Control Bulb
+ Control Bulb on Arduino Uno
+
+
+ state
+
+
+
+
+
+
+ true
+
+
+
+ en_US
+ 1.0.0
+ This is license text
+
+
+
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/defective-devicetype2.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/defective-devicetype2.xml
new file mode 100644
index 0000000000..0f1baff1c3
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/defective-devicetype2.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+ Control Bulb
+ Control Bulb on Arduino Uno
+
+
+ state
+
+
+
+
+
+
+ true
+
+
+
+ en_US
+ 1.0.0
+ This is license text
+
+
+
+
+ jdbc/MobileAndroidDM_DS
+
+
+
+
+
+
+
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/license.rxt b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/license.rxt
new file mode 100644
index 0000000000..3fa9d8b7c9
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/license.rxt
@@ -0,0 +1,41 @@
+
+
+ /device-mgt/license/@{overview_name}/@{overview_language}/@{overview_version}
+ overview_name
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Name
+
+
+ Language
+
+
+ Version
+
+
+ Validity From
+
+
+ Validity To
+
+
+ License
+
+
+
+
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/raspberrypi.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/raspberrypi.xml
new file mode 100644
index 0000000000..5115fafd8e
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/raspberrypi.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+ Control Bulb
+ Control Bulb on Raspberrypi
+
+
+ state
+
+
+
+
+
+
+
+ true
+
+ 1
+
+
+
+
+ en_US
+ 1.0.0
+ This is license text
+
+
+
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/sample.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/sample.xml
similarity index 100%
rename from components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/sample.xml
rename to components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/sample.xml
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/sql-files/android_h2.sql b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/sql-files/android_h2.sql
new file mode 100644
index 0000000000..9eed9b2d5e
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/sql-files/android_h2.sql
@@ -0,0 +1,31 @@
+
+-- -----------------------------------------------------
+-- Table `AD_DEVICE`
+-- -----------------------------------------------------
+CREATE TABLE IF NOT EXISTS `AD_DEVICE` (
+ `DEVICE_ID` VARCHAR(45) NOT NULL,
+ `FCM_TOKEN` VARCHAR(1000) NULL DEFAULT NULL,
+ `DEVICE_INFO` VARCHAR(8000) NULL DEFAULT NULL,
+ `IMEI` VARCHAR(45) NULL DEFAULT NULL,
+ `IMSI` VARCHAR(45) NULL DEFAULT NULL,
+ `OS_VERSION` VARCHAR(45) NULL DEFAULT NULL,
+ `DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL,
+ `VENDOR` VARCHAR(45) NULL DEFAULT NULL,
+ `LATITUDE` VARCHAR(45) NULL DEFAULT NULL,
+ `LONGITUDE` VARCHAR(45) NULL DEFAULT NULL,
+ `SERIAL` VARCHAR(45) NULL DEFAULT NULL,
+ `MAC_ADDRESS` VARCHAR(45) NULL DEFAULT NULL,
+ `DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL,
+ `OS_BUILD_DATE` VARCHAR(100) NULL DEFAULT NULL,
+ PRIMARY KEY (`DEVICE_ID`));
+
+-- -----------------------------------------------------
+-- Table `AD_FEATURE`
+-- -----------------------------------------------------
+CREATE TABLE IF NOT EXISTS `AD_FEATURE` (
+ `ID` INT NOT NULL AUTO_INCREMENT,
+ `CODE` VARCHAR(45) NOT NULL,
+ `NAME` VARCHAR(100) NULL,
+ `DESCRIPTION` VARCHAR(200) NULL,
+ PRIMARY KEY (`ID`));
+
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/sql-files/h2.sql b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/sql-files/h2.sql
new file mode 100644
index 0000000000..686d0a6b3b
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/sql-files/h2.sql
@@ -0,0 +1,531 @@
+CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE (
+ ID INT AUTO_INCREMENT NOT NULL,
+ NAME VARCHAR(300) NULL DEFAULT NULL,
+ DEVICE_TYPE_META VARCHAR(20000) NULL DEFAULT NULL,
+ LAST_UPDATED_TIMESTAMP TIMESTAMP NOT NULL,
+ PROVIDER_TENANT_ID INTEGER DEFAULT 0,
+ SHARED_WITH_ALL_TENANTS BOOLEAN NOT NULL DEFAULT FALSE,
+ PRIMARY KEY (ID)
+);
+
+CREATE TABLE IF NOT EXISTS DM_GROUP (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
+ GROUP_NAME VARCHAR(100) DEFAULT NULL,
+ DESCRIPTION TEXT DEFAULT NULL,
+ OWNER VARCHAR(45) DEFAULT NULL,
+ TENANT_ID INTEGER DEFAULT 0,
+ PRIMARY KEY (ID)
+);
+
+CREATE TABLE IF NOT EXISTS DM_ROLE_GROUP_MAP (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
+ GROUP_ID INTEGER DEFAULT NULL,
+ ROLE VARCHAR(45) DEFAULT NULL,
+ TENANT_ID INTEGER DEFAULT 0,
+ PRIMARY KEY (ID),
+ CONSTRAINT fk_DM_ROLE_GROUP_MAP_DM_GROUP2 FOREIGN KEY (GROUP_ID)
+ REFERENCES DM_GROUP (ID) ON DELETE CASCADE ON UPDATE CASCADE
+);
+
+CREATE TABLE IF NOT EXISTS DM_DEVICE (
+ ID INTEGER auto_increment NOT NULL,
+ DESCRIPTION TEXT DEFAULT NULL,
+ NAME VARCHAR(100) DEFAULT NULL,
+ DEVICE_TYPE_ID INT(11) DEFAULT NULL,
+ DEVICE_IDENTIFICATION VARCHAR(300) DEFAULT NULL,
+ LAST_UPDATED_TIMESTAMP TIMESTAMP NOT NULL,
+ TENANT_ID INTEGER DEFAULT 0,
+ PRIMARY KEY (ID),
+ CONSTRAINT fk_DM_DEVICE_DM_DEVICE_TYPE2 FOREIGN KEY (DEVICE_TYPE_ID)
+ REFERENCES DM_DEVICE_TYPE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ CONSTRAINT uk_DM_DEVICE UNIQUE (NAME, DEVICE_TYPE_ID, DEVICE_IDENTIFICATION, TENANT_ID)
+);
+
+CREATE TABLE IF NOT EXISTS DM_DEVICE_PROPERTIES (
+ DEVICE_TYPE_NAME VARCHAR(300) NOT NULL,
+ DEVICE_IDENTIFICATION VARCHAR(300) NOT NULL,
+ PROPERTY_NAME VARCHAR(100) DEFAULT 0,
+ PROPERTY_VALUE VARCHAR(100) DEFAULT NULL,
+ TENANT_ID VARCHAR(100),
+ PRIMARY KEY (DEVICE_TYPE_NAME, DEVICE_IDENTIFICATION, PROPERTY_NAME, TENANT_ID)
+);
+
+CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_MAP (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
+ DEVICE_ID INTEGER DEFAULT NULL,
+ GROUP_ID INTEGER DEFAULT NULL,
+ TENANT_ID INTEGER DEFAULT 0,
+ PRIMARY KEY (ID),
+ CONSTRAINT fk_DM_DEVICE_GROUP_MAP_DM_DEVICE2 FOREIGN KEY (DEVICE_ID)
+ REFERENCES DM_DEVICE (ID) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT fk_DM_DEVICE_GROUP_MAP_DM_GROUP2 FOREIGN KEY (GROUP_ID)
+ REFERENCES DM_GROUP (ID) ON DELETE CASCADE ON UPDATE CASCADE
+);
+
+CREATE TABLE IF NOT EXISTS DM_OPERATION (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
+ TYPE VARCHAR(50) NOT NULL,
+ CREATED_TIMESTAMP TIMESTAMP NOT NULL,
+ RECEIVED_TIMESTAMP TIMESTAMP NULL,
+ OPERATION_CODE VARCHAR(1000) NOT NULL,
+ PRIMARY KEY (ID)
+);
+
+CREATE TABLE IF NOT EXISTS DM_CONFIG_OPERATION (
+ OPERATION_ID INTEGER NOT NULL,
+ OPERATION_CONFIG BLOB DEFAULT NULL,
+ ENABLED BOOLEAN NOT NULL DEFAULT FALSE,
+ PRIMARY KEY (OPERATION_ID),
+ CONSTRAINT fk_dm_operation_config FOREIGN KEY (OPERATION_ID) REFERENCES
+ DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
+);
+
+CREATE TABLE IF NOT EXISTS DM_COMMAND_OPERATION (
+ OPERATION_ID INTEGER NOT NULL,
+ ENABLED BOOLEAN NOT NULL DEFAULT FALSE,
+ PRIMARY KEY (OPERATION_ID),
+ CONSTRAINT fk_dm_operation_command FOREIGN KEY (OPERATION_ID) REFERENCES
+ DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
+);
+
+CREATE TABLE IF NOT EXISTS DM_POLICY_OPERATION (
+ OPERATION_ID INTEGER NOT NULL,
+ ENABLED INTEGER NOT NULL DEFAULT 0,
+ OPERATION_DETAILS BLOB DEFAULT NULL,
+ PRIMARY KEY (OPERATION_ID),
+ CONSTRAINT fk_dm_operation_policy FOREIGN KEY (OPERATION_ID) REFERENCES
+ DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
+);
+
+CREATE TABLE IF NOT EXISTS DM_PROFILE_OPERATION (
+ OPERATION_ID INTEGER NOT NULL,
+ ENABLED INTEGER NOT NULL DEFAULT 0,
+ OPERATION_DETAILS BLOB DEFAULT NULL,
+ PRIMARY KEY (OPERATION_ID),
+ CONSTRAINT fk_dm_operation_profile FOREIGN KEY (OPERATION_ID) REFERENCES
+ DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
+);
+
+CREATE TABLE IF NOT EXISTS DM_ENROLMENT (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
+ DEVICE_ID INTEGER NOT NULL,
+ OWNER VARCHAR(50) NOT NULL,
+ OWNERSHIP VARCHAR(45) DEFAULT NULL,
+ STATUS VARCHAR(50) NULL,
+ DATE_OF_ENROLMENT TIMESTAMP DEFAULT NULL,
+ DATE_OF_LAST_UPDATE TIMESTAMP DEFAULT NULL,
+ TENANT_ID INT NOT NULL,
+ PRIMARY KEY (ID),
+ CONSTRAINT fk_dm_device_enrolment FOREIGN KEY (DEVICE_ID) REFERENCES
+ DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ CONSTRAINT uk_dm_device_enrolment UNIQUE (DEVICE_ID, OWNER, OWNERSHIP, TENANT_ID)
+);
+
+CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OP_MAPPING (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
+ ENROLMENT_ID INTEGER NOT NULL,
+ OPERATION_ID INTEGER NOT NULL,
+ STATUS VARCHAR(50) NULL,
+ PUSH_NOTIFICATION_STATUS VARCHAR(50) NULL,
+ CREATED_TIMESTAMP INT NOT NULL,
+ UPDATED_TIMESTAMP INT NOT NULL,
+ PRIMARY KEY (ID),
+ CONSTRAINT fk_dm_device_operation_mapping_device FOREIGN KEY (ENROLMENT_ID) REFERENCES
+ DM_ENROLMENT (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ CONSTRAINT fk_dm_device_operation_mapping_operation FOREIGN KEY (OPERATION_ID) REFERENCES
+ DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
+);
+
+CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_RESPONSE (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
+ ENROLMENT_ID INTEGER NOT NULL,
+ OPERATION_ID INTEGER NOT NULL,
+ EN_OP_MAP_ID INTEGER NOT NULL,
+ OPERATION_RESPONSE LONGBLOB DEFAULT NULL,
+ RECEIVED_TIMESTAMP TIMESTAMP NULL,
+ PRIMARY KEY (ID),
+ CONSTRAINT fk_dm_device_operation_response_enrollment FOREIGN KEY (ENROLMENT_ID) REFERENCES
+ DM_ENROLMENT (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ CONSTRAINT fk_dm_device_operation_response_operation FOREIGN KEY (OPERATION_ID) REFERENCES
+ DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ CONSTRAINT fk_dm_en_op_map_response FOREIGN KEY (EN_OP_MAP_ID) REFERENCES
+ DM_ENROLMENT_OP_MAPPING (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
+);
+
+-- POLICY RELATED TABLES --
+
+CREATE TABLE IF NOT EXISTS DM_PROFILE (
+ ID INT NOT NULL AUTO_INCREMENT ,
+ PROFILE_NAME VARCHAR(45) NOT NULL ,
+ TENANT_ID INT NOT NULL ,
+ DEVICE_TYPE VARCHAR(300) NOT NULL ,
+ CREATED_TIME DATETIME NOT NULL ,
+ UPDATED_TIME DATETIME NOT NULL ,
+ PRIMARY KEY (ID)
+);
+
+CREATE TABLE IF NOT EXISTS DM_POLICY (
+ ID INT(11) NOT NULL AUTO_INCREMENT ,
+ NAME VARCHAR(45) DEFAULT NULL ,
+ DESCRIPTION VARCHAR(1000) NULL,
+ TENANT_ID INT(11) NOT NULL ,
+ PROFILE_ID INT(11) NOT NULL ,
+ OWNERSHIP_TYPE VARCHAR(45) NULL,
+ COMPLIANCE VARCHAR(100) NULL,
+ PRIORITY INT NOT NULL,
+ ACTIVE INT(2) NOT NULL,
+ UPDATED INT(1) NULL,
+ PRIMARY KEY (ID) ,
+ CONSTRAINT FK_DM_PROFILE_DM_POLICY
+ FOREIGN KEY (PROFILE_ID )
+ REFERENCES DM_PROFILE (ID )
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION
+);
+
+CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY (
+ ID INT(11) NOT NULL AUTO_INCREMENT ,
+ DEVICE_ID INT(11) NOT NULL ,
+ ENROLMENT_ID INT(11) NOT NULL,
+ DEVICE BLOB NOT NULL,
+ POLICY_ID INT(11) NOT NULL ,
+ PRIMARY KEY (ID) ,
+ CONSTRAINT FK_POLICY_DEVICE_POLICY
+ FOREIGN KEY (POLICY_ID )
+ REFERENCES DM_POLICY (ID )
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION,
+ CONSTRAINT FK_DEVICE_DEVICE_POLICY
+ FOREIGN KEY (DEVICE_ID )
+ REFERENCES DM_DEVICE (ID )
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION
+);
+
+CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
+ ID INT(11) NOT NULL ,
+ DEVICE_TYPE VARCHAR(300) NOT NULL ,
+ POLICY_ID INT(11) NOT NULL ,
+ PRIMARY KEY (ID) ,
+ CONSTRAINT FK_DEVICE_TYPE_POLICY
+ FOREIGN KEY (POLICY_ID )
+ REFERENCES DM_POLICY (ID )
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION
+);
+
+CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES (
+ ID INT(11) NOT NULL AUTO_INCREMENT,
+ PROFILE_ID INT(11) NOT NULL,
+ FEATURE_CODE VARCHAR(100) NOT NULL,
+ DEVICE_TYPE VARCHAR(300) NOT NULL,
+ TENANT_ID INT(11) NOT NULL ,
+ CONTENT BLOB NULL DEFAULT NULL,
+ PRIMARY KEY (ID),
+ CONSTRAINT FK_DM_PROFILE_DM_POLICY_FEATURES
+ FOREIGN KEY (PROFILE_ID)
+ REFERENCES DM_PROFILE (ID)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION
+);
+
+CREATE TABLE IF NOT EXISTS DM_ROLE_POLICY (
+ ID INT(11) NOT NULL AUTO_INCREMENT ,
+ ROLE_NAME VARCHAR(45) NOT NULL ,
+ POLICY_ID INT(11) NOT NULL ,
+ PRIMARY KEY (ID) ,
+ CONSTRAINT FK_ROLE_POLICY_POLICY
+ FOREIGN KEY (POLICY_ID )
+ REFERENCES DM_POLICY (ID )
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION
+);
+
+CREATE TABLE IF NOT EXISTS DM_USER_POLICY (
+ ID INT NOT NULL AUTO_INCREMENT ,
+ POLICY_ID INT NOT NULL ,
+ USERNAME VARCHAR(45) NOT NULL ,
+ PRIMARY KEY (ID) ,
+ CONSTRAINT DM_POLICY_USER_POLICY
+ FOREIGN KEY (POLICY_ID )
+ REFERENCES DM_POLICY (ID )
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION
+);
+
+CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY_APPLIED (
+ ID INT NOT NULL AUTO_INCREMENT ,
+ DEVICE_ID INT NOT NULL ,
+ ENROLMENT_ID INT(11) NOT NULL,
+ POLICY_ID INT NOT NULL ,
+ POLICY_CONTENT BLOB NULL ,
+ TENANT_ID INT NOT NULL,
+ APPLIED TINYINT(1) NULL ,
+ CREATED_TIME TIMESTAMP NULL ,
+ UPDATED_TIME TIMESTAMP NULL ,
+ APPLIED_TIME TIMESTAMP NULL ,
+ PRIMARY KEY (ID) ,
+ CONSTRAINT FK_DM_POLICY_DEVCIE_APPLIED
+ FOREIGN KEY (DEVICE_ID )
+ REFERENCES DM_DEVICE (ID )
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION
+);
+
+CREATE TABLE IF NOT EXISTS DM_CRITERIA (
+ ID INT NOT NULL AUTO_INCREMENT,
+ TENANT_ID INT NOT NULL,
+ NAME VARCHAR(50) NULL,
+ PRIMARY KEY (ID)
+);
+
+CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA (
+ ID INT NOT NULL AUTO_INCREMENT,
+ CRITERIA_ID INT NOT NULL,
+ POLICY_ID INT NOT NULL,
+ PRIMARY KEY (ID),
+ CONSTRAINT FK_CRITERIA_POLICY_CRITERIA
+ FOREIGN KEY (CRITERIA_ID)
+ REFERENCES DM_CRITERIA (ID)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION,
+ CONSTRAINT FK_POLICY_POLICY_CRITERIA
+ FOREIGN KEY (POLICY_ID)
+ REFERENCES DM_POLICY (ID)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION
+);
+
+CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA_PROPERTIES (
+ ID INT NOT NULL AUTO_INCREMENT,
+ POLICY_CRITERION_ID INT NOT NULL,
+ PROP_KEY VARCHAR(45) NULL,
+ PROP_VALUE VARCHAR(100) NULL,
+ CONTENT BLOB NULL COMMENT 'This is used to ',
+ PRIMARY KEY (ID),
+ CONSTRAINT FK_POLICY_CRITERIA_PROPERTIES
+ FOREIGN KEY (POLICY_CRITERION_ID)
+ REFERENCES DM_POLICY_CRITERIA (ID)
+ ON DELETE CASCADE
+ ON UPDATE NO ACTION
+);
+
+CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS (
+ ID INT NOT NULL AUTO_INCREMENT,
+ DEVICE_ID INT NOT NULL,
+ ENROLMENT_ID INT(11) NOT NULL,
+ POLICY_ID INT NOT NULL,
+ TENANT_ID INT NOT NULL,
+ STATUS INT NULL,
+ LAST_SUCCESS_TIME TIMESTAMP NULL,
+ LAST_REQUESTED_TIME TIMESTAMP NULL,
+ LAST_FAILED_TIME TIMESTAMP NULL,
+ ATTEMPTS INT NULL,
+ PRIMARY KEY (ID)
+);
+
+CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT (
+ ID INT NOT NULL AUTO_INCREMENT,
+ POLICY_ID INT NOT NULL,
+ DEVICE_TYPE VARCHAR(300) NOT NULL ,
+ TENANT_ID INT(11) NOT NULL,
+ PRIMARY KEY (ID)
+);
+
+CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_FEATURES (
+ ID INT NOT NULL AUTO_INCREMENT,
+ COMPLIANCE_STATUS_ID INT NOT NULL,
+ TENANT_ID INT NOT NULL,
+ FEATURE_CODE VARCHAR(100) NOT NULL,
+ STATUS INT NULL,
+ PRIMARY KEY (ID),
+ CONSTRAINT FK_COMPLIANCE_FEATURES_STATUS
+ FOREIGN KEY (COMPLIANCE_STATUS_ID)
+ REFERENCES DM_POLICY_COMPLIANCE_STATUS (ID)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION
+);
+
+CREATE TABLE IF NOT EXISTS DM_APPLICATION (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
+ NAME VARCHAR(150) NOT NULL,
+ APP_IDENTIFIER VARCHAR(150) NOT NULL,
+ PLATFORM VARCHAR(50) DEFAULT NULL,
+ CATEGORY VARCHAR(50) NULL,
+ VERSION VARCHAR(50) NULL,
+ TYPE VARCHAR(50) NULL,
+ LOCATION_URL VARCHAR(100) DEFAULT NULL,
+ IMAGE_URL VARCHAR(100) DEFAULT NULL,
+ APP_PROPERTIES BLOB NULL,
+ MEMORY_USAGE INTEGER(10) NULL,
+ IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE,
+ TENANT_ID INTEGER NOT NULL,
+ PRIMARY KEY (ID)
+);
+
+CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
+ DEVICE_ID INTEGER NOT NULL,
+ APPLICATION_ID INTEGER NOT NULL,
+ TENANT_ID INTEGER NOT NULL,
+ PRIMARY KEY (ID),
+ CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES
+ DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ CONSTRAINT fk_dm_application FOREIGN KEY (APPLICATION_ID) REFERENCES
+ DM_APPLICATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
+);
+
+-- POLICY RELATED TABLES FINISHED --
+
+-- NOTIFICATION TABLE --
+CREATE TABLE IF NOT EXISTS DM_NOTIFICATION (
+ NOTIFICATION_ID INTEGER AUTO_INCREMENT NOT NULL,
+ DEVICE_ID INTEGER NOT NULL,
+ OPERATION_ID INTEGER NOT NULL,
+ TENANT_ID INTEGER NOT NULL,
+ STATUS VARCHAR(10) NULL,
+ DESCRIPTION VARCHAR(1000) NULL,
+ PRIMARY KEY (NOTIFICATION_ID),
+ CONSTRAINT fk_dm_device_notification FOREIGN KEY (DEVICE_ID) REFERENCES
+ DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ CONSTRAINT fk_dm_operation_notification FOREIGN KEY (OPERATION_ID) REFERENCES
+ DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
+);
+-- NOTIFICATION TABLE END --
+
+CREATE TABLE IF NOT EXISTS DM_DEVICE_INFO (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
+ DEVICE_ID INT NULL,
+ KEY_FIELD VARCHAR(45) NULL,
+ VALUE_FIELD VARCHAR(100) NULL,
+ PRIMARY KEY (ID),
+ CONSTRAINT DM_DEVICE_INFO_DEVICE
+ FOREIGN KEY (DEVICE_ID)
+ REFERENCES DM_DEVICE (ID)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION
+);
+
+CREATE TABLE IF NOT EXISTS DM_DEVICE_LOCATION (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
+ DEVICE_ID INT NULL,
+ LATITUDE DOUBLE NULL,
+ LONGITUDE DOUBLE NULL,
+ STREET1 VARCHAR(255) NULL,
+ STREET2 VARCHAR(45) NULL,
+ CITY VARCHAR(45) NULL,
+ ZIP VARCHAR(10) NULL,
+ STATE VARCHAR(45) NULL,
+ COUNTRY VARCHAR(45) NULL,
+ UPDATE_TIMESTAMP BIGINT(15) NOT NULL,
+ PRIMARY KEY (ID),
+ CONSTRAINT DM_DEVICE_LOCATION_DEVICE
+ FOREIGN KEY (DEVICE_ID)
+ REFERENCES DM_DEVICE (ID)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION
+);
+
+CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL (
+ ID INT NOT NULL AUTO_INCREMENT,
+ DEVICE_ID INT NOT NULL,
+ DEVICE_MODEL VARCHAR(45) NULL,
+ VENDOR VARCHAR(45) NULL,
+ OS_VERSION VARCHAR(45) NULL,
+ OS_BUILD_DATE VARCHAR(100) NULL,
+ BATTERY_LEVEL DECIMAL(4) NULL,
+ INTERNAL_TOTAL_MEMORY DECIMAL(30,3) NULL,
+ INTERNAL_AVAILABLE_MEMORY DECIMAL(30,3) NULL,
+ EXTERNAL_TOTAL_MEMORY DECIMAL(30,3) NULL,
+ EXTERNAL_AVAILABLE_MEMORY DECIMAL(30,3) NULL,
+ CONNECTION_TYPE VARCHAR(50) NULL,
+ SSID VARCHAR(45) NULL,
+ CPU_USAGE DECIMAL(5) NULL,
+ TOTAL_RAM_MEMORY DECIMAL(30,3) NULL,
+ AVAILABLE_RAM_MEMORY DECIMAL(30,3) NULL,
+ PLUGGED_IN INT(1) NULL,
+ UPDATE_TIMESTAMP BIGINT(15) NOT NULL,
+ PRIMARY KEY (ID),
+ CONSTRAINT FK_DM_DEVICE_DETAILS_DEVICE
+ FOREIGN KEY (DEVICE_ID)
+ REFERENCES DM_DEVICE (ID)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION
+);
+
+-- POLICY AND DEVICE GROUP MAPPING --
+CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_POLICY (
+ ID INT NOT NULL AUTO_INCREMENT,
+ DEVICE_GROUP_ID INT NOT NULL,
+ POLICY_ID INT NOT NULL,
+ TENANT_ID INT NOT NULL,
+ PRIMARY KEY (ID),
+ CONSTRAINT FK_DM_DEVICE_GROUP_POLICY
+ FOREIGN KEY (DEVICE_GROUP_ID)
+ REFERENCES DM_GROUP (ID)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE ,
+ CONSTRAINT FK_DM_DEVICE_GROUP_DM_POLICY
+ FOREIGN KEY (POLICY_ID)
+ REFERENCES DM_POLICY (ID)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE
+);
+-- END OF POLICY AND DEVICE GROUP MAPPING --
+
+-- DASHBOARD RELATED VIEWS --
+CREATE VIEW POLICY_COMPLIANCE_INFO AS
+SELECT
+DEVICE_INFO.DEVICE_ID,
+DEVICE_INFO.DEVICE_IDENTIFICATION,
+DEVICE_INFO.PLATFORM,
+DEVICE_INFO.OWNERSHIP,
+DEVICE_INFO.CONNECTIVITY_STATUS,
+IFNULL(DEVICE_WITH_POLICY_INFO.POLICY_ID, -1) AS POLICY_ID,
+IFNULL(DEVICE_WITH_POLICY_INFO.IS_COMPLIANT, -1) AS IS_COMPLIANT,
+DEVICE_INFO.TENANT_ID
+FROM
+(SELECT
+DM_DEVICE.ID AS DEVICE_ID,
+DM_DEVICE.DEVICE_IDENTIFICATION,
+DM_DEVICE_TYPE.NAME AS PLATFORM,
+DM_ENROLMENT.OWNERSHIP,
+DM_ENROLMENT.STATUS AS CONNECTIVITY_STATUS,
+DM_DEVICE.TENANT_ID
+FROM DM_DEVICE, DM_DEVICE_TYPE, DM_ENROLMENT
+WHERE DM_DEVICE.DEVICE_TYPE_ID = DM_DEVICE_TYPE.ID AND DM_DEVICE.ID = DM_ENROLMENT.DEVICE_ID) DEVICE_INFO
+LEFT JOIN
+(SELECT
+DEVICE_ID,
+POLICY_ID,
+STATUS AS IS_COMPLIANT
+FROM DM_POLICY_COMPLIANCE_STATUS) DEVICE_WITH_POLICY_INFO
+ON DEVICE_INFO.DEVICE_ID = DEVICE_WITH_POLICY_INFO.DEVICE_ID
+ORDER BY DEVICE_INFO.DEVICE_ID;
+
+CREATE VIEW FEATURE_NON_COMPLIANCE_INFO AS
+SELECT
+DM_DEVICE.ID AS DEVICE_ID,
+DM_DEVICE.DEVICE_IDENTIFICATION,
+DM_DEVICE_DETAIL.DEVICE_MODEL,
+DM_DEVICE_DETAIL.VENDOR,
+DM_DEVICE_DETAIL.OS_VERSION,
+DM_ENROLMENT.OWNERSHIP,
+DM_ENROLMENT.OWNER,
+DM_ENROLMENT.STATUS AS CONNECTIVITY_STATUS,
+DM_POLICY_COMPLIANCE_STATUS.POLICY_ID,
+DM_DEVICE_TYPE.NAME AS PLATFORM,
+DM_POLICY_COMPLIANCE_FEATURES.FEATURE_CODE,
+DM_POLICY_COMPLIANCE_FEATURES.STATUS AS IS_COMPLAINT,
+DM_DEVICE.TENANT_ID
+FROM
+DM_POLICY_COMPLIANCE_FEATURES, DM_POLICY_COMPLIANCE_STATUS, DM_ENROLMENT, DM_DEVICE, DM_DEVICE_TYPE, DM_DEVICE_DETAIL
+WHERE
+DM_POLICY_COMPLIANCE_FEATURES.COMPLIANCE_STATUS_ID = DM_POLICY_COMPLIANCE_STATUS.ID AND
+DM_POLICY_COMPLIANCE_STATUS.ENROLMENT_ID = DM_ENROLMENT.ID AND
+DM_POLICY_COMPLIANCE_STATUS.DEVICE_ID = DM_DEVICE.ID AND
+DM_DEVICE.DEVICE_TYPE_ID = DM_DEVICE_TYPE.ID AND
+DM_DEVICE.ID = DM_DEVICE_DETAIL.DEVICE_ID
+ORDER BY TENANT_ID, DEVICE_ID;
+
+-- END OF DASHBOARD RELATED VIEWS --
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/testng.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/testng.xml
new file mode 100644
index 0000000000..f37097fda1
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/testng.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/user-test/user-mgt-registry-test.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/user-test/user-mgt-registry-test.xml
new file mode 100644
index 0000000000..bac4fc7667
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/user-test/user-mgt-registry-test.xml
@@ -0,0 +1,80 @@
+
+
+
+
+ true
+ admin
+
+ admin
+ admin
+
+ everyone
+ false
+ 500
+ jdbc:h2:target/databasetest/CARBON_TEST
+ org.h2.Driver
+ 50
+ 60000
+ 5
+
+
+ org.wso2.carbon.user.core.tenant.JDBCTenantManager
+ false
+ 100
+ false
+ default
+ SHA-256
+ true
+ true
+ true
+ false
+ ^[\S]{5,30}$
+ Password length should be between 5 to 30 characters
+
+ ^[\S]{5,30}$
+ [a-zA-Z0-9._-|//]{3,30}$
+ ^[\S]{3,30}$
+ ^[^~!#$;%^*+={}\\|\\\\<>,\'\"]{3,30}$
+ ^[\S]{3,30}$
+ true
+ 100
+ 100
+ false
+ false
+ true
+ ,
+ true
+
+
+ true
+
+
+
+ login
+ manage-configuration
+ manage-security
+ upload-services
+ manage-services
+ manage-lc-configuration
+ manage-mediation
+ monitor-system
+ delegate-identity
+
+
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml
index 9e1a5d6c5f..3db5ca31fd 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml
@@ -22,7 +22,7 @@
device-mgt
org.wso2.carbon.devicemgt
- 3.0.93-SNAPSHOT
+ 3.0.129-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json
index b8bfd32dda..8c132ecbde 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json
@@ -47,7 +47,7 @@
},
"groupValidationConfig": {
"groupNameJSRegEx": "^[\\S]{3,30}$",
- "groupNameRegExViolationErrorMsg": "Provided group name is invalid.",
+ "groupNameRegExViolationErrorMsg": "Group name should be in minimum 3 characters long and should not include any whitespaces.",
"groupNameHelpMsg": "Should be in minimum 3 characters long and should not include any whitespaces."
},
"roleValidationConfig": {
@@ -67,6 +67,7 @@
"scopes": [
"perm:sign-csr",
"perm:admin:devices:view",
+ "perm:admin:topics:view",
"perm:roles:add",
"perm:roles:add-users",
"perm:roles:update",
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js
index 8e743fe325..c83585e96b 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js
@@ -63,7 +63,7 @@ deviceModule = function () {
/*
@Updated
*/
- publicMethods.viewDevice = function (deviceType, deviceId) {
+ publicMethods.viewDevice = function (deviceType, deviceId, owner) {
var carbonUser = session.get(constants["USER_SESSION_KEY"]);
if (!carbonUser) {
log.error("User object was not found in the session");
@@ -113,6 +113,9 @@ deviceModule = function () {
try {
utility.startTenantFlow(carbonUser);
var url = devicemgtProps["httpsURL"] + "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId;
+ if (owner) {
+ url = url + "?owner=" + owner;
+ }
return serviceInvokers.XMLHttp.get(
url,
function (backendResponse) {
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/user.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/user.js
index 24e7cc696d..40a3e7058e 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/user.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/user.js
@@ -614,6 +614,9 @@ var userModule = function () {
if (publicMethods.isAuthorized("/permission/admin/device-mgt")) {
permissions["IS_ADMIN"] = true;
}
+ if (publicMethods.isAuthorized("/permission/admin/device-mgt/topics/view")) {
+ permissions["VIEW_TOPICS"] = true;
+ }
return permissions;
};
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js
index f81645c457..26f3ea8ec6 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js
@@ -413,7 +413,8 @@ function loadDevices(searchType, searchParam) {
$(row).attr('data-deviceid', htmlspecialchars(data.deviceIdentifier));
$(row).attr('data-devicetype', htmlspecialchars(data.deviceType));
- $(row).attr('data-url', context + '/device/' + htmlspecialchars(data.deviceType) + '?id=' + htmlspecialchars(data.deviceIdentifier));
+ $(row).attr('data-url', context + '/device/' + htmlspecialchars(data.deviceType) + '?id='
+ + htmlspecialchars(data.deviceIdentifier) + '&owner=' + htmlspecialchars(data.userPattern)) ;
var model = htmlspecialchars(getPropertyValue(data.properties, 'DEVICE_MODEL'));
var vendor = htmlspecialchars(getPropertyValue(data.properties, 'VENDOR'));
var owner = htmlspecialchars(data.userPattern);
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.hbs
index 77ec4d34a6..0e4a7840e8 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.hbs
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.hbs
@@ -237,10 +237,12 @@
data-search="{{status}}"
data-display="{{status}}">
-
+ |
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/public/js/policy-list.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/public/js/policy-list.js
index 0d94332844..64be08e91b 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/public/js/policy-list.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/public/js/policy-list.js
@@ -385,4 +385,7 @@ $(document).ready(function () {
$("#policy-listing-status").removeClass("hidden");
}
$("#policy-grid").removeClass("hidden");
+
+ $('[data-toggle="tooltip"]').tooltip();
+
});
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.hbs
index ad8f81f82a..49c4d14be1 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.hbs
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.hbs
@@ -37,6 +37,14 @@
{{/zone}}
+{{#zone "navbarActions"}}
+ {{#if canEdit}}
+
+
+
+ {{/if}}
+{{/zone}}
+
{{#zone "content"}}
{{unit "cdmf.unit.device.operation-mod"}}
{{unit "cdmf.unit.policy.view"}}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.js
index 07e42077e6..0032639ca3 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.js
@@ -17,7 +17,14 @@
*/
function onRequest(context) {
+ var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var utility = require("/app/modules/utility.js")["utility"];
var deviceType = request.getParameter("type");
- return {"deviceTypePolicyView": utility.getTenantedDeviceUnitName(deviceType, "policy-view")};
+
+ var canEdit = false;
+ if(userModule.isAuthorized("/permission/admin/device-mgt/policy/manage")) {
+ canEdit = true;
+ }
+
+ return {"deviceTypePolicyView": utility.getTenantedDeviceUnitName(deviceType, "policy-view"), "canEdit": canEdit};
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js
index c1acb8e9f2..fa2eaffb6e 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js
@@ -150,6 +150,8 @@ function loadRoles() {
var innerhtml = '';
+ var isAdminRole = $("#role-table").data("role") === data.name;
+
var editLink = 'Remove' +
'';
- if (!isCloud) {
+ if (!isCloud && !isAdminRole) {
innerhtml = editLink + editPermissionLink + removeLink;
}
return innerhtml;
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/public/js/topic-listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/public/js/topic-listing.js
new file mode 100644
index 0000000000..973d91b20a
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/public/js/topic-listing.js
@@ -0,0 +1,283 @@
+/*
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. licenses this file to you 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.
+ */
+
+/**
+ * Following function would execute
+ * when a user clicks on the list item
+ * initial mode and with out select mode.
+ */
+function InitiateViewOption(url) {
+ if (!$(".select-enable-btn").text() == "Select" && !$(this).hasClass("btn")) {
+ url = $(this).parent().data("url");
+ $(location).attr('href', url);
+ }
+}
+
+/*
+ * DOM ready functions.
+ */
+$(document).ready(function () {
+
+ var permissionSet = {};
+ $.setPermission = function (permission) {
+ permissionSet[permission] = true;
+ };
+
+ $.hasPermission = function (permission) {
+ return permissionSet[permission];
+ };
+
+ name = getParameterByName("name");
+
+ /* for device list sorting drop down */
+ $(".ctrl-filter-type-switcher").popover({
+ html: true,
+ content: function () {
+ return $("#content-filter-types").html();
+ }
+ });
+});
+
+function loadTopics(searchType, searchParam) {
+
+ var serviceURL;
+ if ($.hasPermission("VIEW_TOPICS")) {
+ serviceURL = "/api/mqtt-topics/v1.0/admin/topics";
+ } else {
+ $("#loading-content").remove();
+ $('#topics-table').addClass('hidden');
+ $('#topics-listing-status-msg').text('Permission denied.');
+ $("#topics-listing-status").removeClass(' hidden');
+ return;
+ }
+
+ var columns = [
+ {
+ targets: 0,
+ data: 'localSubscribedQueueOrTopicName',
+ class: 'remove-padding-top viewEnabledIcon',
+ render: function (data, type, row, meta) {
+ return '';
+ }
+ },
+ {
+ targets: 1,
+ data: 'localSubscribedQueueOrTopicName',
+ class: 'remove-padding-top viewEnabledIcon',
+ },
+ {
+ targets: 2,
+ data: 'localNumberOfMessagesRemainingForSubscriber',
+ class: 'remove-padding-top viewEnabledIcon',
+ },
+ {
+ targets: 3,
+ data: 'localActive',
+ class: 'remove-padding-top viewEnabledIcon',
+ },
+ {
+ targets: 4,
+ data: 'localDurable',
+ class: 'remove-padding-top viewEnabledIcon',
+ },
+ {
+ targets: 5,
+ data: 'localSubscriberQueueName',
+ class: 'remove-padding-top viewEnabledIcon',
+ },
+ {
+ targets: 6,
+ data: 'localSubscriptionIdentifier',
+ class: 'remove-padding-top viewEnabledIcon',
+ }
+ ];
+
+ var fnCreatedRow = function (row, data, dataIndex) {
+ $(row).attr('data-type', 'selectable');
+ $(row).attr('localSubscribedQueueOrTopicName', htmlspecialchars(data.localSubscribedQueueOrTopicName));
+ $(row).attr('localNumberOfMessagesRemainingForSubscriber', htmlspecialchars(data.localNumberOfMessagesRemainingForSubscriber));
+ $(row).attr('data-url', context + '/device/' + htmlspecialchars(data.localSubscribedQueueOrTopicName) + '?id=' + htmlspecialchars(data.localNumberOfMessagesRemainingForSubscriber));
+
+ var topicName = htmlspecialchars(data.localSubscribedQueueOrTopicName);
+ var remainingMesgCount = htmlspecialchars(data.localNumberOfMessagesRemainingForSubscriber);
+ var isActive = htmlspecialchars(data.localActive);
+ var isDurable = htmlspecialchars(data.localDurable);
+ var localSubscriberQueueName = htmlspecialchars(data.localSubscriberQueueName);
+ var subscriptionIdentifier = htmlspecialchars(data.localSubscriptionIdentifier);
+ $.each($('td', row), function (colIndex) {
+ switch (colIndex) {
+ case 1:
+ $(this).attr('data-grid-label', "Topic Name");
+ $(this).attr('data-search', topicName);
+ $(this).attr('data-display', topicName);
+ break;
+ case 2:
+ $(this).attr('data-grid-label', "Remaining Messages");
+ $(this).attr('data-search', remainingMesgCount);
+ $(this).attr('data-display', remainingMesgCount);
+ break;
+ case 3:
+ $(this).attr('data-grid-label', "Active");
+ $(this).attr('data-search', isActive);
+ $(this).attr('data-display', isActive);
+ break;
+ case 4:
+ $(this).attr('data-grid-label', "Durable");
+ $(this).attr('data-search', isDurable);
+ $(this).attr('data-display', isDurable);
+ break;
+ case 5:
+ $(this).attr('data-grid-label', "Subscriber Queue Name");
+ $(this).attr('data-search', localSubscriberQueueName);
+ $(this).attr('data-display', localSubscriberQueueName);
+ break;
+ case 6:
+ $(this).attr('data-grid-label', "SubscriptionIdentifier");
+ $(this).attr('data-search', subscriptionIdentifier);
+ $(this).attr('data-display', subscriptionIdentifier);
+ break;
+ }
+ });
+ };
+
+ function htmlspecialchars(text) {
+ return jQuery('').text(text).html();
+ }
+
+ var dataFilter = function (data) {
+ data = JSON.parse(data);
+ var objects = [];
+ $(data.subscriptions).each(function (index) {
+ objects.push(
+ {
+ localSubscribedQueueOrTopicName: data.subscriptions[index].localSubscribedQueueOrTopicName,
+ localNumberOfMessagesRemainingForSubscriber: data.subscriptions[index].localNumberOfMessagesRemainingForSubscriber,
+ localActive: data.subscriptions[index].localActive,
+ localDurable: data.subscriptions[index].localDurable,
+ localSubscriberQueueName: data.subscriptions[index].localSubscriberQueueName,
+ localSubscriptionIdentifier: data.subscriptions[index].localSubscriptionIdentifier,
+ name: data.subscriptions[index].localSubscribedQueueOrTopicName
+ }
+ );
+ });
+
+ var json = {
+ "recordsTotal": data.count,
+ "recordsFiltered": data.count,
+ "data": objects
+ };
+
+ return JSON.stringify(json);
+ };
+
+ $('#topics-grid').datatables_extended_serverside_paging(
+ null,
+ serviceURL,
+ dataFilter,
+ columns,
+ fnCreatedRow,
+ function () {
+ $(".icon .text").res_text(0.2);
+ $('#topics-grid').removeClass('hidden');
+ $("#loading-content").remove();
+ }, {
+ "placeholder": "Search By Topic Name",
+ "searchKey": "name"
+ }
+ );
+}
+
+/*
+ * DOM ready functions.
+ */
+$(document).ready(function () {
+ /* Adding selected class for selected devices */
+ var permissionList = $("#permission").data("permission");
+ for (var key in permissionList) {
+ if (permissionList.hasOwnProperty(key)) {
+ $.setPermission(key);
+ }
+ }
+ loadTopics();
+ $(".dataTables_toolbar").css("display", "none");
+
+ /* for topic list sorting drop down */
+ $(".ctrl-filter-type-switcher").popover({
+ html: true,
+ content: function () {
+ return $("#content-filter-types").html();
+ }
+ });
+
+ /* for data tables*/
+ $('[data-toggle="tooltip"]').tooltip();
+
+ $("[data-toggle=popover]").popover();
+
+ $(".ctrl-filter-type-switcher").popover({
+ html: true,
+ content: function () {
+ return $('#content-filter-types').html();
+ }
+ });
+
+ $('#nav').affix({
+ offset: {
+ top: $('header').height()
+ }
+ });
+
+});
+
+var modalPopup = ".modal";
+var modalPopupContainer = modalPopup + " .modal-content";
+var modalPopupContent = modalPopup + " .modal-content";
+var body = "body";
+
+/*
+ * set popup maximum height function.
+ */
+function setPopupMaxHeight() {
+ $(modalPopupContent).css('max-height', ($(body).height() - ($(body).height() / 100 * 30)));
+ $(modalPopupContainer).css('margin-top', (-($(modalPopupContainer).height() / 2)));
+}
+
+/*
+ * show popup function.
+ */
+function showPopup() {
+ $(modalPopup).modal('show');
+}
+
+/*
+ * hide popup function.
+ */
+function hidePopup() {
+ $(modalPopupContent).html("");
+ $(modalPopupContent).removeClass("operation-data");
+ $(modalPopup).modal('hide');
+ $('body').removeClass('modal-open').css('padding-right', '0px');
+ $('.modal-backdrop').remove();
+}
+
+function getParameterByName(name) {
+ name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
+ var regex = new RegExp("[\\?&]" + name + "=([^]*)"),
+ results = regex.exec(location.search);
+ return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
+}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/topic.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/topic.hbs
new file mode 100644
index 0000000000..e34956912d
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/topic.hbs
@@ -0,0 +1,131 @@
+{{!
+ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+
+ WSO2 Inc. licenses this file to you 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.
+}}`
+{{unit "cdmf.unit.ui.title" pageTitle="MQTT Dashboard"}}
+
+{{unit "cdmf.unit.data-tables-extended"}}
+{{unit "cdmf.unit.lib.ui-permissions-utility"}}
+
+{{#zone "breadcrumbs"}}
+
+
+
+
+
+
+
+
+ Dashboard
+
+
+
+
+ MQTT
+
+
+{{/zone}}
+
+
+{{#zone "content"}}
+
+
+
+
+
+
+
+ Loading subscriptions . . .
+
+
+
+
+
+
+
+ |
+ By TopicName |
+ By RemainingMsgCount |
+ By Active |
+ By Durable |
+ By SubscriberQueueName |
+ By SubscriptionIdentifier |
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{{/zone}}
+
+{{#zone "bottomJs"}}
+
+ {{js "js/topic-listing.js"}}
+{{/zone}}
+
+{{#zone "topCss"}}
+
+{{/zone}}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/topic.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/topic.js
new file mode 100644
index 0000000000..13cd619d8a
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/topic.js
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. licenses this file to you 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.
+ */
+
+function onRequest(context) {
+ var constants = require("/app/modules/constants.js");
+ var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
+ var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
+ var groupModule = require("/app/modules/business-controllers/group.js")["groupModule"];
+
+ var groupId = request.getParameter("groupId");
+
+ var viewModel = {};
+ var title = "Topics";
+ viewModel.title = title;
+ var currentUser = session.get(constants.USER_SESSION_KEY);
+ if (currentUser) {
+ viewModel.permissions = {};
+ var uiPermissions = userModule.getUIPermissions();
+ viewModel.permissions.list = stringify(uiPermissions);
+ if (uiPermissions.VIEW_TOPICS) {
+ viewModel.permissions.enroll = true;
+ }
+ viewModel.currentUser = currentUser;
+ var deviceCount = 1;
+ viewModel.deviceCount = deviceCount;
+ var utility = require("/app/modules/utility.js").utility;
+ }
+ return viewModel;
+}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/topic.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/topic.json
new file mode 100644
index 0000000000..a7f2976443
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.topic/topic.json
@@ -0,0 +1,5 @@
+{
+ "version": "1.0.0",
+ "uri": "/topics",
+ "layout": "cdmf.layout.default"
+}
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.hbs
index 183e124bfa..6dc712ad2c 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.hbs
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.hbs
@@ -131,6 +131,11 @@
An invitation mail will be sent to this user to initiate device enrollment.
+
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/public/js/bottomJs.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/public/js/bottomJs.js
index 28d4af3fdb..d2b4d2842e 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/public/js/bottomJs.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/public/js/bottomJs.js
@@ -256,6 +256,9 @@ $(document).ready(function () {
} else if (!emailIsValid(emailAddress)) {
$(errorMsg).text("Provided email is invalid.");
$(errorMsgWrapper).removeClass("hidden");
+ } else if (!roles) {
+ $(errorMsg).text("Role is a required field. It cannot be empty.");
+ $(errorMsgWrapper).removeClass("hidden");
} else {
var addUserFormData = {};
@@ -272,6 +275,7 @@ $(document).ready(function () {
addUserFormData,
function (data, textStatus, jqXHR) {
if (jqXHR.status == 201) {
+ var response = JSON.parse(data);
// Clearing user input fields.
$("input#username").val("");
$("input#firstname").val("");
@@ -284,7 +288,12 @@ $(document).ready(function () {
$("#user-create-form").addClass("hidden");
modalDialog.header('' +
' User was added successfully');
- modalDialog.content($("#modal-content-user-created").html());
+ if (response.message) {
+ $("#modal-content-user-created-with-message").append("" + response.message + "");
+ modalDialog.content($("#modal-content-user-created-with-message").html());
+ } else {
+ modalDialog.content($("#modal-content-user-created").html());
+ }
modalDialog.footer('');
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.hbs
index dd86421cc7..aec56d47c9 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.hbs
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.hbs
@@ -35,6 +35,21 @@
{{/zone}}
+{{#zone "navbarActions"}}
+ {{#if canEdit}}
+
+
+
+
+
+
+ Edit
+
+
+ {{/if}}
+{{/zone}}
+
{{#zone "content"}}
{{#if canView}}
{{#if exists}}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.js
index 0be5dd28df..f16ea8db7c 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.js
@@ -18,8 +18,6 @@
function onRequest(context) {
var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
- var username = request.getParameter("username");
- var user = userModule.getUser(username)["content"];
var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var isExsistingUser = false;
var userName = request.getParameter("username");
@@ -48,7 +46,14 @@ function onRequest(context) {
canView = true;
}
+ var canEdit = false;
+ if (userModule.isAuthorized("/permission/admin/device-mgt/users/edit") &&
+ userName !== deviceMgtProps['adminUser'].split("@")[0]) {
+ canEdit = true;
+ }
+
var isCloud = deviceMgtProps.isCloud;
- return {"exists": isExsistingUser, "user": user, "userRoles": userRoles, "devices": devices, "canView": canView, "isCloud" : isCloud};
+ return {"exists": isExsistingUser, "user": user, "userRoles": userRoles, "devices": devices, "canEdit": canEdit,
+ "canView": canView, "isCloud" : isCloud};
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js
index bafbd11a41..ae15c3aea9 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js
@@ -294,7 +294,10 @@ function loadUsers() {
//noinspection JSUnusedLocalSymbols
var fnCreatedRow = function (nRow, aData, iDataIndex) {
- $(nRow).attr('data-type', 'selectable');
+ var adminUser = $("#user-table").data("user");
+ if (adminUser !== aData["filter"]) {
+ $(nRow).attr('data-type', 'selectable');
+ }
$(nRow).attr('data-username', aData["filter"]);
};
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.js
index 4b7f9c01bc..d75a753c1f 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.js
@@ -42,7 +42,5 @@ function onRequest(context) {
if (userModule.isAuthorized("/permission/admin/device-mgt/users/view")) {
page.canView = true;
}
-
-
return page;
}
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.device-view/device-view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.device-view/device-view.js
index 445106e6d0..cf716ef35c 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.device-view/device-view.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.device-view/device-view.js
@@ -23,6 +23,7 @@ function onRequest(context) {
var log = new Log("device-view.js");
var deviceType = context.uriParams.deviceType;
var deviceId = request.getParameter("id");
+ var owner = request.getParameter("owner");
var attributes = [];
var featureList = [];
var user = userModule.getCarbonUser();
@@ -131,7 +132,7 @@ function onRequest(context) {
if (deviceType != null && deviceType != undefined && deviceId != null && deviceId != undefined) {
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
- var device = deviceModule.viewDevice(deviceType, deviceId);
+ var device = deviceModule.viewDevice(deviceType, deviceId, owner);
if (device && device.status != "error") {
displayData.device = device.content;
displayData.autoCompleteParams = autoCompleteParams;
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/public/js/device-view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/public/js/device-view.js
index c1531a6d06..a7f393bc6a 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/public/js/device-view.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/public/js/device-view.js
@@ -137,6 +137,7 @@ function loadOperationsLog(update) {
var deviceType = $('.device-id').data('type');
var uri = "/api/device-mgt/v1.0/activities/" + rowData.activityId + "/" + deviceType + "/" + deviceid;
var contentType = "application/json";
+ var index = row[0][0];
if (row.child.isShown()) {
row.child.hide();
@@ -145,6 +146,13 @@ function loadOperationsLog(update) {
tr.removeClass('shown');
} else {
invokerUtil.get(uri,(payload) => {
+ //update the parent status
+ var payloadObject = JSON.parse(payload);
+ if ( payloadObject["activityStatus"][0]["status"] != rowData["status"] ) {
+ rowData["status"] = payloadObject["activityStatus"][0]["status"];
+ $('#operation-log').dataTable().fnUpdate(rowData,index,undefined,false);
+ }
+
row.child(renderLogDetails(row.data(),payload)).show();
tr.find('i.fw-down').removeClass('fw-down').addClass('fw-up');
$(row.child()).addClass('log-data-row');
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/view.js
index 60c8e50f2e..af0baeaeac 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/view.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/view.js
@@ -20,10 +20,11 @@ function onRequest(context) {
var log = new Log("cdmf.unit.device.view/view.js");
var deviceType = context["uriParams"]["deviceType"];
var deviceId = request.getParameter("id");
+ var owner = request.getParameter("owner");
var deviceViewData = {};
if (deviceType && deviceId) {
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
- var response = deviceModule.viewDevice(deviceType, deviceId);
+ var response = deviceModule.viewDevice(deviceType, deviceId, owner);
if (response["status"] == "success") {
deviceViewData["deviceFound"] = true;
deviceViewData["isAuthorized"] = true;
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/assets/html_templates/modal/speed_alert.html b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/assets/html_templates/modal/speed_alert.html
index c8145f5f53..308f036c9a 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/assets/html_templates/modal/speed_alert.html
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/assets/html_templates/modal/speed_alert.html
@@ -34,7 +34,7 @@
|