64 changed files with 1247 additions and 115 deletions
@ -1 +0,0 @@ |
|||||
-Xmx4096m -Xms1024m |
|
||||
@ -0,0 +1,36 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller; |
||||
|
|
||||
|
import org.junit.ClassRule; |
||||
|
import org.junit.extensions.cpsuite.ClasspathSuite; |
||||
|
import org.junit.runner.RunWith; |
||||
|
import org.thingsboard.server.dao.CustomSqlUnit; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
|
||||
|
@RunWith(ClasspathSuite.class) |
||||
|
@ClasspathSuite.ClassnameFilters({ |
||||
|
"org.thingsboard.server.controller.sql.*SqlTest", |
||||
|
}) |
||||
|
public class ControllerSqlTestSuite { |
||||
|
|
||||
|
@ClassRule |
||||
|
public static CustomSqlUnit sqlUnit = new CustomSqlUnit( |
||||
|
Arrays.asList("sql/schema.sql", "sql/system-data.sql"), |
||||
|
"sql/drop-all-tables.sql", |
||||
|
"sql-test.properties"); |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller.nosql; |
||||
|
|
||||
|
import org.thingsboard.server.controller.BaseAdminControllerTest; |
||||
|
import org.thingsboard.server.dao.service.DaoNoSqlTest; |
||||
|
|
||||
|
/** |
||||
|
* Created by Valerii Sosliuk on 6/28/2017. |
||||
|
*/ |
||||
|
@DaoNoSqlTest |
||||
|
public class AdminControllerNoSqlTest extends BaseAdminControllerTest { |
||||
|
} |
||||
@ -0,0 +1,27 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller.nosql; |
||||
|
|
||||
|
import org.thingsboard.server.controller.BaseAssetControllerTest; |
||||
|
import org.thingsboard.server.dao.service.DaoNoSqlTest; |
||||
|
import org.thingsboard.server.dao.util.NoSqlDao; |
||||
|
|
||||
|
/** |
||||
|
* Created by Valerii Sosliuk on 6/28/2017. |
||||
|
*/ |
||||
|
@DaoNoSqlTest |
||||
|
public class AssetControllerNoSqlTest extends BaseAssetControllerTest { |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller.nosql; |
||||
|
|
||||
|
import org.thingsboard.server.controller.BaseAuthControllerTest; |
||||
|
import org.thingsboard.server.dao.service.DaoNoSqlTest; |
||||
|
|
||||
|
/** |
||||
|
* Created by Valerii Sosliuk on 6/28/2017. |
||||
|
*/ |
||||
|
@DaoNoSqlTest |
||||
|
public class AuthControllerNoSqlTest extends BaseAuthControllerTest { |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller.nosql; |
||||
|
|
||||
|
import org.thingsboard.server.controller.BaseComponentDescriptorControllerTest; |
||||
|
import org.thingsboard.server.dao.service.DaoNoSqlTest; |
||||
|
|
||||
|
/** |
||||
|
* Created by Valerii Sosliuk on 6/28/2017. |
||||
|
*/ |
||||
|
@DaoNoSqlTest |
||||
|
public class ComponentDescriptorControllerNoSqlTest extends BaseComponentDescriptorControllerTest { |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller.nosql; |
||||
|
|
||||
|
import org.thingsboard.server.controller.BaseCustomerControllerTest; |
||||
|
import org.thingsboard.server.dao.service.DaoNoSqlTest; |
||||
|
|
||||
|
/** |
||||
|
* Created by Valerii Sosliuk on 6/28/2017. |
||||
|
*/ |
||||
|
@DaoNoSqlTest |
||||
|
public class CustomerControllerNoSqlTest extends BaseCustomerControllerTest { |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller.nosql; |
||||
|
|
||||
|
import org.thingsboard.server.controller.BaseDashboardControllerTest; |
||||
|
import org.thingsboard.server.dao.service.DaoNoSqlTest; |
||||
|
|
||||
|
/** |
||||
|
* Created by Valerii Sosliuk on 6/28/2017. |
||||
|
*/ |
||||
|
@DaoNoSqlTest |
||||
|
public class DashboardControllerNoSqlTest extends BaseDashboardControllerTest { |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller.nosql; |
||||
|
|
||||
|
import org.thingsboard.server.controller.BaseDeviceControllerTest; |
||||
|
import org.thingsboard.server.dao.service.DaoNoSqlTest; |
||||
|
|
||||
|
/** |
||||
|
* Created by Valerii Sosliuk on 6/28/2017. |
||||
|
*/ |
||||
|
@DaoNoSqlTest |
||||
|
public class DeviceControllerNoSqlTest extends BaseDeviceControllerTest { |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller.nosql; |
||||
|
|
||||
|
import org.thingsboard.server.controller.BasePluginControllerTest; |
||||
|
import org.thingsboard.server.dao.service.DaoNoSqlTest; |
||||
|
|
||||
|
/** |
||||
|
* Created by Valerii Sosliuk on 6/28/2017. |
||||
|
*/ |
||||
|
@DaoNoSqlTest |
||||
|
public class PluginControllerNoSqlTest extends BasePluginControllerTest { |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller.nosql; |
||||
|
|
||||
|
import org.thingsboard.server.controller.BaseRuleControllerTest; |
||||
|
import org.thingsboard.server.dao.service.DaoNoSqlTest; |
||||
|
|
||||
|
/** |
||||
|
* Created by Valerii Sosliuk on 6/28/2017. |
||||
|
*/ |
||||
|
@DaoNoSqlTest |
||||
|
public class RuleControllerNoSqlTest extends BaseRuleControllerTest { |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller.nosql; |
||||
|
|
||||
|
import org.thingsboard.server.controller.BaseTenantControllerTest; |
||||
|
import org.thingsboard.server.dao.service.DaoNoSqlTest; |
||||
|
|
||||
|
/** |
||||
|
* Created by Valerii Sosliuk on 6/28/2017. |
||||
|
*/ |
||||
|
@DaoNoSqlTest |
||||
|
public class TenantControllerNoSqlTest extends BaseTenantControllerTest { |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller.nosql; |
||||
|
|
||||
|
import org.thingsboard.server.controller.BaseUserControllerTest; |
||||
|
import org.thingsboard.server.dao.service.DaoNoSqlTest; |
||||
|
|
||||
|
/** |
||||
|
* Created by Valerii Sosliuk on 6/28/2017. |
||||
|
*/ |
||||
|
@DaoNoSqlTest |
||||
|
public class UserControllerNoSqlTest extends BaseUserControllerTest { |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller.nosql; |
||||
|
|
||||
|
import org.thingsboard.server.controller.BaseWidgetTypeControllerTest; |
||||
|
import org.thingsboard.server.dao.service.DaoNoSqlTest; |
||||
|
|
||||
|
/** |
||||
|
* Created by Valerii Sosliuk on 6/28/2017. |
||||
|
*/ |
||||
|
@DaoNoSqlTest |
||||
|
public class WidgetTypeControllerNoSqlTest extends BaseWidgetTypeControllerTest { |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller.nosql; |
||||
|
|
||||
|
import org.thingsboard.server.controller.BaseWidgetsBundleControllerTest; |
||||
|
import org.thingsboard.server.dao.service.DaoNoSqlTest; |
||||
|
|
||||
|
/** |
||||
|
* Created by Valerii Sosliuk on 6/28/2017. |
||||
|
*/ |
||||
|
@DaoNoSqlTest |
||||
|
public class WidgetsBundleControllerNoSqlTest extends BaseWidgetsBundleControllerTest { |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller.sql; |
||||
|
|
||||
|
import org.thingsboard.server.controller.BaseAdminControllerTest; |
||||
|
import org.thingsboard.server.dao.service.DaoSqlTest; |
||||
|
|
||||
|
/** |
||||
|
* Created by Valerii Sosliuk on 6/28/2017. |
||||
|
*/ |
||||
|
@DaoSqlTest |
||||
|
public class AdminControllerSqlTest extends BaseAdminControllerTest { |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller.sql; |
||||
|
|
||||
|
import org.thingsboard.server.controller.BaseAssetControllerTest; |
||||
|
import org.thingsboard.server.dao.service.DaoSqlTest; |
||||
|
|
||||
|
/** |
||||
|
* Created by Valerii Sosliuk on 6/28/2017. |
||||
|
*/ |
||||
|
@DaoSqlTest |
||||
|
public class AssetControllerSqlTest extends BaseAssetControllerTest { |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller.sql; |
||||
|
|
||||
|
import org.thingsboard.server.controller.BaseAuthControllerTest; |
||||
|
import org.thingsboard.server.dao.service.DaoSqlTest; |
||||
|
|
||||
|
/** |
||||
|
* Created by Valerii Sosliuk on 6/28/2017. |
||||
|
*/ |
||||
|
@DaoSqlTest |
||||
|
public class AuthControllerSqlTest extends BaseAuthControllerTest { |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller.sql; |
||||
|
|
||||
|
import org.thingsboard.server.controller.BaseComponentDescriptorControllerTest; |
||||
|
import org.thingsboard.server.dao.service.DaoSqlTest; |
||||
|
|
||||
|
/** |
||||
|
* Created by Valerii Sosliuk on 6/28/2017. |
||||
|
*/ |
||||
|
@DaoSqlTest |
||||
|
public class ComponentDescriptorControllerSqlTest extends BaseComponentDescriptorControllerTest { |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller.sql; |
||||
|
|
||||
|
import org.thingsboard.server.controller.BaseCustomerControllerTest; |
||||
|
import org.thingsboard.server.dao.service.DaoSqlTest; |
||||
|
|
||||
|
/** |
||||
|
* Created by Valerii Sosliuk on 6/28/2017. |
||||
|
*/ |
||||
|
@DaoSqlTest |
||||
|
public class CustomerControllerSqlTest extends BaseCustomerControllerTest { |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller.sql; |
||||
|
|
||||
|
import org.thingsboard.server.controller.BaseDashboardControllerTest; |
||||
|
import org.thingsboard.server.dao.service.DaoSqlTest; |
||||
|
|
||||
|
/** |
||||
|
* Created by Valerii Sosliuk on 6/28/2017. |
||||
|
*/ |
||||
|
@DaoSqlTest |
||||
|
public class DashboardControllerSqlTest extends BaseDashboardControllerTest { |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller.sql; |
||||
|
|
||||
|
import org.thingsboard.server.controller.BaseDeviceControllerTest; |
||||
|
import org.thingsboard.server.dao.service.DaoSqlTest; |
||||
|
|
||||
|
/** |
||||
|
* Created by Valerii Sosliuk on 6/28/2017. |
||||
|
*/ |
||||
|
@DaoSqlTest |
||||
|
public class DeviceControllerSqlTest extends BaseDeviceControllerTest { |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller.sql; |
||||
|
|
||||
|
import org.thingsboard.server.controller.BasePluginControllerTest; |
||||
|
import org.thingsboard.server.dao.service.DaoSqlTest; |
||||
|
|
||||
|
/** |
||||
|
* Created by Valerii Sosliuk on 6/28/2017. |
||||
|
*/ |
||||
|
@DaoSqlTest |
||||
|
public class PluginControllerSqlTest extends BasePluginControllerTest { |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller.sql; |
||||
|
|
||||
|
import org.thingsboard.server.controller.BaseRuleControllerTest; |
||||
|
import org.thingsboard.server.dao.service.DaoSqlTest; |
||||
|
|
||||
|
/** |
||||
|
* Created by Valerii Sosliuk on 6/28/2017. |
||||
|
*/ |
||||
|
@DaoSqlTest |
||||
|
public class RuleControllerSqlTest extends BaseRuleControllerTest { |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller.sql; |
||||
|
|
||||
|
import org.thingsboard.server.controller.BaseTenantControllerTest; |
||||
|
import org.thingsboard.server.dao.service.DaoSqlTest; |
||||
|
|
||||
|
/** |
||||
|
* Created by Valerii Sosliuk on 6/28/2017. |
||||
|
*/ |
||||
|
@DaoSqlTest |
||||
|
public class TenantControllerSqlTest extends BaseTenantControllerTest { |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller.sql; |
||||
|
|
||||
|
import org.thingsboard.server.controller.BaseUserControllerTest; |
||||
|
import org.thingsboard.server.dao.service.DaoSqlTest; |
||||
|
|
||||
|
/** |
||||
|
* Created by Valerii Sosliuk on 6/28/2017. |
||||
|
*/ |
||||
|
@DaoSqlTest |
||||
|
public class UserControllerSqlTest extends BaseUserControllerTest { |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller.sql; |
||||
|
|
||||
|
import org.thingsboard.server.controller.BaseWidgetTypeControllerTest; |
||||
|
import org.thingsboard.server.dao.service.DaoSqlTest; |
||||
|
|
||||
|
/** |
||||
|
* Created by Valerii Sosliuk on 6/28/2017. |
||||
|
*/ |
||||
|
@DaoSqlTest |
||||
|
public class WidgetTypeControllerSqlTest extends BaseWidgetTypeControllerTest { |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.controller.sql; |
||||
|
|
||||
|
import org.thingsboard.server.controller.BaseWidgetsBundleControllerTest; |
||||
|
import org.thingsboard.server.dao.service.DaoSqlTest; |
||||
|
|
||||
|
/** |
||||
|
* Created by Valerii Sosliuk on 6/28/2017. |
||||
|
*/ |
||||
|
@DaoSqlTest |
||||
|
public class WidgetsBundleControllerSqlTest extends BaseWidgetsBundleControllerTest { |
||||
|
} |
||||
@ -0,0 +1,213 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.extensions.core.processor; |
||||
|
|
||||
|
import java.util.Optional; |
||||
|
|
||||
|
import com.fasterxml.jackson.core.JsonProcessingException; |
||||
|
import com.fasterxml.jackson.databind.ObjectMapper; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.velocity.Template; |
||||
|
import org.apache.velocity.VelocityContext; |
||||
|
import org.apache.velocity.runtime.parser.ParseException; |
||||
|
import org.thingsboard.server.common.data.alarm.Alarm; |
||||
|
import org.thingsboard.server.common.data.alarm.AlarmSeverity; |
||||
|
import org.thingsboard.server.common.data.alarm.AlarmStatus; |
||||
|
import org.thingsboard.server.common.data.kv.KvEntry; |
||||
|
import org.thingsboard.server.common.msg.core.TelemetryUploadRequest; |
||||
|
import org.thingsboard.server.common.msg.core.UpdateAttributesRequest; |
||||
|
import org.thingsboard.server.common.msg.device.ToDeviceActorMsg; |
||||
|
import org.thingsboard.server.common.msg.session.FromDeviceMsg; |
||||
|
import org.thingsboard.server.extensions.api.component.Processor; |
||||
|
import org.thingsboard.server.extensions.api.rules.*; |
||||
|
import org.thingsboard.server.extensions.core.filter.NashornJsEvaluator; |
||||
|
import org.thingsboard.server.extensions.core.utils.VelocityUtils; |
||||
|
|
||||
|
import javax.script.Bindings; |
||||
|
import javax.script.ScriptException; |
||||
|
import java.io.IOException; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author Andrew Shvayka |
||||
|
*/ |
||||
|
@Processor(name = "Alarm Processor", descriptor = "AlarmProcessorDescriptor.json", |
||||
|
configuration = AlarmProcessorConfiguration.class) |
||||
|
@Slf4j |
||||
|
public class AlarmProcessor implements RuleProcessor<AlarmProcessorConfiguration> { |
||||
|
|
||||
|
static final String IS_NEW_ALARM = "isNewAlarm"; |
||||
|
static final String IS_EXISTING_ALARM = "isExistingAlarm"; |
||||
|
static final String IS_CLEARED_ALARM = "isClearedAlarm"; |
||||
|
|
||||
|
protected NashornJsEvaluator newAlarmEvaluator; |
||||
|
protected NashornJsEvaluator clearAlarmEvaluator; |
||||
|
|
||||
|
private ObjectMapper mapper = new ObjectMapper(); |
||||
|
private AlarmProcessorConfiguration configuration; |
||||
|
private AlarmStatus status; |
||||
|
private AlarmSeverity severity; |
||||
|
private Template alarmTypeTemplate; |
||||
|
private Template alarmDetailsTemplate; |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public void init(AlarmProcessorConfiguration configuration) { |
||||
|
this.configuration = configuration; |
||||
|
try { |
||||
|
this.alarmTypeTemplate = VelocityUtils.create(configuration.getAlarmTypeTemplate(), "Alarm Type Template"); |
||||
|
this.alarmDetailsTemplate = VelocityUtils.create(configuration.getAlarmDetailsTemplate(), "Alarm Details Template"); |
||||
|
this.status = AlarmStatus.valueOf(configuration.getAlarmStatus()); |
||||
|
this.severity = AlarmSeverity.valueOf(configuration.getAlarmSeverity()); |
||||
|
initEvaluators(); |
||||
|
} catch (Exception e) { |
||||
|
log.error("Failed to create templates based on provided configuration!", e); |
||||
|
throw new RuntimeException("Failed to create templates based on provided configuration!", e); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void resume() { |
||||
|
initEvaluators(); |
||||
|
log.debug("Resume method was called, but no impl provided!"); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void suspend() { |
||||
|
destroyEvaluators(); |
||||
|
log.debug("Suspend method was called, but no impl provided!"); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void stop() { |
||||
|
destroyEvaluators(); |
||||
|
log.debug("Stop method was called, but no impl provided!"); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RuleProcessingMetaData process(RuleContext ctx, ToDeviceActorMsg wrapper) throws RuleException { |
||||
|
RuleProcessingMetaData md = new RuleProcessingMetaData(); |
||||
|
|
||||
|
FromDeviceMsg msg = wrapper.getPayload(); |
||||
|
Bindings bindings = buildBindings(ctx, msg); |
||||
|
|
||||
|
boolean isActiveAlarm; |
||||
|
boolean isClearedAlarm; |
||||
|
|
||||
|
try { |
||||
|
isActiveAlarm = newAlarmEvaluator.execute(bindings); |
||||
|
isClearedAlarm = clearAlarmEvaluator.execute(bindings); |
||||
|
} catch (ScriptException e) { |
||||
|
log.debug("[{}] Failed to evaluate alarm expressions!", ctx.getRuleId(), e); |
||||
|
throw new RuleException("Failed to evaluate alarm expressions!", e); |
||||
|
} |
||||
|
|
||||
|
if (!isActiveAlarm && !isClearedAlarm) { |
||||
|
log.debug("[{}] Incoming message do not trigger alarm", ctx.getRuleId()); |
||||
|
return md; |
||||
|
} |
||||
|
|
||||
|
Alarm existing = null; |
||||
|
if (isActiveAlarm) { |
||||
|
Alarm alarm = buildAlarm(ctx, msg); |
||||
|
existing = ctx.createOrUpdateAlarm(alarm); |
||||
|
if (existing.getStartTs() == alarm.getStartTs()) { |
||||
|
log.debug("[{}][{}] New Active Alarm detected"); |
||||
|
md.put(IS_NEW_ALARM, Boolean.TRUE); |
||||
|
} else { |
||||
|
log.debug("[{}][{}] Existing Active Alarm detected"); |
||||
|
md.put(IS_EXISTING_ALARM, Boolean.TRUE); |
||||
|
} |
||||
|
} else if (isClearedAlarm) { |
||||
|
VelocityContext context = VelocityUtils.createContext(ctx.getDeviceMetaData(), msg); |
||||
|
String alarmType = VelocityUtils.merge(alarmTypeTemplate, context); |
||||
|
Optional<Alarm> alarm = ctx.findLatestAlarm(ctx.getDeviceMetaData().getDeviceId(), alarmType); |
||||
|
if (alarm.isPresent()) { |
||||
|
ctx.clearAlarm(alarm.get().getId(), System.currentTimeMillis()); |
||||
|
log.debug("[{}][{}] Existing Active Alarm cleared"); |
||||
|
md.put(IS_CLEARED_ALARM, Boolean.TRUE); |
||||
|
existing = alarm.get(); |
||||
|
} |
||||
|
} |
||||
|
//TODO: handle cleared alarms
|
||||
|
|
||||
|
if (existing != null) { |
||||
|
md.put("alarmId", existing.getId().getId()); |
||||
|
md.put("alarmType", existing.getType()); |
||||
|
md.put("alarmSeverity", existing.getSeverity()); |
||||
|
try { |
||||
|
md.put("alarmDetails", mapper.writeValueAsString(existing.getDetails())); |
||||
|
} catch (JsonProcessingException e) { |
||||
|
throw new RuleException("Failed to serialize alarm details", e); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return md; |
||||
|
} |
||||
|
|
||||
|
private Alarm buildAlarm(RuleContext ctx, FromDeviceMsg msg) throws RuleException { |
||||
|
VelocityContext context = VelocityUtils.createContext(ctx.getDeviceMetaData(), msg); |
||||
|
String alarmType = VelocityUtils.merge(alarmTypeTemplate, context); |
||||
|
String alarmDetails = VelocityUtils.merge(alarmDetailsTemplate, context); |
||||
|
|
||||
|
Alarm alarm = new Alarm(); |
||||
|
alarm.setOriginator(ctx.getDeviceMetaData().getDeviceId()); |
||||
|
alarm.setType(alarmType); |
||||
|
|
||||
|
alarm.setStatus(status); |
||||
|
alarm.setSeverity(severity); |
||||
|
alarm.setPropagate(configuration.isAlarmPropagateFlag()); |
||||
|
|
||||
|
try { |
||||
|
alarm.setDetails(mapper.readTree(alarmDetails)); |
||||
|
} catch (IOException e) { |
||||
|
log.debug("[{}] Failed to parse alarm details {} as json string after evaluation.", ctx.getRuleId(), e); |
||||
|
throw new RuleException("Failed to parse alarm details as json string after evaluation!", e); |
||||
|
} |
||||
|
return alarm; |
||||
|
} |
||||
|
|
||||
|
private Bindings buildBindings(RuleContext ctx, FromDeviceMsg msg) { |
||||
|
Bindings bindings = NashornJsEvaluator.getAttributeBindings(ctx.getDeviceMetaData().getDeviceAttributes()); |
||||
|
if (msg != null) { |
||||
|
switch (msg.getMsgType()) { |
||||
|
case POST_ATTRIBUTES_REQUEST: |
||||
|
bindings = NashornJsEvaluator.updateBindings(bindings, (UpdateAttributesRequest) msg); |
||||
|
break; |
||||
|
case POST_TELEMETRY_REQUEST: |
||||
|
TelemetryUploadRequest telemetryMsg = (TelemetryUploadRequest) msg; |
||||
|
for (List<KvEntry> entries : telemetryMsg.getData().values()) { |
||||
|
bindings = NashornJsEvaluator.toBindings(bindings, entries); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return bindings; |
||||
|
} |
||||
|
|
||||
|
private void initEvaluators() { |
||||
|
newAlarmEvaluator = new NashornJsEvaluator(configuration.getNewAlarmExpression()); |
||||
|
clearAlarmEvaluator = new NashornJsEvaluator(configuration.getClearAlarmExpression()); |
||||
|
} |
||||
|
|
||||
|
private void destroyEvaluators() { |
||||
|
if (newAlarmEvaluator != null) { |
||||
|
newAlarmEvaluator.destroy(); |
||||
|
} |
||||
|
if (clearAlarmEvaluator != null) { |
||||
|
clearAlarmEvaluator.destroy(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,38 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2017 The Thingsboard Authors |
||||
|
* |
||||
|
* 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. |
||||
|
*/ |
||||
|
package org.thingsboard.server.extensions.core.processor; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author Andrew Shvayka |
||||
|
*/ |
||||
|
@Data |
||||
|
public class AlarmProcessorConfiguration { |
||||
|
|
||||
|
private String newAlarmExpression; |
||||
|
private String clearAlarmExpression; |
||||
|
|
||||
|
private String alarmTypeTemplate; |
||||
|
private String alarmSeverity; |
||||
|
private String alarmStatus; |
||||
|
private boolean alarmPropagateFlag; |
||||
|
|
||||
|
private String alarmDetailsTemplate; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,113 @@ |
|||||
|
{ |
||||
|
"schema": { |
||||
|
"title": "Alarm Configuration", |
||||
|
"type": "object", |
||||
|
"properties": { |
||||
|
"newAlarmExpression": { |
||||
|
"title": "Alarm trigger expression", |
||||
|
"type": "string", |
||||
|
"default": "" |
||||
|
}, |
||||
|
"clearAlarmExpression": { |
||||
|
"title": "Alarm clear expression", |
||||
|
"type": "string", |
||||
|
"default": "" |
||||
|
}, |
||||
|
"alarmTypeTemplate": { |
||||
|
"title": "Alarm type", |
||||
|
"type": "string" |
||||
|
}, |
||||
|
"alarmSeverity": { |
||||
|
"title": "Severity", |
||||
|
"type": "string" |
||||
|
}, |
||||
|
"alarmStatus": { |
||||
|
"title": "Status", |
||||
|
"type": "string" |
||||
|
}, |
||||
|
"alarmPropagateFlag": { |
||||
|
"title": "Propagate Alarm", |
||||
|
"type": "boolean" |
||||
|
}, |
||||
|
"alarmDetailsTemplate": { |
||||
|
"title": "Alarm details", |
||||
|
"type": "string" |
||||
|
} |
||||
|
}, |
||||
|
"required": [ |
||||
|
"newAlarmExpression", |
||||
|
"clearAlarmExpression", |
||||
|
"alarmSeverity", |
||||
|
"alarmStatus", |
||||
|
"alarmTypeTemplate", |
||||
|
"alarmDetailsTemplate" |
||||
|
] |
||||
|
}, |
||||
|
"form": [ |
||||
|
{ |
||||
|
"key": "newAlarmExpression", |
||||
|
"type": "javascript" |
||||
|
}, |
||||
|
{ |
||||
|
"key": "clearAlarmExpression", |
||||
|
"type": "javascript" |
||||
|
}, |
||||
|
{ |
||||
|
"key": "alarmSeverity", |
||||
|
"type": "rc-select", |
||||
|
"multiple": false, |
||||
|
"items": [ |
||||
|
{ |
||||
|
"value": "CRITICAL", |
||||
|
"label": "Critical" |
||||
|
}, |
||||
|
{ |
||||
|
"value": "MAJOR", |
||||
|
"label": "Major" |
||||
|
}, |
||||
|
{ |
||||
|
"value": "MINOR", |
||||
|
"label": "Minor" |
||||
|
}, |
||||
|
{ |
||||
|
"value": "WARNING", |
||||
|
"label": "Warning" |
||||
|
}, |
||||
|
{ |
||||
|
"value": "INDETERMINATE", |
||||
|
"label": "Indeterminate" |
||||
|
} |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
"key": "alarmStatus", |
||||
|
"type": "rc-select", |
||||
|
"multiple": false, |
||||
|
"items": [ |
||||
|
{ |
||||
|
"value": "ACTIVE_UNACK", |
||||
|
"label": "Active Unacknowledged" |
||||
|
}, |
||||
|
{ |
||||
|
"value": "ACTIVE_ACK", |
||||
|
"label": "Active Acknowledged" |
||||
|
}, |
||||
|
{ |
||||
|
"value": "CLEARED_UNACK", |
||||
|
"label": "Cleared Unacknowledged" |
||||
|
}, |
||||
|
{ |
||||
|
"value": "CLEARED_ACK", |
||||
|
"label": "Cleared Acknowledged" |
||||
|
} |
||||
|
] |
||||
|
}, |
||||
|
"alarmTypeTemplate", |
||||
|
"alarmPropagateFlag", |
||||
|
{ |
||||
|
"key": "alarmDetailsTemplate", |
||||
|
"type": "textarea", |
||||
|
"rows": 5 |
||||
|
} |
||||
|
] |
||||
|
} |
||||
Loading…
Reference in new issue