added logs for wiggets bundle
This commit is contained in:
parent
64908e8d66
commit
ae93b42b60
@ -117,7 +117,7 @@ public class WidgetsBundleController extends BaseController {
|
|||||||
checkParameter("widgetsBundleId", strWidgetsBundleId);
|
checkParameter("widgetsBundleId", strWidgetsBundleId);
|
||||||
WidgetsBundleId widgetsBundleId = new WidgetsBundleId(toUUID(strWidgetsBundleId));
|
WidgetsBundleId widgetsBundleId = new WidgetsBundleId(toUUID(strWidgetsBundleId));
|
||||||
WidgetsBundle widgetsBundle = checkWidgetsBundleId(widgetsBundleId, Operation.DELETE);
|
WidgetsBundle widgetsBundle = checkWidgetsBundleId(widgetsBundleId, Operation.DELETE);
|
||||||
tbWidgetsBundleService.delete(widgetsBundle);
|
tbWidgetsBundleService.delete(widgetsBundle, getCurrentUser());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "Get Widget Bundles (getWidgetsBundles)",
|
@ApiOperation(value = "Get Widget Bundles (getWidgetsBundles)",
|
||||||
|
|||||||
@ -17,9 +17,10 @@ package org.thingsboard.server.service.entitiy.widgets.bundle;
|
|||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.thingsboard.server.common.data.EntityType;
|
||||||
import org.thingsboard.server.common.data.User;
|
import org.thingsboard.server.common.data.User;
|
||||||
import org.thingsboard.server.common.data.edge.EdgeEventActionType;
|
import org.thingsboard.server.common.data.audit.ActionType;
|
||||||
import org.thingsboard.server.common.data.exception.ThingsboardException;
|
import org.thingsboard.server.common.data.id.TenantId;
|
||||||
import org.thingsboard.server.common.data.widget.WidgetsBundle;
|
import org.thingsboard.server.common.data.widget.WidgetsBundle;
|
||||||
import org.thingsboard.server.dao.widget.WidgetsBundleService;
|
import org.thingsboard.server.dao.widget.WidgetsBundleService;
|
||||||
import org.thingsboard.server.queue.util.TbCoreComponent;
|
import org.thingsboard.server.queue.util.TbCoreComponent;
|
||||||
@ -34,17 +35,31 @@ public class DefaultWidgetsBundleService extends AbstractTbEntityService impleme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WidgetsBundle save(WidgetsBundle widgetsBundle, User user) throws Exception {
|
public WidgetsBundle save(WidgetsBundle widgetsBundle, User user) throws Exception {
|
||||||
|
ActionType actionType = widgetsBundle.getId() == null ? ActionType.ADDED : ActionType.UPDATED;
|
||||||
|
TenantId tenantId = widgetsBundle.getTenantId();
|
||||||
|
try {
|
||||||
WidgetsBundle savedWidgetsBundle = checkNotNull(widgetsBundleService.saveWidgetsBundle(widgetsBundle));
|
WidgetsBundle savedWidgetsBundle = checkNotNull(widgetsBundleService.saveWidgetsBundle(widgetsBundle));
|
||||||
autoCommit(user, savedWidgetsBundle.getId());
|
autoCommit(user, savedWidgetsBundle.getId());
|
||||||
notificationEntityService.notifySendMsgToEdgeService(widgetsBundle.getTenantId(), savedWidgetsBundle.getId(),
|
notificationEntityService.notifyCreateOrUpdateOrDelete(tenantId, null, savedWidgetsBundle.getId(),
|
||||||
widgetsBundle.getId() == null ? EdgeEventActionType.ADDED : EdgeEventActionType.UPDATED);
|
savedWidgetsBundle, user, actionType, true, null);
|
||||||
return savedWidgetsBundle;
|
return savedWidgetsBundle;
|
||||||
|
} catch (Exception e) {
|
||||||
|
notificationEntityService.logEntityAction(tenantId, emptyId(EntityType.WIDGETS_BUNDLE), widgetsBundle, actionType, user, e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(WidgetsBundle widgetsBundle) throws ThingsboardException {
|
public void delete(WidgetsBundle widgetsBundle, User user) {
|
||||||
|
TenantId tenantId = widgetsBundle.getTenantId();
|
||||||
|
try {
|
||||||
widgetsBundleService.deleteWidgetsBundle(widgetsBundle.getTenantId(), widgetsBundle.getId());
|
widgetsBundleService.deleteWidgetsBundle(widgetsBundle.getTenantId(), widgetsBundle.getId());
|
||||||
notificationEntityService.notifySendMsgToEdgeService(widgetsBundle.getTenantId(), widgetsBundle.getId(),
|
notificationEntityService.notifyCreateOrUpdateOrDelete(tenantId, null, widgetsBundle.getId(), widgetsBundle,
|
||||||
EdgeEventActionType.DELETED);
|
user, ActionType.DELETED, true, null);
|
||||||
|
} catch (Exception e) {
|
||||||
|
notificationEntityService.logEntityAction(tenantId, emptyId(EntityType.WIDGETS_BUNDLE),
|
||||||
|
ActionType.DELETED, user, e, widgetsBundle.getId());
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,13 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.thingsboard.server.service.entitiy.widgets.bundle;
|
package org.thingsboard.server.service.entitiy.widgets.bundle;
|
||||||
|
|
||||||
import org.thingsboard.server.common.data.User;
|
|
||||||
import org.thingsboard.server.common.data.exception.ThingsboardException;
|
|
||||||
import org.thingsboard.server.common.data.widget.WidgetsBundle;
|
import org.thingsboard.server.common.data.widget.WidgetsBundle;
|
||||||
|
import org.thingsboard.server.service.entitiy.SimpleTbEntityService;
|
||||||
|
|
||||||
public interface TbWidgetsBundleService {
|
public interface TbWidgetsBundleService extends SimpleTbEntityService<WidgetsBundle> {
|
||||||
|
|
||||||
WidgetsBundle save(WidgetsBundle entity, User currentUser) throws Exception;
|
|
||||||
|
|
||||||
void delete(WidgetsBundle entity) throws ThingsboardException;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -614,6 +614,7 @@ audit-log:
|
|||||||
"device": "${AUDIT_LOG_MASK_DEVICE:W}"
|
"device": "${AUDIT_LOG_MASK_DEVICE:W}"
|
||||||
"asset": "${AUDIT_LOG_MASK_ASSET:W}"
|
"asset": "${AUDIT_LOG_MASK_ASSET:W}"
|
||||||
"dashboard": "${AUDIT_LOG_MASK_DASHBOARD:W}"
|
"dashboard": "${AUDIT_LOG_MASK_DASHBOARD:W}"
|
||||||
|
"widgets_bundle": "${AUDIT_LOG_MASK_WIDGETS_BUNDLE:W}"
|
||||||
"customer": "${AUDIT_LOG_MASK_CUSTOMER:W}"
|
"customer": "${AUDIT_LOG_MASK_CUSTOMER:W}"
|
||||||
"user": "${AUDIT_LOG_MASK_USER:W}"
|
"user": "${AUDIT_LOG_MASK_USER:W}"
|
||||||
"rule_chain": "${AUDIT_LOG_MASK_RULE_CHAIN:W}"
|
"rule_chain": "${AUDIT_LOG_MASK_RULE_CHAIN:W}"
|
||||||
|
|||||||
@ -21,16 +21,15 @@ import org.junit.Assert;
|
|||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
import org.thingsboard.server.common.data.Customer;
|
|
||||||
import org.thingsboard.server.common.data.StringUtils;
|
import org.thingsboard.server.common.data.StringUtils;
|
||||||
import org.thingsboard.server.common.data.Tenant;
|
import org.thingsboard.server.common.data.Tenant;
|
||||||
import org.thingsboard.server.common.data.User;
|
import org.thingsboard.server.common.data.User;
|
||||||
import org.thingsboard.server.common.data.audit.ActionType;
|
import org.thingsboard.server.common.data.audit.ActionType;
|
||||||
import org.thingsboard.server.common.data.id.CustomerId;
|
|
||||||
import org.thingsboard.server.common.data.page.PageData;
|
import org.thingsboard.server.common.data.page.PageData;
|
||||||
import org.thingsboard.server.common.data.page.PageLink;
|
import org.thingsboard.server.common.data.page.PageLink;
|
||||||
import org.thingsboard.server.common.data.security.Authority;
|
import org.thingsboard.server.common.data.security.Authority;
|
||||||
import org.thingsboard.server.common.data.widget.WidgetsBundle;
|
import org.thingsboard.server.common.data.widget.WidgetsBundle;
|
||||||
|
import org.thingsboard.server.dao.exception.DataValidationException;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -38,7 +37,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||||
import static org.thingsboard.server.dao.model.ModelConstants.SYSTEM_TENANT;
|
|
||||||
|
|
||||||
public abstract class BaseWidgetsBundleControllerTest extends AbstractControllerTest {
|
public abstract class BaseWidgetsBundleControllerTest extends AbstractControllerTest {
|
||||||
|
|
||||||
@ -79,14 +77,14 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
|||||||
WidgetsBundle widgetsBundle = new WidgetsBundle();
|
WidgetsBundle widgetsBundle = new WidgetsBundle();
|
||||||
widgetsBundle.setTitle("My widgets bundle");
|
widgetsBundle.setTitle("My widgets bundle");
|
||||||
|
|
||||||
Mockito.reset(tbClusterService);
|
Mockito.reset(tbClusterService, auditLogService);
|
||||||
|
|
||||||
WidgetsBundle savedWidgetsBundle = doPost("/api/widgetsBundle", widgetsBundle, WidgetsBundle.class);
|
WidgetsBundle savedWidgetsBundle = doPost("/api/widgetsBundle", widgetsBundle, WidgetsBundle.class);
|
||||||
|
|
||||||
testNotifyManyEntityManyTimeMsgToEdgeServiceEntityEqAny(savedWidgetsBundle, savedWidgetsBundle,
|
testNotifyEntityAllOneTime(savedWidgetsBundle, savedWidgetsBundle.getId(), savedWidgetsBundle.getId(), savedTenant.getId(),
|
||||||
savedTenant.getId(), tenantAdmin.getCustomerId(), tenantAdmin.getId(), tenantAdmin.getEmail(),
|
tenantAdmin.getCustomerId(), tenantAdmin.getId(), tenantAdmin.getEmail(), ActionType.ADDED);
|
||||||
ActionType.ADDED, ActionType.ADDED, 0, 1, 0);
|
|
||||||
Mockito.reset(tbClusterService);
|
Mockito.reset(tbClusterService, auditLogService);
|
||||||
|
|
||||||
Assert.assertNotNull(savedWidgetsBundle);
|
Assert.assertNotNull(savedWidgetsBundle);
|
||||||
Assert.assertNotNull(savedWidgetsBundle.getId());
|
Assert.assertNotNull(savedWidgetsBundle.getId());
|
||||||
@ -101,9 +99,8 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
|||||||
WidgetsBundle foundWidgetsBundle = doGet("/api/widgetsBundle/" + savedWidgetsBundle.getId().getId().toString(), WidgetsBundle.class);
|
WidgetsBundle foundWidgetsBundle = doGet("/api/widgetsBundle/" + savedWidgetsBundle.getId().getId().toString(), WidgetsBundle.class);
|
||||||
Assert.assertEquals(foundWidgetsBundle.getTitle(), savedWidgetsBundle.getTitle());
|
Assert.assertEquals(foundWidgetsBundle.getTitle(), savedWidgetsBundle.getTitle());
|
||||||
|
|
||||||
testNotifyManyEntityManyTimeMsgToEdgeServiceEntityEqAny(savedWidgetsBundle, savedWidgetsBundle,
|
testNotifyEntityAllOneTime(savedWidgetsBundle, savedWidgetsBundle.getId(), savedWidgetsBundle.getId(), savedTenant.getId(),
|
||||||
savedTenant.getId(), tenantAdmin.getCustomerId(), tenantAdmin.getId(), tenantAdmin.getEmail(),
|
tenantAdmin.getCustomerId(), tenantAdmin.getId(), tenantAdmin.getEmail(), ActionType.UPDATED);
|
||||||
ActionType.UPDATED, ActionType.UPDATED, 0, 1, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -111,14 +108,16 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
|||||||
WidgetsBundle widgetsBundle = new WidgetsBundle();
|
WidgetsBundle widgetsBundle = new WidgetsBundle();
|
||||||
widgetsBundle.setTitle(StringUtils.randomAlphabetic(300));
|
widgetsBundle.setTitle(StringUtils.randomAlphabetic(300));
|
||||||
|
|
||||||
Mockito.reset(tbClusterService);
|
Mockito.reset(tbClusterService, auditLogService);
|
||||||
|
|
||||||
String msgError = msgErrorFieldLength("title");
|
String msgError = msgErrorFieldLength("title");
|
||||||
doPost("/api/widgetsBundle", widgetsBundle)
|
doPost("/api/widgetsBundle", widgetsBundle)
|
||||||
.andExpect(status().isBadRequest())
|
.andExpect(status().isBadRequest())
|
||||||
.andExpect(statusReason(containsString(msgError)));
|
.andExpect(statusReason(containsString(msgError)));
|
||||||
|
|
||||||
testNotifyEntityNever(widgetsBundle.getId(), widgetsBundle);
|
testNotifyEntityEqualsOneTimeServiceNeverError(widgetsBundle, savedTenant.getId(),
|
||||||
|
tenantAdmin.getId(), tenantAdmin.getEmail(), ActionType.ADDED,
|
||||||
|
new DataValidationException("Validation error: title length must be equal or less than 255"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -129,7 +128,7 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
|||||||
|
|
||||||
loginDifferentTenant();
|
loginDifferentTenant();
|
||||||
|
|
||||||
Mockito.reset(tbClusterService);
|
Mockito.reset(tbClusterService, auditLogService);
|
||||||
|
|
||||||
doPost("/api/widgetsBundle", savedWidgetsBundle)
|
doPost("/api/widgetsBundle", savedWidgetsBundle)
|
||||||
.andExpect(status().isForbidden())
|
.andExpect(status().isForbidden())
|
||||||
@ -155,26 +154,25 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
|||||||
WidgetsBundle widgetsBundle = new WidgetsBundle();
|
WidgetsBundle widgetsBundle = new WidgetsBundle();
|
||||||
widgetsBundle.setTitle("My widgets bundle");
|
widgetsBundle.setTitle("My widgets bundle");
|
||||||
|
|
||||||
Mockito.reset(tbClusterService, auditLogService);
|
|
||||||
|
|
||||||
WidgetsBundle savedWidgetsBundle = doPost("/api/widgetsBundle", widgetsBundle, WidgetsBundle.class);
|
WidgetsBundle savedWidgetsBundle = doPost("/api/widgetsBundle", widgetsBundle, WidgetsBundle.class);
|
||||||
|
|
||||||
|
Mockito.reset(tbClusterService, auditLogService);
|
||||||
|
|
||||||
doDelete("/api/widgetsBundle/" + savedWidgetsBundle.getId().getId().toString())
|
doDelete("/api/widgetsBundle/" + savedWidgetsBundle.getId().getId().toString())
|
||||||
.andExpect(status().isOk());
|
.andExpect(status().isOk());
|
||||||
|
|
||||||
String savedWidgetsBundleIdStr = savedWidgetsBundle.getId().getId().toString();
|
String savedWidgetsBundleIdStr = savedWidgetsBundle.getId().getId().toString();
|
||||||
|
|
||||||
|
testNotifyEntityAllOneTime(savedWidgetsBundle, savedWidgetsBundle.getId(), savedWidgetsBundle.getId(), savedTenant.getId(),
|
||||||
|
tenantAdmin.getCustomerId(), tenantAdmin.getId(), tenantAdmin.getEmail(), ActionType.DELETED);
|
||||||
|
|
||||||
doGet("/api/widgetsBundle/" + savedWidgetsBundleIdStr)
|
doGet("/api/widgetsBundle/" + savedWidgetsBundleIdStr)
|
||||||
.andExpect(status().isNotFound())
|
.andExpect(status().isNotFound())
|
||||||
.andExpect(statusReason(containsString(msgErrorNoFound("Widgets bundle", savedWidgetsBundleIdStr))));
|
.andExpect(statusReason(containsString(msgErrorNoFound("Widgets bundle", savedWidgetsBundleIdStr))));
|
||||||
|
|
||||||
testNotifyManyEntityManyTimeMsgToEdgeServiceEntityEqAny(savedWidgetsBundle, savedWidgetsBundle,
|
|
||||||
savedTenant.getId(), tenantAdmin.getCustomerId(), tenantAdmin.getId(), tenantAdmin.getEmail(),
|
|
||||||
ActionType.DELETED, ActionType.DELETED, 0, 1, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSaveWidgetsBundleWithEmptyTitle() throws Exception {
|
public void testSaveWidgetsBundleWithEmptyTitle() throws Exception {
|
||||||
|
|
||||||
Mockito.reset(tbClusterService, auditLogService);
|
Mockito.reset(tbClusterService, auditLogService);
|
||||||
|
|
||||||
WidgetsBundle widgetsBundle = new WidgetsBundle();
|
WidgetsBundle widgetsBundle = new WidgetsBundle();
|
||||||
@ -182,7 +180,9 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
|||||||
.andExpect(status().isBadRequest())
|
.andExpect(status().isBadRequest())
|
||||||
.andExpect(statusReason(containsString("Widgets bundle title " + msgErrorShouldBeSpecified)));
|
.andExpect(statusReason(containsString("Widgets bundle title " + msgErrorShouldBeSpecified)));
|
||||||
|
|
||||||
testNotifyEntityNever(widgetsBundle.getId(), widgetsBundle);
|
testNotifyEntityEqualsOneTimeServiceNeverError(widgetsBundle, savedTenant.getId(),
|
||||||
|
tenantAdmin.getId(), tenantAdmin.getEmail(), ActionType.ADDED,
|
||||||
|
new DataValidationException("Widgets bundle title should be specified!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -192,13 +192,14 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
|||||||
WidgetsBundle savedWidgetsBundle = doPost("/api/widgetsBundle", widgetsBundle, WidgetsBundle.class);
|
WidgetsBundle savedWidgetsBundle = doPost("/api/widgetsBundle", widgetsBundle, WidgetsBundle.class);
|
||||||
savedWidgetsBundle.setAlias("new_alias");
|
savedWidgetsBundle.setAlias("new_alias");
|
||||||
|
|
||||||
Mockito.clearInvocations(tbClusterService);
|
Mockito.reset(tbClusterService, auditLogService);
|
||||||
|
|
||||||
doPost("/api/widgetsBundle", savedWidgetsBundle)
|
doPost("/api/widgetsBundle", savedWidgetsBundle)
|
||||||
.andExpect(status().isBadRequest())
|
.andExpect(status().isBadRequest())
|
||||||
.andExpect(statusReason(containsString("Update of widgets bundle alias is prohibited")));
|
.andExpect(statusReason(containsString("Update of widgets bundle alias is prohibited")));
|
||||||
|
testNotifyEntityEqualsOneTimeServiceNeverError(savedWidgetsBundle, savedTenant.getId(),
|
||||||
testNotifyEntityNever(savedWidgetsBundle.getId(), savedWidgetsBundle);
|
tenantAdmin.getId(), tenantAdmin.getEmail(), ActionType.UPDATED,
|
||||||
|
new DataValidationException("Update of widgets bundle alias is prohibited!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -207,9 +208,8 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
|||||||
login(tenantAdmin.getEmail(), "testPassword1");
|
login(tenantAdmin.getEmail(), "testPassword1");
|
||||||
|
|
||||||
List<WidgetsBundle> sysWidgetsBundles = doGetTyped("/api/widgetsBundles?",
|
List<WidgetsBundle> sysWidgetsBundles = doGetTyped("/api/widgetsBundles?",
|
||||||
new TypeReference<>(){});
|
new TypeReference<>() {
|
||||||
|
});
|
||||||
Mockito.reset(tbClusterService);
|
|
||||||
|
|
||||||
int cntEntity = 73;
|
int cntEntity = 73;
|
||||||
List<WidgetsBundle> widgetsBundles = new ArrayList<>();
|
List<WidgetsBundle> widgetsBundles = new ArrayList<>();
|
||||||
@ -219,10 +219,6 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
|||||||
widgetsBundles.add(doPost("/api/widgetsBundle", widgetsBundle, WidgetsBundle.class));
|
widgetsBundles.add(doPost("/api/widgetsBundle", widgetsBundle, WidgetsBundle.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
testNotifyManyEntityManyTimeMsgToEdgeServiceEntityEqAny(new WidgetsBundle(), new WidgetsBundle(),
|
|
||||||
savedTenant.getId(), tenantAdmin.getCustomerId(), tenantAdmin.getId(), tenantAdmin.getEmail(),
|
|
||||||
ActionType.ADDED, ActionType.ADDED, 0, cntEntity, 0);
|
|
||||||
|
|
||||||
widgetsBundles.addAll(sysWidgetsBundles);
|
widgetsBundles.addAll(sysWidgetsBundles);
|
||||||
|
|
||||||
List<WidgetsBundle> loadedWidgetsBundles = new ArrayList<>();
|
List<WidgetsBundle> loadedWidgetsBundles = new ArrayList<>();
|
||||||
@ -230,7 +226,8 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
|||||||
PageData<WidgetsBundle> pageData;
|
PageData<WidgetsBundle> pageData;
|
||||||
do {
|
do {
|
||||||
pageData = doGetTypedWithPageLink("/api/widgetsBundles?",
|
pageData = doGetTypedWithPageLink("/api/widgetsBundles?",
|
||||||
new TypeReference<>(){}, pageLink);
|
new TypeReference<>() {
|
||||||
|
}, pageLink);
|
||||||
loadedWidgetsBundles.addAll(pageData.getData());
|
loadedWidgetsBundles.addAll(pageData.getData());
|
||||||
if (pageData.hasNext()) {
|
if (pageData.hasNext()) {
|
||||||
pageLink = pageLink.nextPageLink();
|
pageLink = pageLink.nextPageLink();
|
||||||
@ -249,7 +246,8 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
|||||||
loginSysAdmin();
|
loginSysAdmin();
|
||||||
|
|
||||||
List<WidgetsBundle> sysWidgetsBundles = doGetTyped("/api/widgetsBundles?",
|
List<WidgetsBundle> sysWidgetsBundles = doGetTyped("/api/widgetsBundles?",
|
||||||
new TypeReference<>(){});
|
new TypeReference<>() {
|
||||||
|
});
|
||||||
|
|
||||||
int cntEntity = 120;
|
int cntEntity = 120;
|
||||||
List<WidgetsBundle> createdWidgetsBundles = new ArrayList<>();
|
List<WidgetsBundle> createdWidgetsBundles = new ArrayList<>();
|
||||||
@ -267,7 +265,8 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
|||||||
PageData<WidgetsBundle> pageData;
|
PageData<WidgetsBundle> pageData;
|
||||||
do {
|
do {
|
||||||
pageData = doGetTypedWithPageLink("/api/widgetsBundles?",
|
pageData = doGetTypedWithPageLink("/api/widgetsBundles?",
|
||||||
new TypeReference<>(){}, pageLink);
|
new TypeReference<>() {
|
||||||
|
}, pageLink);
|
||||||
loadedWidgetsBundles.addAll(pageData.getData());
|
loadedWidgetsBundles.addAll(pageData.getData());
|
||||||
if (pageData.hasNext()) {
|
if (pageData.hasNext()) {
|
||||||
pageLink = pageLink.nextPageLink();
|
pageLink = pageLink.nextPageLink();
|
||||||
@ -279,22 +278,17 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
|||||||
|
|
||||||
Assert.assertEquals(widgetsBundles, loadedWidgetsBundles);
|
Assert.assertEquals(widgetsBundles, loadedWidgetsBundles);
|
||||||
|
|
||||||
Mockito.reset(tbClusterService);
|
|
||||||
|
|
||||||
for (WidgetsBundle widgetsBundle : createdWidgetsBundles) {
|
for (WidgetsBundle widgetsBundle : createdWidgetsBundles) {
|
||||||
doDelete("/api/widgetsBundle/" + widgetsBundle.getId().getId().toString())
|
doDelete("/api/widgetsBundle/" + widgetsBundle.getId().getId().toString())
|
||||||
.andExpect(status().isOk());
|
.andExpect(status().isOk());
|
||||||
}
|
}
|
||||||
|
|
||||||
testNotifyManyEntityManyTimeMsgToEdgeServiceEntityEqAny(new WidgetsBundle(), new WidgetsBundle(),
|
|
||||||
SYSTEM_TENANT, (CustomerId) createEntityId_NULL_UUID(new Customer()), null, SYS_ADMIN_EMAIL,
|
|
||||||
ActionType.DELETED, ActionType.DELETED, 0, cntEntity, 0);
|
|
||||||
|
|
||||||
pageLink = new PageLink(17);
|
pageLink = new PageLink(17);
|
||||||
loadedWidgetsBundles.clear();
|
loadedWidgetsBundles.clear();
|
||||||
do {
|
do {
|
||||||
pageData = doGetTypedWithPageLink("/api/widgetsBundles?",
|
pageData = doGetTypedWithPageLink("/api/widgetsBundles?",
|
||||||
new TypeReference<PageData<WidgetsBundle>>(){}, pageLink);
|
new TypeReference<PageData<WidgetsBundle>>() {
|
||||||
|
}, pageLink);
|
||||||
loadedWidgetsBundles.addAll(pageData.getData());
|
loadedWidgetsBundles.addAll(pageData.getData());
|
||||||
if (pageData.hasNext()) {
|
if (pageData.hasNext()) {
|
||||||
pageLink = pageLink.nextPageLink();
|
pageLink = pageLink.nextPageLink();
|
||||||
@ -314,7 +308,8 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
|||||||
login(tenantAdmin.getEmail(), "testPassword1");
|
login(tenantAdmin.getEmail(), "testPassword1");
|
||||||
|
|
||||||
List<WidgetsBundle> sysWidgetsBundles = doGetTyped("/api/widgetsBundles?",
|
List<WidgetsBundle> sysWidgetsBundles = doGetTyped("/api/widgetsBundles?",
|
||||||
new TypeReference<List<WidgetsBundle>>(){});
|
new TypeReference<List<WidgetsBundle>>() {
|
||||||
|
});
|
||||||
|
|
||||||
List<WidgetsBundle> widgetsBundles = new ArrayList<>();
|
List<WidgetsBundle> widgetsBundles = new ArrayList<>();
|
||||||
for (int i = 0; i < 73; i++) {
|
for (int i = 0; i < 73; i++) {
|
||||||
@ -326,7 +321,8 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
|||||||
widgetsBundles.addAll(sysWidgetsBundles);
|
widgetsBundles.addAll(sysWidgetsBundles);
|
||||||
|
|
||||||
List<WidgetsBundle> loadedWidgetsBundles = doGetTyped("/api/widgetsBundles?",
|
List<WidgetsBundle> loadedWidgetsBundles = doGetTyped("/api/widgetsBundles?",
|
||||||
new TypeReference<>(){});
|
new TypeReference<>() {
|
||||||
|
});
|
||||||
|
|
||||||
Collections.sort(widgetsBundles, idComparator);
|
Collections.sort(widgetsBundles, idComparator);
|
||||||
Collections.sort(loadedWidgetsBundles, idComparator);
|
Collections.sort(loadedWidgetsBundles, idComparator);
|
||||||
@ -341,7 +337,8 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
|||||||
|
|
||||||
|
|
||||||
List<WidgetsBundle> sysWidgetsBundles = doGetTyped("/api/widgetsBundles?",
|
List<WidgetsBundle> sysWidgetsBundles = doGetTyped("/api/widgetsBundles?",
|
||||||
new TypeReference<>(){});
|
new TypeReference<>() {
|
||||||
|
});
|
||||||
|
|
||||||
List<WidgetsBundle> createdSystemWidgetsBundles = new ArrayList<>();
|
List<WidgetsBundle> createdSystemWidgetsBundles = new ArrayList<>();
|
||||||
for (int i = 0; i < 82; i++) {
|
for (int i = 0; i < 82; i++) {
|
||||||
@ -365,7 +362,8 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<WidgetsBundle> loadedWidgetsBundles = doGetTyped("/api/widgetsBundles?",
|
List<WidgetsBundle> loadedWidgetsBundles = doGetTyped("/api/widgetsBundles?",
|
||||||
new TypeReference<List<WidgetsBundle>>(){});
|
new TypeReference<List<WidgetsBundle>>() {
|
||||||
|
});
|
||||||
|
|
||||||
Collections.sort(widgetsBundles, idComparator);
|
Collections.sort(widgetsBundles, idComparator);
|
||||||
Collections.sort(loadedWidgetsBundles, idComparator);
|
Collections.sort(loadedWidgetsBundles, idComparator);
|
||||||
@ -375,7 +373,8 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
|||||||
loginSysAdmin();
|
loginSysAdmin();
|
||||||
|
|
||||||
loadedWidgetsBundles = doGetTyped("/api/widgetsBundles?",
|
loadedWidgetsBundles = doGetTyped("/api/widgetsBundles?",
|
||||||
new TypeReference<List<WidgetsBundle>>(){});
|
new TypeReference<>() {
|
||||||
|
});
|
||||||
|
|
||||||
Collections.sort(systemWidgetsBundles, idComparator);
|
Collections.sort(systemWidgetsBundles, idComparator);
|
||||||
Collections.sort(loadedWidgetsBundles, idComparator);
|
Collections.sort(loadedWidgetsBundles, idComparator);
|
||||||
@ -388,7 +387,8 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
loadedWidgetsBundles = doGetTyped("/api/widgetsBundles?",
|
loadedWidgetsBundles = doGetTyped("/api/widgetsBundles?",
|
||||||
new TypeReference<>(){});
|
new TypeReference<>() {
|
||||||
|
});
|
||||||
|
|
||||||
Collections.sort(sysWidgetsBundles, idComparator);
|
Collections.sort(sysWidgetsBundles, idComparator);
|
||||||
Collections.sort(loadedWidgetsBundles, idComparator);
|
Collections.sort(loadedWidgetsBundles, idComparator);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user