TargetType management over common RepositoryManagement (#2581)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -39,6 +39,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
@@ -54,6 +55,8 @@ import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||
import org.eclipse.hawkbit.mgmt.rest.resource.util.ResourceUtility;
|
||||
import org.eclipse.hawkbit.repository.ActionFields;
|
||||
import org.eclipse.hawkbit.repository.Identifiable;
|
||||
import org.eclipse.hawkbit.repository.TargetTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetTypeManagement.Create;
|
||||
import org.eclipse.hawkbit.repository.builder.ActionStatusCreate;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
|
||||
@@ -152,8 +155,7 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
final String knownNameNotModify = "controllerName";
|
||||
final Long unassignTargetTypeValue = -1L;
|
||||
|
||||
final TargetType targetType = targetTypeManagement.create(
|
||||
entityFactory.targetType().create().name("targettype1").description("targettypedes1"));
|
||||
final TargetType targetType = targetTypeManagement.create(Create.builder().name("targettype1").description("targettypedes1").build());
|
||||
|
||||
final String body = new JSONObject().put("targetType", unassignTargetTypeValue).toString();
|
||||
|
||||
@@ -192,8 +194,7 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
final Long unassignTargetTypeValue = -1L;
|
||||
final String controllerNewName = "controllerNewName";
|
||||
|
||||
final TargetType targetType = targetTypeManagement.create(
|
||||
entityFactory.targetType().create().name("targettype1").description("targettypedes1"));
|
||||
final TargetType targetType = targetTypeManagement.create(Create.builder().name("targettype1").description("targettypedes1").build());
|
||||
|
||||
final String body = new JSONObject()
|
||||
.put("targetType", unassignTargetTypeValue).put("name", "controllerNewName")
|
||||
@@ -2077,7 +2078,7 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$", Matchers.hasSize(0)));
|
||||
|
||||
final List<TargetTag> targetTags = testdataFactory.createTargetTags(2, "tag_getControllerTagReturnsTagWithOk");
|
||||
final List<? extends TargetTag> targetTags = testdataFactory.createTargetTags(2, "tag_getControllerTagReturnsTagWithOk");
|
||||
final List<String> tagNames = new ArrayList<>();
|
||||
for (final TargetTag targetTag : targetTags) {
|
||||
targetManagement.assignTag(Collections.singletonList(target.getControllerId()), targetTag.getId());
|
||||
@@ -2459,10 +2460,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
*/
|
||||
@Test
|
||||
void createTargetsWithTargetType() throws Exception {
|
||||
final TargetType type1 = testdataFactory.createTargetType("typeWithDs",
|
||||
Collections.singletonList(standardDsType));
|
||||
final TargetType type2 = testdataFactory.createTargetType("typeWithOutDs",
|
||||
Collections.singletonList(standardDsType));
|
||||
final TargetType type1 = testdataFactory.createTargetType("typeWithDs", Set.of(standardDsType));
|
||||
final TargetType type2 = testdataFactory.createTargetType("typeWithOutDs", Set.of(standardDsType));
|
||||
|
||||
final Target test1 = entityFactory.target().create().controllerId("id1").name("targetWithoutType")
|
||||
.securityToken("token").address("amqp://test123/foobar").description("testid1").build();
|
||||
@@ -2531,7 +2530,7 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
@Test
|
||||
void createTargetWithExistingTargetType() throws Exception {
|
||||
// create target type
|
||||
final List<TargetType> targetTypes = testdataFactory.createTargetTypes("targettype", 1);
|
||||
final List<? extends TargetType> targetTypes = testdataFactory.createTargetTypes("targettype", 1);
|
||||
assertThat(targetTypes).hasSize(1);
|
||||
|
||||
final Target target = entityFactory.target().create().controllerId("targetcontroller").name("testtarget")
|
||||
@@ -2556,7 +2555,7 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
@Test
|
||||
void updateTargetTypeInTarget() throws Exception {
|
||||
// create target type
|
||||
final List<TargetType> targetTypes = testdataFactory.createTargetTypes("targettype", 2);
|
||||
final List<? extends TargetType> targetTypes = testdataFactory.createTargetTypes("targettype", 2);
|
||||
assertThat(targetTypes).hasSize(2);
|
||||
|
||||
final String controllerId = "targetcontroller";
|
||||
@@ -2581,10 +2580,9 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
@Test
|
||||
void addingNonExistingTargetTypeInTargetShouldFail() throws Exception {
|
||||
final long unknownTargetTypeId = 999;
|
||||
final String errorMsg = String.format("TargetType with given identifier {%s} does not exist.",
|
||||
unknownTargetTypeId);
|
||||
final String errorMsg = String.format("TargetType with given identifier {%s} does not exist.", unknownTargetTypeId);
|
||||
|
||||
final Optional<TargetType> targetType = targetTypeManagement.get(unknownTargetTypeId);
|
||||
final Optional<? extends TargetType> targetType = targetTypeManagement.get(unknownTargetTypeId);
|
||||
assertThat(targetType).isNotPresent();
|
||||
|
||||
final String controllerId = "targetcontroller";
|
||||
@@ -2664,7 +2662,7 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
@Test
|
||||
void unassignTargetTypeFromTarget() throws Exception {
|
||||
// create target type
|
||||
final List<TargetType> targetTypes = testdataFactory.createTargetTypes("targettype", 1);
|
||||
final List<? extends TargetType> targetTypes = testdataFactory.createTargetTypes("targettype", 1);
|
||||
assertThat(targetTypes).hasSize(1);
|
||||
|
||||
final String targetControllerId = "targetcontroller";
|
||||
@@ -2686,7 +2684,7 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
void invalidRequestsOnTargetTypeResource() throws Exception {
|
||||
final String knownTargetId = "targetId";
|
||||
testdataFactory.createTarget(knownTargetId);
|
||||
testdataFactory.createTargetType("targettype", Collections.emptyList());
|
||||
testdataFactory.createTargetType("targettype", Set.of());
|
||||
|
||||
// GET is not allowed
|
||||
mvc.perform(get(
|
||||
|
||||
@@ -66,7 +66,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
@Test
|
||||
@ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 2) })
|
||||
public void getTargetTags() throws Exception {
|
||||
final List<TargetTag> tags = testdataFactory.createTargetTags(2, "");
|
||||
final List<? extends TargetTag> tags = testdataFactory.createTargetTags(2, "");
|
||||
final TargetTag assigned = tags.get(0);
|
||||
final TargetTag unassigned = tags.get(1);
|
||||
|
||||
@@ -105,7 +105,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
testdataFactory.createTarget(controllerId1);
|
||||
testdataFactory.createTarget(controllerId2);
|
||||
|
||||
final List<TargetTag> tags = testdataFactory.createTargetTags(2, "");
|
||||
final List<? extends TargetTag> tags = testdataFactory.createTargetTags(2, "");
|
||||
final TargetTag tag1 = tags.get(0);
|
||||
final TargetTag tag2 = tags.get(1);
|
||||
|
||||
@@ -133,7 +133,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
@Test
|
||||
@ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 2) })
|
||||
public void getTargetTag() throws Exception {
|
||||
final List<TargetTag> tags = testdataFactory.createTargetTags(2, "");
|
||||
final List<? extends TargetTag> tags = testdataFactory.createTargetTags(2, "");
|
||||
final TargetTag assigned = tags.get(0);
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/" + assigned.getId())
|
||||
@@ -190,7 +190,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetTagUpdatedEvent.class, count = 1) })
|
||||
public void updateTargetTag() throws Exception {
|
||||
final List<TargetTag> tags = testdataFactory.createTargetTags(1, "");
|
||||
final List<? extends TargetTag> tags = testdataFactory.createTargetTags(1, "");
|
||||
final TargetTag original = tags.get(0);
|
||||
|
||||
final TargetTagManagement.Update update = TargetTagManagement.Update.builder()
|
||||
@@ -222,7 +222,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetTagDeletedEvent.class, count = 1) })
|
||||
public void deleteTargetTag() throws Exception {
|
||||
final List<TargetTag> tags = testdataFactory.createTargetTags(1, "");
|
||||
final List<? extends TargetTag> tags = testdataFactory.createTargetTags(1, "");
|
||||
final TargetTag original = tags.get(0);
|
||||
|
||||
mvc.perform(delete(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/" + original.getId()))
|
||||
|
||||
@@ -28,12 +28,14 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.jayway.jsonpath.JsonPath;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||
import org.eclipse.hawkbit.repository.builder.TargetTypeCreate;
|
||||
import org.eclipse.hawkbit.repository.TargetTypeManagement.Create;
|
||||
import org.eclipse.hawkbit.repository.TargetTypeManagement.Update;
|
||||
import org.eclipse.hawkbit.repository.exception.AssignmentQuotaExceededException;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
@@ -115,7 +117,7 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
void getTargetTypes() throws Exception {
|
||||
String typeName = "TestTypeGET";
|
||||
int count = 5;
|
||||
List<TargetType> testTypes = createTestTargetTypesInDB(typeName, count);
|
||||
final List<? extends TargetType> testTypes = createTestTargetTypesInDB(typeName, count);
|
||||
|
||||
ResultActions resultActions = mvc.perform(get(TARGETTYPES_ENDPOINT).accept(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print());
|
||||
@@ -178,7 +180,7 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
TargetType testTypeA = createTestTargetTypeInDB(typeNameA);
|
||||
|
||||
testTypeA = targetTypeManagement
|
||||
.update(entityFactory.targetType().update(testTypeA.getId()).description("Updated description"));
|
||||
.update(Update.builder().id(testTypeA.getId()).description("Updated description").build());
|
||||
|
||||
// descending
|
||||
mvc.perform(get(TARGETTYPES_ENDPOINT).accept(MediaType.APPLICATION_JSON)
|
||||
@@ -303,8 +305,9 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
final String initialTypeName = "TestTypeGET";
|
||||
TargetType testType = createTestTargetTypeInDB(initialTypeName);
|
||||
final String typeNameUpdated = "TestTypeGETupdated";
|
||||
testType = targetTypeManagement.update(entityFactory.targetType().update(testType.getId()).name(typeNameUpdated)
|
||||
.description("Updated Description").colour("#ffffff"));
|
||||
testType = targetTypeManagement.update(Update.builder().id(testType.getId())
|
||||
.name(typeNameUpdated).description("Updated Description").colour("#ffffff")
|
||||
.build());
|
||||
|
||||
mvc.perform(get(TARGETTYPE_SINGLE_ENDPOINT, testType.getId()).accept(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -328,7 +331,7 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
@WithUser(principal = TEST_USER, allSpPermissions = true)
|
||||
void createTargetTypes() throws Exception {
|
||||
String typeName = "TestTypePOST";
|
||||
final List<TargetType> types = buildTestTargetTypesWithoutDsTypes(typeName, 5);
|
||||
final List<Create> types = buildTestTargetTypesWithoutDsTypes(typeName, 5);
|
||||
|
||||
runPostTargetTypeAndVerify(types);
|
||||
}
|
||||
@@ -351,7 +354,7 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
testType = targetTypeManagement.get(testType.getId()).get();
|
||||
assertThat(testType.getLastModifiedBy()).isEqualTo(TEST_USER);
|
||||
assertThat(testType.getOptLockRevision()).isEqualTo(2);
|
||||
assertThat(testType.getCompatibleDistributionSetTypes()).containsExactly(standardDsType);
|
||||
assertThat(testType.getDistributionSetTypes()).containsExactly(standardDsType);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -361,7 +364,7 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
@WithUser(principal = TEST_USER, allSpPermissions = true)
|
||||
void getDistributionSetsOfTargetType() throws Exception {
|
||||
String typeName = "TestTypeGetDs";
|
||||
final TargetType testType = createTestTargetTypeInDB(typeName, Collections.singletonList(standardDsType));
|
||||
final TargetType testType = createTestTargetTypeInDB(typeName, Set.of(standardDsType));
|
||||
|
||||
mvc.perform(get(TARGETTYPE_DSTYPES_ENDPOINT, testType.getId()).accept(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -397,7 +400,7 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
@WithUser(principal = TEST_USER, allSpPermissions = true)
|
||||
void removeDsTypeFromTargetType() throws Exception {
|
||||
String typeName = "TestTypeRemoveDs";
|
||||
TargetType testType = createTestTargetTypeInDB(typeName, Collections.singletonList(standardDsType));
|
||||
TargetType testType = createTestTargetTypeInDB(typeName, Set.of(standardDsType));
|
||||
|
||||
mvc.perform(delete(TARGETTYPE_DSTYPE_SINGLE_ENDPOINT, testType.getId(), standardDsType.getId())
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
@@ -407,7 +410,7 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
testType = targetTypeManagement.get(testType.getId()).get();
|
||||
assertThat(testType.getLastModifiedBy()).isEqualTo(TEST_USER);
|
||||
assertThat(testType.getOptLockRevision()).isEqualTo(2);
|
||||
assertThat(testType.getCompatibleDistributionSetTypes()).isEmpty();
|
||||
assertThat(testType.getDistributionSetTypes()).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -416,8 +419,8 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
@Test
|
||||
@WithUser(principal = TEST_USER, allSpPermissions = true)
|
||||
void deletingDsTypeRemovesAssignmentFromTargetType() throws Exception {
|
||||
TargetType testType = createTestTargetTypeInDB("TestTypeRemoveDs", Collections.singletonList(standardDsType));
|
||||
assertThat(testType.getCompatibleDistributionSetTypes()).hasSize(1);
|
||||
TargetType testType = createTestTargetTypeInDB("TestTypeRemoveDs", Set.of(standardDsType));
|
||||
assertThat(testType.getDistributionSetTypes()).hasSize(1);
|
||||
assertThat(distributionSetTypeManagement.findByKey(standardDsType.getKey())).isNotEmpty();
|
||||
|
||||
mvc.perform(delete(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/" + standardDsType.getId()))
|
||||
@@ -427,7 +430,7 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
testType = targetTypeManagement.get(testType.getId()).get();
|
||||
assertThat(testType.getLastModifiedBy()).isEqualTo(TEST_USER);
|
||||
assertThat(testType.getOptLockRevision()).isEqualTo(2);
|
||||
assertThat(testType.getCompatibleDistributionSetTypes()).isEmpty();
|
||||
assertThat(testType.getDistributionSetTypes()).isEmpty();
|
||||
assertThat(distributionSetTypeManagement.findByKey(standardDsType.getKey())).isEmpty();
|
||||
}
|
||||
|
||||
@@ -508,7 +511,7 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
@Test
|
||||
void invalidRequestsOnTargetTypesResource() throws Exception {
|
||||
String typeName = "TestTypeInvalidReq";
|
||||
final TargetType testType = createTestTargetTypeInDB(typeName, Collections.singletonList(standardDsType));
|
||||
final TargetType testType = createTestTargetTypeInDB(typeName, Set.of(standardDsType));
|
||||
|
||||
// target type does not exist
|
||||
mvc.perform(get(TARGETTYPE_SINGLE_ENDPOINT, 12345678))
|
||||
@@ -522,8 +525,7 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
.andExpect(status().isNotFound());
|
||||
|
||||
// target types at creation time invalid
|
||||
final TargetType testNewType = createTestTargetTypeInDB(typeName + "Another",
|
||||
Collections.singletonList(standardDsType));
|
||||
final TargetType testNewType = createTestTargetTypeInDB(typeName + "Another", Set.of(standardDsType));
|
||||
|
||||
mvc.perform(post(TARGETTYPES_ENDPOINT).content(JsonBuilder.targetTypes(Collections.singletonList(testNewType)))
|
||||
.contentType(MediaType.APPLICATION_OCTET_STREAM))
|
||||
@@ -547,9 +549,8 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isBadRequest());
|
||||
|
||||
final TargetType tooLongName = entityFactory.targetType().create()
|
||||
.name(randomString(NamedEntity.NAME_MAX_SIZE + 1)).build();
|
||||
mvc.perform(post(TARGETTYPES_ENDPOINT).content(JsonBuilder.targetTypes(Collections.singletonList(tooLongName)))
|
||||
final Create tooLongName = Create.builder().name(randomString(NamedEntity.NAME_MAX_SIZE + 1)).build();
|
||||
mvc.perform(post(TARGETTYPES_ENDPOINT).content(JsonBuilder.targetTypesCreate(List.of(tooLongName)))
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isBadRequest());
|
||||
@@ -609,8 +610,8 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
*/
|
||||
@Test
|
||||
void searchTargetTypeRsql() throws Exception {
|
||||
targetTypeManagement.create(entityFactory.targetType().create().name("TestName123"));
|
||||
targetTypeManagement.create(entityFactory.targetType().create().name("TestName1234"));
|
||||
targetTypeManagement.create(Create.builder().name("TestName123").build());
|
||||
targetTypeManagement.create(Create.builder().name("TestName1234").build());
|
||||
|
||||
final String rsqlFindLikeDs1OrDs2 = "name==TestName123,name==TestName1234";
|
||||
|
||||
@@ -656,45 +657,46 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
.andExpect(jsonPath("$.errorCode", equalTo(SpServerError.SP_QUOTA_EXCEEDED.getKey())));
|
||||
}
|
||||
|
||||
private TargetType buildTestTargetTypeBody(String name) {
|
||||
return prepareTestTargetType(name, null).build();
|
||||
private Create buildTestTargetTypeBody(final String name) {
|
||||
return prepareTestTargetType(name, null);
|
||||
}
|
||||
|
||||
private TargetTypeCreate prepareTestTargetType(String name, Collection<DistributionSetType> dsTypes) {
|
||||
TargetTypeCreate create = entityFactory.targetType().create().name(name)
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
private Create prepareTestTargetType(final String name, final Collection<DistributionSetType> dsTypes) {
|
||||
final Create.CreateBuilder create = Create.builder().name(name)
|
||||
.description("Description of the test type").colour("#aaaaaa");
|
||||
if (dsTypes != null && !dsTypes.isEmpty()) {
|
||||
create.compatible(Collections.singletonList(standardDsType.getId()));
|
||||
create.distributionSetTypes(Set.of(standardDsType.getId()));
|
||||
}
|
||||
return create;
|
||||
return create.build();
|
||||
}
|
||||
|
||||
private List<TargetType> createTestTargetTypesInDB(String namePrefix, int count) {
|
||||
private List<? extends TargetType> createTestTargetTypesInDB(final String namePrefix, final int count) {
|
||||
return testdataFactory.createTargetTypes(namePrefix, count);
|
||||
}
|
||||
|
||||
private TargetType createTestTargetTypeInDB(String name) {
|
||||
private TargetType createTestTargetTypeInDB(final String name) {
|
||||
return testdataFactory.findOrCreateTargetType(name);
|
||||
}
|
||||
|
||||
private TargetType createTestTargetTypeInDB(String name, List<DistributionSetType> dsTypes) {
|
||||
private TargetType createTestTargetTypeInDB(final String name, final Set<DistributionSetType> dsTypes) {
|
||||
TargetType targetType = testdataFactory.createTargetType(name, dsTypes);
|
||||
assertThat(targetType.getOptLockRevision()).isEqualTo(1);
|
||||
return targetType;
|
||||
}
|
||||
|
||||
private List<TargetType> buildTestTargetTypesWithoutDsTypes(String namePrefix, int count) {
|
||||
final List<TargetType> types = new ArrayList<>();
|
||||
private List<Create> buildTestTargetTypesWithoutDsTypes(final String namePrefix, final int count) {
|
||||
final List<Create> types = new ArrayList<>();
|
||||
for (int index = 0; index < count; index++) {
|
||||
types.add(buildTestTargetTypeBody(namePrefix + index));
|
||||
}
|
||||
return types;
|
||||
}
|
||||
|
||||
private void runPostTargetTypeAndVerify(final List<TargetType> types) throws Exception {
|
||||
private void runPostTargetTypeAndVerify(final List<Create> types) throws Exception {
|
||||
int size = types.size();
|
||||
ResultActions resultActions = mvc
|
||||
.perform(post(TARGETTYPES_ENDPOINT).content(JsonBuilder.targetTypes(types))
|
||||
.perform(post(TARGETTYPES_ENDPOINT).content(JsonBuilder.targetTypesCreate(types))
|
||||
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user