115 changed files with 1418 additions and 1112 deletions
@ -0,0 +1,31 @@ |
|||
/** |
|||
* Copyright © 2016-2023 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.common.data.exception; |
|||
|
|||
import lombok.Getter; |
|||
import org.thingsboard.server.common.data.id.TenantId; |
|||
|
|||
public class TenantNotFoundException extends RuntimeException { |
|||
|
|||
@Getter |
|||
private final TenantId tenantId; |
|||
|
|||
public TenantNotFoundException(TenantId tenantId) { |
|||
super("Tenant with id " + tenantId + " not found"); |
|||
this.tenantId = tenantId; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,29 @@ |
|||
/** |
|||
* Copyright © 2016-2023 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.common.data.plugin; |
|||
|
|||
/** |
|||
* The main idea to use this - it's adding the ability to start rule nodes in singleton mode in cluster setup |
|||
* (singleton rule node will start in only one Rule Engine instance) |
|||
* USER_PREFERENCE - user has ability to configure clustering mode (enable/disable singleton mode in rule node config) |
|||
* ENABLE - user doesn't have ability to configure clustering mode (singleton mode is always FALSE in rule node config) |
|||
* SINGLETON - user doesn't have ability to configure clustering mode (singleton mode is always TRUE in rule node config) |
|||
*/ |
|||
public enum ComponentClusteringMode { |
|||
USER_PREFERENCE, |
|||
ENABLED, |
|||
SINGLETON |
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
/** |
|||
* Copyright © 2016-2023 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.common.msg.notification.trigger; |
|||
|
|||
import lombok.Builder; |
|||
import lombok.Data; |
|||
import org.thingsboard.server.common.data.HasName; |
|||
import org.thingsboard.server.common.data.User; |
|||
import org.thingsboard.server.common.data.audit.ActionType; |
|||
import org.thingsboard.server.common.data.id.EntityId; |
|||
import org.thingsboard.server.common.data.id.TenantId; |
|||
import org.thingsboard.server.common.data.notification.rule.trigger.NotificationRuleTriggerType; |
|||
|
|||
@Data |
|||
@Builder |
|||
public class EntityActionTrigger implements NotificationRuleTrigger { |
|||
|
|||
private final TenantId tenantId; |
|||
private final EntityId entityId; |
|||
private final HasName entity; |
|||
private final ActionType actionType; |
|||
private final User user; |
|||
|
|||
@Override |
|||
public NotificationRuleTriggerType getType() { |
|||
return NotificationRuleTriggerType.ENTITY_ACTION; |
|||
} |
|||
|
|||
@Override |
|||
public EntityId getOriginatorEntityId() { |
|||
return entityId; |
|||
} |
|||
|
|||
} |
|||
@ -1,96 +0,0 @@ |
|||
/** |
|||
* Copyright © 2016-2023 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.msa.ui.tests.ruleChainsSmoke; |
|||
|
|||
import io.qameta.allure.Description; |
|||
import io.qameta.allure.Epic; |
|||
import io.qameta.allure.Feature; |
|||
import org.testng.Assert; |
|||
import org.testng.annotations.AfterMethod; |
|||
import org.testng.annotations.BeforeClass; |
|||
import org.testng.annotations.Test; |
|||
import org.thingsboard.server.msa.ui.base.AbstractDriverBaseTest; |
|||
import org.thingsboard.server.msa.ui.pages.LoginPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.OpenRuleChainPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.RuleChainsPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewElements; |
|||
import org.thingsboard.server.msa.ui.utils.EntityPrototypes; |
|||
|
|||
import static org.thingsboard.server.msa.ui.base.AbstractBasePage.random; |
|||
import static org.thingsboard.server.msa.ui.utils.Const.ENTITY_NAME; |
|||
|
|||
public class OpenRuleChainTest extends AbstractDriverBaseTest { |
|||
|
|||
private SideBarMenuViewElements sideBarMenuView; |
|||
private RuleChainsPageHelper ruleChainsPage; |
|||
private OpenRuleChainPageHelper openRuleChainPage; |
|||
private String ruleChainName; |
|||
|
|||
@BeforeClass |
|||
public void login() { |
|||
new LoginPageHelper(driver).authorizationTenant(); |
|||
sideBarMenuView = new SideBarMenuViewElements(driver); |
|||
ruleChainsPage = new RuleChainsPageHelper(driver); |
|||
openRuleChainPage = new OpenRuleChainPageHelper(driver); |
|||
} |
|||
|
|||
@AfterMethod |
|||
public void delete() { |
|||
if (ruleChainName != null) { |
|||
testRestClient.deleteRuleChain(getRuleChainByName(ruleChainName).getId()); |
|||
ruleChainName = null; |
|||
} |
|||
} |
|||
|
|||
@Epic("Rule chains smoke tests") |
|||
@Feature("Open rule chain") |
|||
@Test(priority = 10, groups = "smoke") |
|||
@Description("Open the rule chain by clicking on its name") |
|||
public void openRuleChainByRightCornerBtn() { |
|||
String ruleChainName = ENTITY_NAME + random(); |
|||
testRestClient.postRuleChain(EntityPrototypes.defaultRuleChainPrototype(ruleChainName)); |
|||
this.ruleChainName = ruleChainName; |
|||
|
|||
sideBarMenuView.ruleChainsBtn().click(); |
|||
ruleChainsPage.entity(ruleChainName).click(); |
|||
openRuleChainPage.setHeadName(); |
|||
|
|||
Assert.assertTrue(urlContains(String.valueOf(getRuleChainByName(ruleChainName).getId()))); |
|||
Assert.assertTrue(openRuleChainPage.headRuleChainName().isDisplayed()); |
|||
Assert.assertTrue(openRuleChainPage.inputNode().isDisplayed()); |
|||
Assert.assertEquals(ruleChainName, openRuleChainPage.getHeadName()); |
|||
} |
|||
|
|||
@Epic("Rule chains smoke tests") |
|||
@Feature("Open rule chain") |
|||
@Test(priority = 10, groups = "smoke") |
|||
@Description("Open the rule chain by clicking on the 'Open rule chain' button in the entity view") |
|||
public void openRuleChainByViewBtn() { |
|||
String ruleChainName = ENTITY_NAME + random(); |
|||
testRestClient.postRuleChain(EntityPrototypes.defaultRuleChainPrototype(ruleChainName)); |
|||
this.ruleChainName = ruleChainName; |
|||
|
|||
sideBarMenuView.ruleChainsBtn().click(); |
|||
ruleChainsPage.detailsBtn(ruleChainName).click(); |
|||
ruleChainsPage.openRuleChainFromViewBtn().click(); |
|||
openRuleChainPage.setHeadName(); |
|||
|
|||
Assert.assertTrue(urlContains(String.valueOf(getRuleChainByName(ruleChainName).getId()))); |
|||
Assert.assertTrue(openRuleChainPage.headRuleChainName().isDisplayed()); |
|||
Assert.assertTrue(openRuleChainPage.inputNode().isDisplayed()); |
|||
Assert.assertEquals(ruleChainName, openRuleChainPage.getHeadName()); |
|||
} |
|||
} |
|||
@ -0,0 +1,49 @@ |
|||
/** |
|||
* Copyright © 2016-2023 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.msa.ui.tests.rulechainssmoke; |
|||
|
|||
import io.qameta.allure.Epic; |
|||
import org.testng.annotations.AfterMethod; |
|||
import org.testng.annotations.BeforeClass; |
|||
import org.thingsboard.server.msa.ui.base.AbstractDriverBaseTest; |
|||
import org.thingsboard.server.msa.ui.pages.LoginPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.OpenRuleChainPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.RuleChainsPageHelper; |
|||
import org.thingsboard.server.msa.ui.pages.SideBarMenuViewElements; |
|||
|
|||
@Epic("Rule chains smoke tests") |
|||
abstract public class AbstractRuleChainTest extends AbstractDriverBaseTest { |
|||
|
|||
protected SideBarMenuViewElements sideBarMenuView; |
|||
protected RuleChainsPageHelper ruleChainsPage; |
|||
protected OpenRuleChainPageHelper openRuleChainPage; |
|||
protected String ruleChainName; |
|||
|
|||
@BeforeClass |
|||
public void login() { |
|||
new LoginPageHelper(driver).authorizationTenant(); |
|||
sideBarMenuView = new SideBarMenuViewElements(driver); |
|||
ruleChainsPage = new RuleChainsPageHelper(driver); |
|||
openRuleChainPage = new OpenRuleChainPageHelper(driver); |
|||
} |
|||
|
|||
@AfterMethod |
|||
public void delete() { |
|||
deleteRuleChainByName(ruleChainName); |
|||
ruleChainName = null; |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,66 @@ |
|||
/** |
|||
* Copyright © 2016-2023 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.msa.ui.tests.rulechainssmoke; |
|||
|
|||
import io.qameta.allure.Description; |
|||
import io.qameta.allure.Feature; |
|||
import org.testng.annotations.Test; |
|||
import org.thingsboard.server.common.data.rule.RuleChain; |
|||
import org.thingsboard.server.msa.ui.utils.EntityPrototypes; |
|||
|
|||
import static org.assertj.core.api.Assertions.assertThat; |
|||
import static org.thingsboard.server.msa.ui.base.AbstractBasePage.random; |
|||
import static org.thingsboard.server.msa.ui.utils.Const.ENTITY_NAME; |
|||
|
|||
@Feature("Open rule chain") |
|||
public class OpenRuleChainTest extends AbstractRuleChainTest { |
|||
|
|||
@Test(priority = 10, groups = "smoke") |
|||
@Description("Open the rule chain by clicking on its name") |
|||
public void openRuleChainByRightCornerBtn() { |
|||
ruleChainName = ENTITY_NAME + random(); |
|||
testRestClient.postRuleChain(EntityPrototypes.defaultRuleChainPrototype(ruleChainName)); |
|||
RuleChain ruleChain = getRuleChainByName(ruleChainName); |
|||
|
|||
sideBarMenuView.ruleChainsBtn().click(); |
|||
ruleChainsPage.entity(ruleChainName).click(); |
|||
openRuleChainPage.setHeadName(); |
|||
|
|||
assertThat(urlContains(ruleChain.getUuidId().toString())).as("URL contains rule chain's ID").isTrue(); |
|||
assertIsDisplayed(openRuleChainPage.headRuleChainName()); |
|||
assertIsDisplayed(openRuleChainPage.inputNode()); |
|||
assertThat(openRuleChainPage.getHeadName()).as("Head of opened rule chain page text").isEqualTo(ruleChainName); |
|||
} |
|||
|
|||
@Test(priority = 10, groups = "smoke") |
|||
@Description("Open the rule chain by clicking on the 'Open rule chain' button in the entity view") |
|||
public void openRuleChainByViewBtn() { |
|||
ruleChainName = ENTITY_NAME + random(); |
|||
testRestClient.postRuleChain(EntityPrototypes.defaultRuleChainPrototype(ruleChainName)); |
|||
RuleChain ruleChain = getRuleChainByName(ruleChainName); |
|||
|
|||
sideBarMenuView.ruleChainsBtn().click(); |
|||
ruleChainsPage.detailsBtn(ruleChainName).click(); |
|||
ruleChainsPage.openRuleChainFromViewBtn().click(); |
|||
openRuleChainPage.setHeadName(); |
|||
|
|||
assertThat(ruleChain).as("Rule chain created").isNotNull(); |
|||
assertThat(urlContains(ruleChain.getUuidId().toString())).as("URL contains rule chain's ID").isTrue(); |
|||
assertIsDisplayed(openRuleChainPage.headRuleChainName()); |
|||
assertIsDisplayed(openRuleChainPage.inputNode()); |
|||
assertThat(openRuleChainPage.getHeadName()).as("Head of opened rule chain page text").isEqualTo(ruleChainName); |
|||
} |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue