Fix RSQL filter in batch update query in assign target group (#3107)
* Fix RSQL filter in batch update query in assign target group Signed-off-by: strailov <Stanislav.Trailov@bosch.io> * Stick with old approach when using hibernate Signed-off-by: strailov <Stanislav.Trailov@bosch.io> * avoid fully qualified classname Signed-off-by: strailov <Stanislav.Trailov@bosch.io> * Refer review changes Signed-off-by: strailov <Stanislav.Trailov@bosch.io> * add link to the bug reported to eclipse link Signed-off-by: strailov <Stanislav.Trailov@bosch.io> --------- Signed-off-by: strailov <Stanislav.Trailov@bosch.io>
This commit is contained in:
committed by
GitHub
parent
b0e279a3e8
commit
794455064f
@@ -22,6 +22,8 @@ import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetGroupRestApi;
|
||||
import org.eclipse.hawkbit.repository.TargetTagManagement;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.http.MediaType;
|
||||
@@ -229,4 +231,30 @@ public class MgmtTargetGroupResourceTest extends AbstractManagementApiIntegratio
|
||||
.andExpect(jsonPath("content.[1].controllerId", Matchers.equalTo("target2")))
|
||||
.andExpect(jsonPath("content.[2].controllerId", Matchers.equalTo("target3")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldAssignGroupToTargetsFilteredByTagNotEqual() throws Exception {
|
||||
targetManagement.create(builder().controllerId("target1").build());
|
||||
targetManagement.create(builder().controllerId("target2").build());
|
||||
targetManagement.create(builder().controllerId("target3").build());
|
||||
|
||||
final TargetTag tag1 = targetTagManagement.create(TargetTagManagement.Create.builder().name("tag1").build());
|
||||
final TargetTag tag2 = targetTagManagement.create(TargetTagManagement.Create.builder().name("tag2").build());
|
||||
|
||||
targetManagement.assignTag(List.of("target1"), tag1.getId());
|
||||
targetManagement.assignTag(List.of("target2"), tag1.getId());
|
||||
targetManagement.assignTag(List.of("target3"), tag2.getId());
|
||||
|
||||
mvc.perform(put(MgmtTargetGroupRestApi.TARGETGROUPS_V1 + "/FilteredGroup")
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.param("q", "tag!=tag1"))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
mvc.perform(get(MgmtTargetGroupRestApi.TARGETGROUPS_V1 + "/FilteredGroup/assigned")
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "ID:ASC")
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("content", Matchers.hasSize(1)))
|
||||
.andExpect(jsonPath("content.[0].controllerId", Matchers.equalTo("target3")));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user