JPA Refactoring (2) (#2108)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -80,7 +80,7 @@ public class MgmtBasicAuthResourceTest {
|
||||
@Autowired
|
||||
MockMvc defaultMock;
|
||||
private static final String TEST_USER = "testUser";
|
||||
private static final String DEFAULT = "default";
|
||||
private static final String DEFAULT_TENANT = "DEFAULT";
|
||||
|
||||
@Test
|
||||
@Description("Test of userinfo api with basic auth validation")
|
||||
@@ -92,7 +92,7 @@ public class MgmtBasicAuthResourceTest {
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentType(MediaTypes.HAL_JSON_VALUE))
|
||||
.andExpect(jsonPath("$.username", equalTo(TEST_USER)))
|
||||
.andExpect(jsonPath("$.tenant", equalTo(DEFAULT)));
|
||||
.andExpect(jsonPath("$.tenant", equalTo(DEFAULT_TENANT)));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -61,7 +61,8 @@ public class MgmtDistributionSetTagResourceTest extends AbstractManagementApiInt
|
||||
|
||||
@Test
|
||||
@Description("Verfies that a paged result list of DS tags reflects the content on the repository side.")
|
||||
@ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 2) })
|
||||
@ExpectEvents({
|
||||
@Expect(type = DistributionSetTagCreatedEvent.class, count = 2) })
|
||||
public void getDistributionSetTags() throws Exception {
|
||||
final List<DistributionSetTag> tags = testdataFactory.createDistributionSetTags(2);
|
||||
final DistributionSetTag assigned = tags.get(0);
|
||||
@@ -161,7 +162,8 @@ public class MgmtDistributionSetTagResourceTest extends AbstractManagementApiInt
|
||||
|
||||
@Test
|
||||
@Description("Verfies that a single result of a DS tag reflects the content on the repository side.")
|
||||
@ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 2) })
|
||||
@ExpectEvents({
|
||||
@Expect(type = DistributionSetTagCreatedEvent.class, count = 2) })
|
||||
public void getDistributionSetTag() throws Exception {
|
||||
final List<DistributionSetTag> tags = testdataFactory.createDistributionSetTags(2);
|
||||
final DistributionSetTag assigned = tags.get(0);
|
||||
@@ -179,7 +181,8 @@ public class MgmtDistributionSetTagResourceTest extends AbstractManagementApiInt
|
||||
|
||||
@Test
|
||||
@Description("Verifies that created DS tags are stored in the repository as send to the API.")
|
||||
@ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 2) })
|
||||
@ExpectEvents({
|
||||
@Expect(type = DistributionSetTagCreatedEvent.class, count = 2) })
|
||||
public void createDistributionSetTags() throws Exception {
|
||||
final Tag tagOne = entityFactory.tag().create().colour("testcol1").description("its a test1").name("thetest1")
|
||||
.build();
|
||||
@@ -209,7 +212,8 @@ public class MgmtDistributionSetTagResourceTest extends AbstractManagementApiInt
|
||||
|
||||
@Test
|
||||
@Description("Verifies that an updated DS tag is stored in the repository as send to the API.")
|
||||
@ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
|
||||
@ExpectEvents({
|
||||
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetTagUpdatedEvent.class, count = 1) })
|
||||
public void updateDistributionSetTag() throws Exception {
|
||||
final List<DistributionSetTag> tags = testdataFactory.createDistributionSetTags(1);
|
||||
@@ -237,7 +241,8 @@ public class MgmtDistributionSetTagResourceTest extends AbstractManagementApiInt
|
||||
|
||||
@Test
|
||||
@Description("Verfies that the delete call is reflected by the repository.")
|
||||
@ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
|
||||
@ExpectEvents({
|
||||
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetTagDeletedEvent.class, count = 1) })
|
||||
public void deleteDistributionSetTag() throws Exception {
|
||||
final List<DistributionSetTag> tags = testdataFactory.createDistributionSetTags(1);
|
||||
@@ -252,7 +257,8 @@ public class MgmtDistributionSetTagResourceTest extends AbstractManagementApiInt
|
||||
|
||||
@Test
|
||||
@Description("Ensures that assigned DS to tag in repository are listed with proper paging results.")
|
||||
@ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
|
||||
@ExpectEvents({
|
||||
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 5),
|
||||
@Expect(type = DistributionSetUpdatedEvent.class, count = 5) })
|
||||
public void getAssignedDistributionSets() throws Exception {
|
||||
@@ -271,7 +277,8 @@ public class MgmtDistributionSetTagResourceTest extends AbstractManagementApiInt
|
||||
|
||||
@Test
|
||||
@Description("Ensures that assigned DS to tag in repository are listed with proper paging results with paging limit parameter.")
|
||||
@ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
|
||||
@ExpectEvents({
|
||||
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 5),
|
||||
@Expect(type = DistributionSetUpdatedEvent.class, count = 5) })
|
||||
public void getAssignedDistributionSetsWithPagingLimitRequestParameter() throws Exception {
|
||||
@@ -292,7 +299,8 @@ public class MgmtDistributionSetTagResourceTest extends AbstractManagementApiInt
|
||||
|
||||
@Test
|
||||
@Description("Ensures that assigned DS to tag in repository are listed with proper paging results with paging limit and offset parameter.")
|
||||
@ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
|
||||
@ExpectEvents({
|
||||
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 5),
|
||||
@Expect(type = DistributionSetUpdatedEvent.class, count = 5) })
|
||||
public void getAssignedDistributionSetsWithPagingLimitAndOffsetRequestParameter() throws Exception {
|
||||
@@ -316,7 +324,8 @@ public class MgmtDistributionSetTagResourceTest extends AbstractManagementApiInt
|
||||
|
||||
@Test
|
||||
@Description("Verfies that tag assignments done through toggle API command are correctly assigned or unassigned.")
|
||||
@ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
|
||||
@ExpectEvents({
|
||||
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 2),
|
||||
@Expect(type = DistributionSetUpdatedEvent.class, count = 4) })
|
||||
public void toggleTagAssignment() throws Exception {
|
||||
@@ -390,7 +399,8 @@ public class MgmtDistributionSetTagResourceTest extends AbstractManagementApiInt
|
||||
|
||||
@Test
|
||||
@Description("Verifies that tag unassignments done through tag API command are correctly stored in the repository.")
|
||||
@ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
|
||||
@ExpectEvents({
|
||||
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 2),
|
||||
@Expect(type = DistributionSetUpdatedEvent.class, count = 3) })
|
||||
public void unassignDistributionSet() throws Exception {
|
||||
|
||||
@@ -68,7 +68,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
|
||||
@Test
|
||||
@Description("Verfies that a paged result list of target tags reflects the content on the repository side.")
|
||||
@ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 2) })
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 2) })
|
||||
public void getTargetTags() throws Exception {
|
||||
final List<TargetTag> tags = testdataFactory.createTargetTags(2, "");
|
||||
final TargetTag assigned = tags.get(0);
|
||||
@@ -131,7 +132,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
|
||||
@Test
|
||||
@Description("Verfies that a single result of a target tag reflects the content on the repository side.")
|
||||
@ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 2) })
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 2) })
|
||||
public void getTargetTag() throws Exception {
|
||||
final List<TargetTag> tags = testdataFactory.createTargetTags(2, "");
|
||||
final TargetTag assigned = tags.get(0);
|
||||
@@ -150,7 +152,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
|
||||
@Test
|
||||
@Description("Verifies that created target tags are stored in the repository as send to the API.")
|
||||
@ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 2) })
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 2) })
|
||||
public void createTargetTags() throws Exception {
|
||||
final Tag tagOne = entityFactory.tag().create().colour("testcol1").description("its a test1").name("thetest1")
|
||||
.build();
|
||||
@@ -180,7 +183,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
|
||||
@Test
|
||||
@Description("Verifies that an updated target tag is stored in the repository as send to the API.")
|
||||
@ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetTagUpdatedEvent.class, count = 1) })
|
||||
public void updateTargetTag() throws Exception {
|
||||
final List<TargetTag> tags = testdataFactory.createTargetTags(1, "");
|
||||
@@ -208,7 +212,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
|
||||
@Test
|
||||
@Description("Verfies that the delete call is reflected by the repository.")
|
||||
@ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetTagDeletedEvent.class, count = 1) })
|
||||
public void deleteTargetTag() throws Exception {
|
||||
final List<TargetTag> tags = testdataFactory.createTargetTags(1, "");
|
||||
@@ -223,8 +228,10 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
|
||||
@Test
|
||||
@Description("Ensures that assigned targets to tag in repository are listed with proper paging results.")
|
||||
@ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetCreatedEvent.class, count = 5), @Expect(type = TargetUpdatedEvent.class, count = 5) })
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetCreatedEvent.class, count = 5),
|
||||
@Expect(type = TargetUpdatedEvent.class, count = 5) })
|
||||
public void getAssignedTargets() throws Exception {
|
||||
final TargetTag tag = testdataFactory.createTargetTags(1, "").get(0);
|
||||
final int targetsAssigned = 5;
|
||||
@@ -241,8 +248,10 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
|
||||
@Test
|
||||
@Description("Ensures that assigned DS to tag in repository are listed with proper paging results with paging limit parameter.")
|
||||
@ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetCreatedEvent.class, count = 5), @Expect(type = TargetUpdatedEvent.class, count = 5) })
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetCreatedEvent.class, count = 5),
|
||||
@Expect(type = TargetUpdatedEvent.class, count = 5) })
|
||||
public void getAssignedTargetsWithPagingLimitRequestParameter() throws Exception {
|
||||
final TargetTag tag = testdataFactory.createTargetTags(1, "").get(0);
|
||||
final int targetsAssigned = 5;
|
||||
@@ -261,8 +270,10 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
|
||||
@Test
|
||||
@Description("Ensures that assigned targets to tag in repository are listed with proper paging results with paging limit and offset parameter.")
|
||||
@ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetCreatedEvent.class, count = 5), @Expect(type = TargetUpdatedEvent.class, count = 5) })
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetCreatedEvent.class, count = 5),
|
||||
@Expect(type = TargetUpdatedEvent.class, count = 5) })
|
||||
public void getAssignedTargetsWithPagingLimitAndOffsetRequestParameter() throws Exception {
|
||||
final TargetTag tag = testdataFactory.createTargetTags(1, "").get(0);
|
||||
final int targetsAssigned = 5;
|
||||
@@ -612,8 +623,10 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
// DEPRECATED scenarios
|
||||
@Test
|
||||
@Description("Verifes that tag assignments done through toggle API command are correctly assigned or unassigned.")
|
||||
@ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetCreatedEvent.class, count = 2), @Expect(type = TargetUpdatedEvent.class, count = 4) })
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetCreatedEvent.class, count = 2),
|
||||
@Expect(type = TargetUpdatedEvent.class, count = 4) })
|
||||
public void toggleTagAssignment() throws Exception {
|
||||
final TargetTag tag = testdataFactory.createTargetTags(1, "").get(0);
|
||||
final int targetsAssigned = 2;
|
||||
@@ -641,8 +654,10 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
|
||||
@Test
|
||||
@Description("Verfies that tag assignments done through tag API command are correctly stored in the repository.")
|
||||
@ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetCreatedEvent.class, count = 2), @Expect(type = TargetUpdatedEvent.class, count = 2) })
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetCreatedEvent.class, count = 2),
|
||||
@Expect(type = TargetUpdatedEvent.class, count = 2) })
|
||||
public void assignTargetsByRequestBody() throws Exception {
|
||||
final TargetTag tag = testdataFactory.createTargetTags(1, "").get(0);
|
||||
final int targetsAssigned = 2;
|
||||
|
||||
Reference in New Issue
Block a user