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);
|
||||
WidgetsBundleId widgetsBundleId = new WidgetsBundleId(toUUID(strWidgetsBundleId));
|
||||
WidgetsBundle widgetsBundle = checkWidgetsBundleId(widgetsBundleId, Operation.DELETE);
|
||||
tbWidgetsBundleService.delete(widgetsBundle);
|
||||
tbWidgetsBundleService.delete(widgetsBundle, getCurrentUser());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "Get Widget Bundles (getWidgetsBundles)",
|
||||
|
||||
@ -17,9 +17,10 @@ package org.thingsboard.server.service.entitiy.widgets.bundle;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
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.edge.EdgeEventActionType;
|
||||
import org.thingsboard.server.common.data.exception.ThingsboardException;
|
||||
import org.thingsboard.server.common.data.audit.ActionType;
|
||||
import org.thingsboard.server.common.data.id.TenantId;
|
||||
import org.thingsboard.server.common.data.widget.WidgetsBundle;
|
||||
import org.thingsboard.server.dao.widget.WidgetsBundleService;
|
||||
import org.thingsboard.server.queue.util.TbCoreComponent;
|
||||
@ -34,17 +35,31 @@ public class DefaultWidgetsBundleService extends AbstractTbEntityService impleme
|
||||
|
||||
@Override
|
||||
public WidgetsBundle save(WidgetsBundle widgetsBundle, User user) throws Exception {
|
||||
WidgetsBundle savedWidgetsBundle = checkNotNull(widgetsBundleService.saveWidgetsBundle(widgetsBundle));
|
||||
autoCommit(user, savedWidgetsBundle.getId());
|
||||
notificationEntityService.notifySendMsgToEdgeService(widgetsBundle.getTenantId(), savedWidgetsBundle.getId(),
|
||||
widgetsBundle.getId() == null ? EdgeEventActionType.ADDED : EdgeEventActionType.UPDATED);
|
||||
return savedWidgetsBundle;
|
||||
ActionType actionType = widgetsBundle.getId() == null ? ActionType.ADDED : ActionType.UPDATED;
|
||||
TenantId tenantId = widgetsBundle.getTenantId();
|
||||
try {
|
||||
WidgetsBundle savedWidgetsBundle = checkNotNull(widgetsBundleService.saveWidgetsBundle(widgetsBundle));
|
||||
autoCommit(user, savedWidgetsBundle.getId());
|
||||
notificationEntityService.notifyCreateOrUpdateOrDelete(tenantId, null, savedWidgetsBundle.getId(),
|
||||
savedWidgetsBundle, user, actionType, true, null);
|
||||
return savedWidgetsBundle;
|
||||
} catch (Exception e) {
|
||||
notificationEntityService.logEntityAction(tenantId, emptyId(EntityType.WIDGETS_BUNDLE), widgetsBundle, actionType, user, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(WidgetsBundle widgetsBundle) throws ThingsboardException {
|
||||
widgetsBundleService.deleteWidgetsBundle(widgetsBundle.getTenantId(), widgetsBundle.getId());
|
||||
notificationEntityService.notifySendMsgToEdgeService(widgetsBundle.getTenantId(), widgetsBundle.getId(),
|
||||
EdgeEventActionType.DELETED);
|
||||
public void delete(WidgetsBundle widgetsBundle, User user) {
|
||||
TenantId tenantId = widgetsBundle.getTenantId();
|
||||
try {
|
||||
widgetsBundleService.deleteWidgetsBundle(widgetsBundle.getTenantId(), widgetsBundle.getId());
|
||||
notificationEntityService.notifyCreateOrUpdateOrDelete(tenantId, null, widgetsBundle.getId(), widgetsBundle,
|
||||
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;
|
||||
|
||||
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.service.entitiy.SimpleTbEntityService;
|
||||
|
||||
public interface TbWidgetsBundleService {
|
||||
|
||||
WidgetsBundle save(WidgetsBundle entity, User currentUser) throws Exception;
|
||||
|
||||
void delete(WidgetsBundle entity) throws ThingsboardException;
|
||||
public interface TbWidgetsBundleService extends SimpleTbEntityService<WidgetsBundle> {
|
||||
}
|
||||
|
||||
@ -614,6 +614,7 @@ audit-log:
|
||||
"device": "${AUDIT_LOG_MASK_DEVICE:W}"
|
||||
"asset": "${AUDIT_LOG_MASK_ASSET:W}"
|
||||
"dashboard": "${AUDIT_LOG_MASK_DASHBOARD:W}"
|
||||
"widgets_bundle": "${AUDIT_LOG_MASK_WIDGETS_BUNDLE:W}"
|
||||
"customer": "${AUDIT_LOG_MASK_CUSTOMER:W}"
|
||||
"user": "${AUDIT_LOG_MASK_USER:W}"
|
||||
"rule_chain": "${AUDIT_LOG_MASK_RULE_CHAIN:W}"
|
||||
|
||||
@ -21,16 +21,15 @@ import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
import org.thingsboard.server.common.data.Customer;
|
||||
import org.thingsboard.server.common.data.StringUtils;
|
||||
import org.thingsboard.server.common.data.Tenant;
|
||||
import org.thingsboard.server.common.data.User;
|
||||
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.PageLink;
|
||||
import org.thingsboard.server.common.data.security.Authority;
|
||||
import org.thingsboard.server.common.data.widget.WidgetsBundle;
|
||||
import org.thingsboard.server.dao.exception.DataValidationException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@ -38,7 +37,6 @@ import java.util.List;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
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 {
|
||||
|
||||
@ -70,7 +68,7 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
||||
public void afterTest() throws Exception {
|
||||
loginSysAdmin();
|
||||
|
||||
doDelete("/api/tenant/"+savedTenant.getId().getId().toString())
|
||||
doDelete("/api/tenant/" + savedTenant.getId().getId().toString())
|
||||
.andExpect(status().isOk());
|
||||
}
|
||||
|
||||
@ -79,14 +77,14 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
||||
WidgetsBundle widgetsBundle = new WidgetsBundle();
|
||||
widgetsBundle.setTitle("My widgets bundle");
|
||||
|
||||
Mockito.reset(tbClusterService);
|
||||
Mockito.reset(tbClusterService, auditLogService);
|
||||
|
||||
WidgetsBundle savedWidgetsBundle = doPost("/api/widgetsBundle", widgetsBundle, WidgetsBundle.class);
|
||||
|
||||
testNotifyManyEntityManyTimeMsgToEdgeServiceEntityEqAny(savedWidgetsBundle, savedWidgetsBundle,
|
||||
savedTenant.getId(), tenantAdmin.getCustomerId(), tenantAdmin.getId(), tenantAdmin.getEmail(),
|
||||
ActionType.ADDED, ActionType.ADDED, 0, 1, 0);
|
||||
Mockito.reset(tbClusterService);
|
||||
testNotifyEntityAllOneTime(savedWidgetsBundle, savedWidgetsBundle.getId(), savedWidgetsBundle.getId(), savedTenant.getId(),
|
||||
tenantAdmin.getCustomerId(), tenantAdmin.getId(), tenantAdmin.getEmail(), ActionType.ADDED);
|
||||
|
||||
Mockito.reset(tbClusterService, auditLogService);
|
||||
|
||||
Assert.assertNotNull(savedWidgetsBundle);
|
||||
Assert.assertNotNull(savedWidgetsBundle.getId());
|
||||
@ -101,25 +99,26 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
||||
WidgetsBundle foundWidgetsBundle = doGet("/api/widgetsBundle/" + savedWidgetsBundle.getId().getId().toString(), WidgetsBundle.class);
|
||||
Assert.assertEquals(foundWidgetsBundle.getTitle(), savedWidgetsBundle.getTitle());
|
||||
|
||||
testNotifyManyEntityManyTimeMsgToEdgeServiceEntityEqAny(savedWidgetsBundle, savedWidgetsBundle,
|
||||
savedTenant.getId(), tenantAdmin.getCustomerId(), tenantAdmin.getId(), tenantAdmin.getEmail(),
|
||||
ActionType.UPDATED, ActionType.UPDATED, 0, 1, 0);
|
||||
testNotifyEntityAllOneTime(savedWidgetsBundle, savedWidgetsBundle.getId(), savedWidgetsBundle.getId(), savedTenant.getId(),
|
||||
tenantAdmin.getCustomerId(), tenantAdmin.getId(), tenantAdmin.getEmail(), ActionType.UPDATED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSaveWidgetBundleWithViolationOfLengthValidation() throws Exception {
|
||||
WidgetsBundle widgetsBundle = new WidgetsBundle();
|
||||
widgetsBundle.setTitle(StringUtils.randomAlphabetic(300));
|
||||
@Test
|
||||
public void testSaveWidgetBundleWithViolationOfLengthValidation() throws Exception {
|
||||
WidgetsBundle widgetsBundle = new WidgetsBundle();
|
||||
widgetsBundle.setTitle(StringUtils.randomAlphabetic(300));
|
||||
|
||||
Mockito.reset(tbClusterService);
|
||||
Mockito.reset(tbClusterService, auditLogService);
|
||||
|
||||
String msgError = msgErrorFieldLength("title");
|
||||
doPost("/api/widgetsBundle", widgetsBundle)
|
||||
.andExpect(status().isBadRequest())
|
||||
.andExpect(statusReason(containsString(msgError)));
|
||||
String msgError = msgErrorFieldLength("title");
|
||||
doPost("/api/widgetsBundle", widgetsBundle)
|
||||
.andExpect(status().isBadRequest())
|
||||
.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
|
||||
public void testUpdateWidgetsBundleFromDifferentTenant() throws Exception {
|
||||
@ -129,7 +128,7 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
||||
|
||||
loginDifferentTenant();
|
||||
|
||||
Mockito.reset(tbClusterService);
|
||||
Mockito.reset(tbClusterService, auditLogService);
|
||||
|
||||
doPost("/api/widgetsBundle", savedWidgetsBundle)
|
||||
.andExpect(status().isForbidden())
|
||||
@ -155,26 +154,25 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
||||
WidgetsBundle widgetsBundle = new WidgetsBundle();
|
||||
widgetsBundle.setTitle("My widgets bundle");
|
||||
|
||||
Mockito.reset(tbClusterService, auditLogService);
|
||||
|
||||
WidgetsBundle savedWidgetsBundle = doPost("/api/widgetsBundle", widgetsBundle, WidgetsBundle.class);
|
||||
|
||||
doDelete("/api/widgetsBundle/"+savedWidgetsBundle.getId().getId().toString())
|
||||
Mockito.reset(tbClusterService, auditLogService);
|
||||
|
||||
doDelete("/api/widgetsBundle/" + savedWidgetsBundle.getId().getId().toString())
|
||||
.andExpect(status().isOk());
|
||||
|
||||
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)
|
||||
.andExpect(status().isNotFound())
|
||||
.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
|
||||
public void testSaveWidgetsBundleWithEmptyTitle() throws Exception {
|
||||
|
||||
Mockito.reset(tbClusterService, auditLogService);
|
||||
|
||||
WidgetsBundle widgetsBundle = new WidgetsBundle();
|
||||
@ -182,7 +180,9 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
||||
.andExpect(status().isBadRequest())
|
||||
.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
|
||||
@ -192,13 +192,14 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
||||
WidgetsBundle savedWidgetsBundle = doPost("/api/widgetsBundle", widgetsBundle, WidgetsBundle.class);
|
||||
savedWidgetsBundle.setAlias("new_alias");
|
||||
|
||||
Mockito.clearInvocations(tbClusterService);
|
||||
Mockito.reset(tbClusterService, auditLogService);
|
||||
|
||||
doPost("/api/widgetsBundle", savedWidgetsBundle)
|
||||
.andExpect(status().isBadRequest())
|
||||
.andExpect(statusReason(containsString("Update of widgets bundle alias is prohibited")));
|
||||
|
||||
testNotifyEntityNever(savedWidgetsBundle.getId(), savedWidgetsBundle);
|
||||
testNotifyEntityEqualsOneTimeServiceNeverError(savedWidgetsBundle, savedTenant.getId(),
|
||||
tenantAdmin.getId(), tenantAdmin.getEmail(), ActionType.UPDATED,
|
||||
new DataValidationException("Update of widgets bundle alias is prohibited!"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -207,22 +208,17 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
||||
login(tenantAdmin.getEmail(), "testPassword1");
|
||||
|
||||
List<WidgetsBundle> sysWidgetsBundles = doGetTyped("/api/widgetsBundles?",
|
||||
new TypeReference<>(){});
|
||||
|
||||
Mockito.reset(tbClusterService);
|
||||
new TypeReference<>() {
|
||||
});
|
||||
|
||||
int cntEntity = 73;
|
||||
List<WidgetsBundle> widgetsBundles = new ArrayList<>();
|
||||
for (int i=0;i<cntEntity;i++) {
|
||||
for (int i = 0; i < cntEntity; i++) {
|
||||
WidgetsBundle widgetsBundle = new WidgetsBundle();
|
||||
widgetsBundle.setTitle("Widgets bundle"+i);
|
||||
widgetsBundle.setTitle("Widgets bundle" + i);
|
||||
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);
|
||||
|
||||
List<WidgetsBundle> loadedWidgetsBundles = new ArrayList<>();
|
||||
@ -230,7 +226,8 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
||||
PageData<WidgetsBundle> pageData;
|
||||
do {
|
||||
pageData = doGetTypedWithPageLink("/api/widgetsBundles?",
|
||||
new TypeReference<>(){}, pageLink);
|
||||
new TypeReference<>() {
|
||||
}, pageLink);
|
||||
loadedWidgetsBundles.addAll(pageData.getData());
|
||||
if (pageData.hasNext()) {
|
||||
pageLink = pageLink.nextPageLink();
|
||||
@ -249,13 +246,14 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
||||
loginSysAdmin();
|
||||
|
||||
List<WidgetsBundle> sysWidgetsBundles = doGetTyped("/api/widgetsBundles?",
|
||||
new TypeReference<>(){});
|
||||
new TypeReference<>() {
|
||||
});
|
||||
|
||||
int cntEntity = 120;
|
||||
List<WidgetsBundle> createdWidgetsBundles = new ArrayList<>();
|
||||
for (int i=0;i<cntEntity;i++) {
|
||||
for (int i = 0; i < cntEntity; i++) {
|
||||
WidgetsBundle widgetsBundle = new WidgetsBundle();
|
||||
widgetsBundle.setTitle("Widgets bundle"+i);
|
||||
widgetsBundle.setTitle("Widgets bundle" + i);
|
||||
createdWidgetsBundles.add(doPost("/api/widgetsBundle", widgetsBundle, WidgetsBundle.class));
|
||||
}
|
||||
|
||||
@ -267,7 +265,8 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
||||
PageData<WidgetsBundle> pageData;
|
||||
do {
|
||||
pageData = doGetTypedWithPageLink("/api/widgetsBundles?",
|
||||
new TypeReference<>(){}, pageLink);
|
||||
new TypeReference<>() {
|
||||
}, pageLink);
|
||||
loadedWidgetsBundles.addAll(pageData.getData());
|
||||
if (pageData.hasNext()) {
|
||||
pageLink = pageLink.nextPageLink();
|
||||
@ -279,22 +278,17 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
||||
|
||||
Assert.assertEquals(widgetsBundles, loadedWidgetsBundles);
|
||||
|
||||
Mockito.reset(tbClusterService);
|
||||
|
||||
for (WidgetsBundle widgetsBundle : createdWidgetsBundles) {
|
||||
doDelete("/api/widgetsBundle/"+widgetsBundle.getId().getId().toString())
|
||||
doDelete("/api/widgetsBundle/" + widgetsBundle.getId().getId().toString())
|
||||
.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);
|
||||
loadedWidgetsBundles.clear();
|
||||
do {
|
||||
pageData = doGetTypedWithPageLink("/api/widgetsBundles?",
|
||||
new TypeReference<PageData<WidgetsBundle>>(){}, pageLink);
|
||||
new TypeReference<PageData<WidgetsBundle>>() {
|
||||
}, pageLink);
|
||||
loadedWidgetsBundles.addAll(pageData.getData());
|
||||
if (pageData.hasNext()) {
|
||||
pageLink = pageLink.nextPageLink();
|
||||
@ -314,19 +308,21 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
||||
login(tenantAdmin.getEmail(), "testPassword1");
|
||||
|
||||
List<WidgetsBundle> sysWidgetsBundles = doGetTyped("/api/widgetsBundles?",
|
||||
new TypeReference<List<WidgetsBundle>>(){});
|
||||
new TypeReference<List<WidgetsBundle>>() {
|
||||
});
|
||||
|
||||
List<WidgetsBundle> widgetsBundles = new ArrayList<>();
|
||||
for (int i=0;i<73;i++) {
|
||||
for (int i = 0; i < 73; i++) {
|
||||
WidgetsBundle widgetsBundle = new WidgetsBundle();
|
||||
widgetsBundle.setTitle("Widgets bundle"+i);
|
||||
widgetsBundle.setTitle("Widgets bundle" + i);
|
||||
widgetsBundles.add(doPost("/api/widgetsBundle", widgetsBundle, WidgetsBundle.class));
|
||||
}
|
||||
|
||||
widgetsBundles.addAll(sysWidgetsBundles);
|
||||
|
||||
List<WidgetsBundle> loadedWidgetsBundles = doGetTyped("/api/widgetsBundles?",
|
||||
new TypeReference<>(){});
|
||||
new TypeReference<>() {
|
||||
});
|
||||
|
||||
Collections.sort(widgetsBundles, idComparator);
|
||||
Collections.sort(loadedWidgetsBundles, idComparator);
|
||||
@ -341,12 +337,13 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
||||
|
||||
|
||||
List<WidgetsBundle> sysWidgetsBundles = doGetTyped("/api/widgetsBundles?",
|
||||
new TypeReference<>(){});
|
||||
new TypeReference<>() {
|
||||
});
|
||||
|
||||
List<WidgetsBundle> createdSystemWidgetsBundles = new ArrayList<>();
|
||||
for (int i=0;i<82;i++) {
|
||||
for (int i = 0; i < 82; i++) {
|
||||
WidgetsBundle widgetsBundle = new WidgetsBundle();
|
||||
widgetsBundle.setTitle("Sys widgets bundle"+i);
|
||||
widgetsBundle.setTitle("Sys widgets bundle" + i);
|
||||
createdSystemWidgetsBundles.add(doPost("/api/widgetsBundle", widgetsBundle, WidgetsBundle.class));
|
||||
}
|
||||
|
||||
@ -358,14 +355,15 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
||||
|
||||
login(tenantAdmin.getEmail(), "testPassword1");
|
||||
|
||||
for (int i=0;i<127;i++) {
|
||||
for (int i = 0; i < 127; i++) {
|
||||
WidgetsBundle widgetsBundle = new WidgetsBundle();
|
||||
widgetsBundle.setTitle("Tenant widgets bundle"+i);
|
||||
widgetsBundle.setTitle("Tenant widgets bundle" + i);
|
||||
widgetsBundles.add(doPost("/api/widgetsBundle", widgetsBundle, WidgetsBundle.class));
|
||||
}
|
||||
|
||||
List<WidgetsBundle> loadedWidgetsBundles = doGetTyped("/api/widgetsBundles?",
|
||||
new TypeReference<List<WidgetsBundle>>(){});
|
||||
new TypeReference<List<WidgetsBundle>>() {
|
||||
});
|
||||
|
||||
Collections.sort(widgetsBundles, idComparator);
|
||||
Collections.sort(loadedWidgetsBundles, idComparator);
|
||||
@ -375,7 +373,8 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
||||
loginSysAdmin();
|
||||
|
||||
loadedWidgetsBundles = doGetTyped("/api/widgetsBundles?",
|
||||
new TypeReference<List<WidgetsBundle>>(){});
|
||||
new TypeReference<>() {
|
||||
});
|
||||
|
||||
Collections.sort(systemWidgetsBundles, idComparator);
|
||||
Collections.sort(loadedWidgetsBundles, idComparator);
|
||||
@ -383,12 +382,13 @@ public abstract class BaseWidgetsBundleControllerTest extends AbstractController
|
||||
Assert.assertEquals(systemWidgetsBundles, loadedWidgetsBundles);
|
||||
|
||||
for (WidgetsBundle widgetsBundle : createdSystemWidgetsBundles) {
|
||||
doDelete("/api/widgetsBundle/"+widgetsBundle.getId().getId().toString())
|
||||
doDelete("/api/widgetsBundle/" + widgetsBundle.getId().getId().toString())
|
||||
.andExpect(status().isOk());
|
||||
}
|
||||
|
||||
loadedWidgetsBundles = doGetTyped("/api/widgetsBundles?",
|
||||
new TypeReference<>(){});
|
||||
new TypeReference<>() {
|
||||
});
|
||||
|
||||
Collections.sort(sysWidgetsBundles, idComparator);
|
||||
Collections.sort(loadedWidgetsBundles, idComparator);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user