Fix new line after @Test (#2486)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -34,7 +34,8 @@ class DdiActionFeedbackTest {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model with minimal payload
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObjectWithoutOptionalValues() throws IOException {
|
||||
@Test
|
||||
void shouldSerializeAndDeserializeObjectWithoutOptionalValues() throws IOException {
|
||||
// Setup
|
||||
final DdiStatus ddiStatus = new DdiStatus(DdiStatus.ExecutionStatus.CLOSED, null, null, Collections.emptyList());
|
||||
final DdiActionFeedback ddiActionFeedback = new DdiActionFeedback(ddiStatus);
|
||||
@@ -50,7 +51,8 @@ class DdiActionFeedbackTest {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model with all values provided
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObjectWithOptionalValues() throws IOException {
|
||||
@Test
|
||||
void shouldSerializeAndDeserializeObjectWithOptionalValues() throws IOException {
|
||||
// Setup
|
||||
final Long timestamp = System.currentTimeMillis();
|
||||
final DdiResult ddiResult = new DdiResult(DdiResult.FinalResult.SUCCESS, new DdiProgress(10, 10));
|
||||
@@ -68,7 +70,8 @@ class DdiActionFeedbackTest {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
@Test
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiActionFeedback = """
|
||||
{
|
||||
@@ -87,7 +90,8 @@ class DdiActionFeedbackTest {
|
||||
/**
|
||||
* Verify that deserialization works if optional fields are not parsed
|
||||
*/
|
||||
@Test void shouldConvertItWithoutOptionalFieldTimestamp() throws JsonProcessingException {
|
||||
@Test
|
||||
void shouldConvertItWithoutOptionalFieldTimestamp() throws JsonProcessingException {
|
||||
// Setup
|
||||
final String serializedDdiActionFeedback = """
|
||||
{
|
||||
|
||||
@@ -34,7 +34,8 @@ class DdiActionHistoryTest {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
@Test
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final String actionStatus = "TestAction";
|
||||
final List<String> messages = Arrays.asList("Action status message 1", "Action status message 2");
|
||||
@@ -50,7 +51,8 @@ class DdiActionHistoryTest {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
@Test
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiActionHistory = """
|
||||
{
|
||||
@@ -67,7 +69,8 @@ class DdiActionHistoryTest {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
@Test
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiActionFeedback = """
|
||||
{
|
||||
|
||||
@@ -32,7 +32,8 @@ class DdiArtifactHashTest {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
@Test
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final String sha1Hash = "11111";
|
||||
final String md5Hash = "22222";
|
||||
@@ -51,7 +52,8 @@ class DdiArtifactHashTest {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
@Test
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiArtifact = "{\"sha1\": \"123\", \"md5\": \"456\", \"sha256\": \"789\", \"unknownProperty\": \"test\"}";
|
||||
|
||||
@@ -65,7 +67,8 @@ class DdiArtifactHashTest {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
@Test
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiArtifact = "{\"sha1\": [123], \"md5\": 456, \"sha256\": \"789\"";
|
||||
|
||||
|
||||
@@ -32,7 +32,8 @@ class DdiArtifactTest {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
@Test
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final String filename = "testfile.txt";
|
||||
final DdiArtifactHash hashes = new DdiArtifactHash("123", "456", "789");
|
||||
@@ -54,7 +55,8 @@ class DdiArtifactTest {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
@Test
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiArtifact = "{\"filename\":\"test.file\",\"hashes\":{\"sha1\":\"123\",\"md5\":\"456\",\"sha256\":\"789\"},\"size\":111,\"links\":[],\"unknownProperty\": \"test\"}";
|
||||
|
||||
@@ -70,7 +72,8 @@ class DdiArtifactTest {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
@Test
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiArtifact = "{\"filename\": [\"test.file\"],\"hashes\":{\"sha1\":\"123\",\"md5\":\"456\",\"sha256\":\"789\"},\"size\":111,\"links\":[]}";
|
||||
|
||||
|
||||
@@ -32,7 +32,8 @@ class DdiCancelActionToStopTest {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
@Test
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final String stopId = "1234";
|
||||
final DdiCancelActionToStop ddiCancelActionToStop = new DdiCancelActionToStop(stopId);
|
||||
@@ -48,7 +49,8 @@ class DdiCancelActionToStopTest {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
@Test
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiCancelActionToStop = "{\"stopId\":\"12345\",\"unknownProperty\":\"test\"}";
|
||||
|
||||
@@ -61,7 +63,8 @@ class DdiCancelActionToStopTest {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
@Test
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiCancelActionToStop = "{\"stopId\": [\"12345\"]}";
|
||||
|
||||
|
||||
@@ -32,7 +32,8 @@ class DdiCancelTest {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
@Test
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final String ddiCancelId = "1234";
|
||||
final DdiCancelActionToStop ddiCancelActionToStop = new DdiCancelActionToStop("1234");
|
||||
@@ -49,7 +50,8 @@ class DdiCancelTest {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
@Test
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiCancel = "{\"id\":\"1234\",\"cancelAction\":{\"stopId\":\"1234\"}, \"unknownProperty\": \"test\"}";
|
||||
|
||||
@@ -62,7 +64,8 @@ class DdiCancelTest {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
@Test
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiCancel = "{\"id\":[\"1234\"],\"cancelAction\":{\"stopId\":\"1234\"}}";
|
||||
|
||||
|
||||
@@ -34,7 +34,8 @@ class DdiChunkTest {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
@Test
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final String part = "1234";
|
||||
final String version = "1.0";
|
||||
@@ -55,7 +56,8 @@ class DdiChunkTest {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
@Test
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiChunk = "{\"part\":\"1234\",\"version\":\"1.0\",\"name\":\"Dummy-Artifact\",\"artifacts\":[],\"unknownProperty\":\"test\"}";
|
||||
|
||||
@@ -70,7 +72,8 @@ class DdiChunkTest {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
@Test
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiChunk = "{\"part\":[\"1234\"],\"version\":\"1.0\",\"name\":\"Dummy-Artifact\",\"artifacts\":[]}";
|
||||
|
||||
|
||||
@@ -34,7 +34,8 @@ class DdiConfigDataTest {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
@Test
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final Map<String, String> data = new HashMap<>();
|
||||
data.put("test", "data");
|
||||
@@ -50,7 +51,8 @@ class DdiConfigDataTest {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with an additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
@Test
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiConfigData = "{\"data\":{\"test\":\"data\"},\"mode\":\"replace\",\"unknownProperty\":\"test\"}";
|
||||
|
||||
@@ -62,7 +64,8 @@ class DdiConfigDataTest {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
@Test
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiConfigData = "{\"data\":{\"test\":\"data\"},\"mode\":[\"replace\"],\"unknownProperty\":\"test\"}";
|
||||
|
||||
@@ -74,7 +77,8 @@ class DdiConfigDataTest {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with removed unused status property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithStatusProperty() throws IOException {
|
||||
@Test
|
||||
void shouldDeserializeObjectWithStatusProperty() throws IOException {
|
||||
// We formerly falsely required a 'status' property object when using the
|
||||
// configData endpoint. It was removed as a requirement from code and
|
||||
// documentation, as it was unused. This test ensures we still behave correctly
|
||||
|
||||
@@ -32,7 +32,8 @@ class DdiConfigTest {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
@Test
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final DdiPolling ddiPolling = new DdiPolling("10");
|
||||
final DdiConfig ddiConfig = new DdiConfig(ddiPolling);
|
||||
@@ -47,7 +48,8 @@ class DdiConfigTest {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
@Test
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiConfig = "{\"polling\":{\"sleep\":\"123\"},\"unknownProperty\":\"test\"}";
|
||||
|
||||
@@ -59,7 +61,8 @@ class DdiConfigTest {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
@Test
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiConfig = "{\"polling\":{\"sleep\":[\"10\"]}}";
|
||||
|
||||
|
||||
@@ -37,7 +37,8 @@ class DdiConfirmationBaseTest {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
@Test
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final String id = "1234";
|
||||
final DdiDeployment ddiDeployment = new DdiDeployment(FORCED, ATTEMPT, Collections.emptyList(), AVAILABLE);
|
||||
@@ -65,7 +66,8 @@ class DdiConfirmationBaseTest {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
@Test
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiConfirmationBase = "{" +
|
||||
"\"id\":\"1234\",\"confirmation\":{\"download\":\"forced\"," +
|
||||
@@ -87,7 +89,8 @@ class DdiConfirmationBaseTest {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
@Test
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiConfirmationBase = "{" +
|
||||
"\"id\":[\"1234\"],\"confirmation\":{\"download\":\"forced\"," +
|
||||
|
||||
@@ -32,7 +32,8 @@ class DdiControllerBaseTest {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
@Test
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final DdiPolling ddiPolling = new DdiPolling("10");
|
||||
final DdiConfig ddiConfig = new DdiConfig(ddiPolling);
|
||||
@@ -48,7 +49,8 @@ class DdiControllerBaseTest {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
@Test
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiControllerBase = "{\"config\":{\"polling\":{\"sleep\":\"123\"}},\"links\":[],\"unknownProperty\":\"test\"}";
|
||||
|
||||
@@ -60,7 +62,8 @@ class DdiControllerBaseTest {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
@Test
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiControllerBase = "{\"config\":{\"polling\":{\"sleep\":[\"123\"]}},\"links\":[],\"unknownProperty\":\"test\"}";
|
||||
|
||||
|
||||
@@ -37,7 +37,8 @@ class DdiDeploymentBaseTest {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
@Test
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final String id = "1234";
|
||||
final DdiDeployment ddiDeployment = new DdiDeployment(FORCED, ATTEMPT, Collections.emptyList(), AVAILABLE);
|
||||
@@ -59,7 +60,8 @@ class DdiDeploymentBaseTest {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
@Test
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiDeploymentBase = "{\"id\":\"1234\",\"deployment\":{\"download\":\"forced\"," +
|
||||
"\"update\":\"attempt\",\"maintenanceWindow\":\"available\",\"chunks\":[]}," +
|
||||
@@ -76,7 +78,8 @@ class DdiDeploymentBaseTest {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
@Test
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiDeploymentBase = "{\"id\":[\"1234\"],\"deployment\":{\"download\":\"forced\"," +
|
||||
"\"update\":\"attempt\",\"maintenanceWindow\":\"available\",\"chunks\":[]}," +
|
||||
|
||||
@@ -36,7 +36,8 @@ class DdiDeploymentTest {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
@Test
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final DdiDeployment ddiDeployment = new DdiDeployment(FORCED, ATTEMPT, Collections.emptyList(), AVAILABLE);
|
||||
|
||||
@@ -53,7 +54,8 @@ class DdiDeploymentTest {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
@Test
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiDeployment = "{\"download\":\"forced\",\"update\":\"attempt\", " +
|
||||
"\"maintenanceWindow\":\"available\",\"chunks\":[],\"unknownProperty\":\"test\"}";
|
||||
@@ -68,7 +70,8 @@ class DdiDeploymentTest {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
@Test
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiDeployment = "{\"download\":[\"forced\"],\"update\":\"attempt\", " +
|
||||
"\"maintenanceWindow\":\"available\",\"chunks\":[]}";
|
||||
|
||||
@@ -32,7 +32,8 @@ class DdiMetadataTest {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
@Test
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final String key = "testKey";
|
||||
final String value = "testValue";
|
||||
@@ -49,7 +50,8 @@ class DdiMetadataTest {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
@Test
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiMetadata = "{\"key\":\"testKey\",\"value\":\"testValue\",\"unknownProperty\":\"test\"}";
|
||||
|
||||
@@ -62,7 +64,8 @@ class DdiMetadataTest {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
@Test
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiMetadata = "{\"key\":[\"testKey\"],\"value\":\"testValue\"}";
|
||||
|
||||
|
||||
@@ -32,7 +32,8 @@ class DdiPollingTest {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
@Test
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final DdiPolling ddiPolling = new DdiPolling("10");
|
||||
|
||||
@@ -46,7 +47,8 @@ class DdiPollingTest {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
@Test
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiPolling = "{\"sleep\":\"10\",\"unknownProperty\":\"test\"}";
|
||||
|
||||
@@ -58,7 +60,8 @@ class DdiPollingTest {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
@Test
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiPolling = "{\"sleep\":[\"10\"]}";
|
||||
|
||||
|
||||
@@ -32,7 +32,8 @@ class DdiProgressTest {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
@Test
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final DdiProgress ddiProgress = new DdiProgress(30, 100);
|
||||
|
||||
@@ -47,7 +48,8 @@ class DdiProgressTest {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
@Test
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiProgress = "{\"cnt\":30,\"of\":100,\"unknownProperty\":\"test\"}";
|
||||
|
||||
@@ -60,7 +62,8 @@ class DdiProgressTest {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
@Test
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiProgress = "{\"cnt\":[30],\"of\":100}";
|
||||
|
||||
|
||||
@@ -33,7 +33,8 @@ class DdiResultTest {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
@Test
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final DdiProgress ddiProgress = new DdiProgress(30, 100);
|
||||
final DdiResult ddiResult = new DdiResult(NONE, ddiProgress);
|
||||
@@ -50,7 +51,8 @@ class DdiResultTest {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
@Test
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiResult = "{\"finished\":\"none\",\"progress\":{\"cnt\":30,\"of\":100},\"unknownProperty\":\"test\"}";
|
||||
|
||||
@@ -64,7 +66,8 @@ class DdiResultTest {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
@Test
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiResult = "{\"finished\":[\"none\"],\"progress\":{\"cnt\":30,\"of\":100}}";
|
||||
|
||||
|
||||
@@ -57,7 +57,8 @@ class DdiStatusTest {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
@Test
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiStatus = "{\"execution\":\"proceeding\",\"result\":{\"finished\":\"none\"," +
|
||||
"\"progress\":{\"cnt\":30,\"of\":100}},\"details\":[],\"unknownProperty\":\"test\"}";
|
||||
@@ -74,7 +75,8 @@ class DdiStatusTest {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a provided code (optional)
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithOptionalCode() throws IOException {
|
||||
@Test
|
||||
void shouldDeserializeObjectWithOptionalCode() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiStatus = "{\"execution\":\"proceeding\",\"result\":{\"finished\":\"none\"," +
|
||||
"\"progress\":{\"cnt\":30,\"of\":100}},\"code\": 12,\"details\":[]}";
|
||||
@@ -91,7 +93,8 @@ class DdiStatusTest {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
@Test
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiStatus = "{\"execution\":[\"proceeding\"],\"result\":{\"finished\":\"none\"," +
|
||||
"\"progress\":{\"cnt\":30,\"of\":100}},\"details\":[]}";
|
||||
|
||||
@@ -31,7 +31,8 @@ class JsonIgnorePropertiesAnnotationTest {
|
||||
/**
|
||||
* This test verifies that all model classes within the 'org.eclipse.hawkbit.ddi.json.model' package are annotated with '@JsonIgnoreProperties(ignoreUnknown = true)'
|
||||
*/
|
||||
@Test void shouldCheckAnnotationsForAllModelClasses() {
|
||||
@Test
|
||||
void shouldCheckAnnotationsForAllModelClasses() {
|
||||
final String packageName = getClass().getPackage().getName();
|
||||
try (final ScanResult scanResult = new ClassGraph().acceptPackages(packageName).scan()) {
|
||||
final List<? extends Class<?>> matchingClasses = scanResult.getAllClasses()
|
||||
|
||||
@@ -70,7 +70,8 @@ class DdiArtifactDownloadTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Tests non allowed requests on the artifact ressource, e.g. invalid URI, wrong if-match, wrong command.
|
||||
*/
|
||||
@Test void invalidRequestsOnArtifactResource() throws Exception {
|
||||
@Test
|
||||
void invalidRequestsOnArtifactResource() throws Exception {
|
||||
// create target
|
||||
final Target target = testdataFactory.createTarget();
|
||||
final List<Target> targets = Collections.singletonList(target);
|
||||
@@ -207,7 +208,8 @@ class DdiArtifactDownloadTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Tests valid MD5SUm file downloads through the artifact resource by identifying the artifact by ID.
|
||||
*/
|
||||
@Test void downloadMd5sumThroughControllerApi() throws Exception {
|
||||
@Test
|
||||
void downloadMd5sumThroughControllerApi() throws Exception {
|
||||
// create target
|
||||
final Target target = testdataFactory.createTarget();
|
||||
|
||||
|
||||
@@ -55,7 +55,8 @@ class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Tests that the cancel action resource can be used with CBOR.
|
||||
*/
|
||||
@Test void cancelActionCbor() throws Exception {
|
||||
@Test
|
||||
void cancelActionCbor() throws Exception {
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||
testdataFactory.createTarget();
|
||||
final Long actionId = getFirstAssignedActionId(
|
||||
@@ -89,7 +90,8 @@ class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Test of the controller can continue a started update even after a cancel command if it so desires.
|
||||
*/
|
||||
@Test void rootRsCancelActionButContinueAnyway() throws Exception {
|
||||
@Test
|
||||
void rootRsCancelActionButContinueAnyway() throws Exception {
|
||||
// prepare test data
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||
final Target savedTarget = testdataFactory.createTarget();
|
||||
@@ -150,7 +152,8 @@ class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Test for cancel operation of a update action.
|
||||
*/
|
||||
@Test void rootRsCancelAction() throws Exception {
|
||||
@Test
|
||||
void rootRsCancelAction() throws Exception {
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||
final Target savedTarget = testdataFactory.createTarget();
|
||||
|
||||
@@ -232,7 +235,8 @@ class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Tests various bad requests and if the server handles them as expected.
|
||||
*/
|
||||
@Test void badCancelAction() throws Exception {
|
||||
@Test
|
||||
void badCancelAction() throws Exception {
|
||||
|
||||
// not allowed methods
|
||||
mvc.perform(post("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/cancelAction/1",
|
||||
@@ -269,7 +273,8 @@ class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Tests the feedback channel of the cancel operation.
|
||||
*/
|
||||
@Test void rootRsCancelActionFeedback() throws Exception {
|
||||
@Test
|
||||
void rootRsCancelActionFeedback() throws Exception {
|
||||
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||
|
||||
@@ -350,7 +355,8 @@ class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Tests the feeback chanel of for multiple open cancel operations on the same target.
|
||||
*/
|
||||
@Test void multipleCancelActionFeedback() throws Exception {
|
||||
@Test
|
||||
void multipleCancelActionFeedback() throws Exception {
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("", true);
|
||||
final DistributionSet ds2 = testdataFactory.createDistributionSet("2", true);
|
||||
final DistributionSet ds3 = testdataFactory.createDistributionSet("3", true);
|
||||
@@ -482,7 +488,8 @@ class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Tests the feeback channel closing for too many feedbacks, i.e. denial of service prevention.
|
||||
*/
|
||||
@Test void tooMuchCancelActionFeedback() throws Exception {
|
||||
@Test
|
||||
void tooMuchCancelActionFeedback() throws Exception {
|
||||
testdataFactory.createTarget();
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||
|
||||
@@ -511,7 +518,8 @@ class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* test the correct rejection of various invalid feedback requests
|
||||
*/
|
||||
@Test void badCancelActionFeedback() throws Exception {
|
||||
@Test
|
||||
void badCancelActionFeedback() throws Exception {
|
||||
final Action cancelAction = createCancelAction(TestdataFactory.DEFAULT_CONTROLLER_ID);
|
||||
createCancelAction("4715");
|
||||
|
||||
|
||||
@@ -58,7 +58,8 @@ class DdiConfigDataTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Verify that config data can be uploaded as CBOR
|
||||
*/
|
||||
@Test void putConfigDataAsCbor() throws Exception {
|
||||
@Test
|
||||
void putConfigDataAsCbor() throws Exception {
|
||||
testdataFactory.createTarget(TARGET1_ID);
|
||||
|
||||
final Map<String, String> attributes = new HashMap<>();
|
||||
@@ -209,7 +210,8 @@ class DdiConfigDataTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Verifies that invalid config data attributes are handled correctly.
|
||||
*/
|
||||
@Test void putConfigDataWithInvalidAttributes() throws Exception {
|
||||
@Test
|
||||
void putConfigDataWithInvalidAttributes() throws Exception {
|
||||
// create a target
|
||||
testdataFactory.createTarget(TARGET2_ID);
|
||||
putAndVerifyConfigDataWithKeyTooLong();
|
||||
@@ -219,7 +221,8 @@ class DdiConfigDataTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Verify that config data (device attributes) can be updated by the controller using different update modes (merge, replace, remove).
|
||||
*/
|
||||
@Test void putConfigDataWithDifferentUpdateModes() throws Exception {
|
||||
@Test
|
||||
void putConfigDataWithDifferentUpdateModes() throws Exception {
|
||||
// create a target
|
||||
testdataFactory.createTarget(TARGET1_ID);
|
||||
|
||||
|
||||
@@ -70,7 +70,8 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Forced deployment to a controller. Checks if the confirmation resource response payload for a given deployment is as expected.
|
||||
*/
|
||||
@Test void verifyConfirmationReferencesInControllerBase(@Autowired ActionStatusRepository actionStatusRepository) throws Exception {
|
||||
@Test
|
||||
void verifyConfirmationReferencesInControllerBase(@Autowired ActionStatusRepository actionStatusRepository) throws Exception {
|
||||
enableConfirmationFlow();
|
||||
// Prepare test data
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("", true);
|
||||
@@ -135,7 +136,8 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensure that the deployment resource is available as CBOR
|
||||
*/
|
||||
@Test void confirmationResourceCbor() throws Exception {
|
||||
@Test
|
||||
void confirmationResourceCbor() throws Exception {
|
||||
enableConfirmationFlow();
|
||||
final Target target = testdataFactory.createTarget();
|
||||
final DistributionSet distributionSet = testdataFactory.createDistributionSet("");
|
||||
@@ -160,7 +162,8 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensure that the confirmation endpoint is not available.
|
||||
*/
|
||||
@Test void confirmationEndpointNotExposed() throws Exception {
|
||||
@Test
|
||||
void confirmationEndpointNotExposed() throws Exception {
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||
Target savedTarget = testdataFactory.createTarget("988");
|
||||
savedTarget = getFirstAssignedTarget(assignDistributionSet(ds.getId(), savedTarget.getControllerId()));
|
||||
@@ -182,7 +185,8 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensure that the deploymentBase endpoint is not available for action ins WFC state.
|
||||
*/
|
||||
@Test void deploymentEndpointNotAccessibleForActionsWFC() throws Exception {
|
||||
@Test
|
||||
void deploymentEndpointNotAccessibleForActionsWFC() throws Exception {
|
||||
enableConfirmationFlow();
|
||||
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||
@@ -212,7 +216,8 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensure that the confirmation endpoints are still available after deactivating the confirmation flow.
|
||||
*/
|
||||
@Test void verifyConfirmationBaseEndpointsArePresentAfterDisablingConfirmationFlow() throws Exception {
|
||||
@Test
|
||||
void verifyConfirmationBaseEndpointsArePresentAfterDisablingConfirmationFlow() throws Exception {
|
||||
enableConfirmationFlow();
|
||||
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||
@@ -249,7 +254,8 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Controller sends a confirmed action state.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||
@@ -285,7 +291,8 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Confirmation base provides right values if auto-confirm not active.
|
||||
*/
|
||||
@Test void getConfirmationBaseProvidesAutoConfirmStatusNotActive() throws Exception {
|
||||
@Test
|
||||
void getConfirmationBaseProvidesAutoConfirmStatusNotActive() throws Exception {
|
||||
enableConfirmationFlow();
|
||||
|
||||
final String controllerId = testdataFactory.createTarget("989").getControllerId();
|
||||
@@ -362,7 +369,8 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Verify auto-confirm deactivation is handled correctly.
|
||||
*/
|
||||
@Test void deactivateAutoConfirmation() throws Exception {
|
||||
@Test
|
||||
void deactivateAutoConfirmation() throws Exception {
|
||||
final String controllerId = testdataFactory.createTarget("988").getControllerId();
|
||||
|
||||
confirmationManagement.activateAutoConfirmation(controllerId, null, null);
|
||||
@@ -377,7 +385,8 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Controller sends a denied action state.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||
@@ -423,7 +432,8 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Test to verify that only a specific count of messages are returned based on the input actionHistory for getControllerDeploymentActionFeedback endpoint.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||
|
||||
@@ -83,7 +83,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensure that the deployment resource is available as CBOR
|
||||
*/
|
||||
@Test void deploymentResourceCbor() throws Exception {
|
||||
@Test
|
||||
void deploymentResourceCbor() throws Exception {
|
||||
final Target target = testdataFactory.createTarget();
|
||||
final DistributionSet distributionSet = testdataFactory.createDistributionSet("");
|
||||
|
||||
@@ -111,7 +112,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that artifacts are not found, when software module does not exists.
|
||||
*/
|
||||
@Test void artifactsNotFound() throws Exception {
|
||||
@Test
|
||||
void artifactsNotFound() throws Exception {
|
||||
final Target target = testdataFactory.createTarget();
|
||||
performGet(SOFTWARE_MODULE_ARTIFACTS, MediaType.APPLICATION_JSON, status().isNotFound(), tenantAware.getCurrentTenant(),
|
||||
target.getControllerId(), "1");
|
||||
@@ -120,7 +122,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that artifacts are found, when software module exists.
|
||||
*/
|
||||
@Test void artifactsExists() throws Exception {
|
||||
@Test
|
||||
void artifactsExists() throws Exception {
|
||||
final Target target = testdataFactory.createTarget();
|
||||
final DistributionSet distributionSet = testdataFactory.createDistributionSet("");
|
||||
|
||||
@@ -140,7 +143,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Forced deployment to a controller. Checks if the resource response payload for a given deployment is as expected.
|
||||
*/
|
||||
@Test void deploymentForceAction() throws Exception {
|
||||
@Test
|
||||
void deploymentForceAction() throws Exception {
|
||||
// Prepare test data
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("", true);
|
||||
final DistributionSet ds2 = testdataFactory.createDistributionSet("2", true);
|
||||
@@ -198,7 +202,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Checks that the deploymentBase URL changes when the action is switched from soft to forced in TIMEFORCED case.
|
||||
*/
|
||||
@Test void changeEtagIfActionSwitchesFromSoftToForced() throws Exception {
|
||||
@Test
|
||||
void changeEtagIfActionSwitchesFromSoftToForced() throws Exception {
|
||||
// Prepare test data
|
||||
final Target target = testdataFactory.createTarget(DEFAULT_CONTROLLER_ID);
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("", true);
|
||||
@@ -235,7 +240,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Attempt/soft deployment to a controller. Checks if the resource response payload for a given deployment is as expected.
|
||||
*/
|
||||
@Test void deploymentAttemptAction() throws Exception {
|
||||
@Test
|
||||
void deploymentAttemptAction() throws Exception {
|
||||
// Prepare test data
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("", true);
|
||||
final DistributionSet ds2 = testdataFactory.createDistributionSet("2", true);
|
||||
@@ -299,7 +305,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Attempt/soft deployment to a controller including automated switch to hard. Checks if the resource response payload for a given deployment is as expected.
|
||||
*/
|
||||
@Test void deploymentAutoForceAction() throws Exception {
|
||||
@Test
|
||||
void deploymentAutoForceAction() throws Exception {
|
||||
// Prepare test data
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("", true);
|
||||
final DistributionSet ds2 = testdataFactory.createDistributionSet("2", true);
|
||||
@@ -358,7 +365,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Test download-only (forced + skip) deployment to a controller. Checks if the resource response payload for a given deployment is as expected.
|
||||
*/
|
||||
@Test void deploymentDownloadOnlyAction() throws Exception {
|
||||
@Test
|
||||
void deploymentDownloadOnlyAction() throws Exception {
|
||||
// Prepare test data
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("", true);
|
||||
final DistributionSet ds2 = testdataFactory.createDistributionSet("2", true);
|
||||
@@ -420,7 +428,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Test various invalid access attempts to the deployment resource und the expected behaviour of the server.
|
||||
*/
|
||||
@Test void badDeploymentAction() throws Exception {
|
||||
@Test
|
||||
void badDeploymentAction() throws Exception {
|
||||
final Target target = testdataFactory.createTarget(DEFAULT_CONTROLLER_ID);
|
||||
|
||||
// not allowed methods
|
||||
@@ -507,7 +516,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Multiple uploads of deployment status feedback to the server.
|
||||
*/
|
||||
@Test void multipleDeploymentActionFeedback() throws Exception {
|
||||
@Test
|
||||
void multipleDeploymentActionFeedback() throws Exception {
|
||||
testdataFactory.createTarget(DEFAULT_CONTROLLER_ID);
|
||||
testdataFactory.createTarget("4713");
|
||||
testdataFactory.createTarget("4714");
|
||||
@@ -548,7 +558,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Verifies that an update action is correctly set to error if the controller provides error feedback.
|
||||
*/
|
||||
@Test void rootRsSingleDeploymentActionWithErrorFeedback() throws Exception {
|
||||
@Test
|
||||
void rootRsSingleDeploymentActionWithErrorFeedback() throws Exception {
|
||||
DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||
final Target savedTarget = testdataFactory.createTarget(DEFAULT_CONTROLLER_ID);
|
||||
|
||||
@@ -585,7 +596,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Verifies that the controller can provided as much feedback entries as necessary as long as it is in the configured limits.
|
||||
*/
|
||||
@Test void rootRsSingleDeploymentActionFeedback() throws Exception {
|
||||
@Test
|
||||
void rootRsSingleDeploymentActionFeedback() throws Exception {
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||
final Long actionId = getFirstAssignedActionId(
|
||||
assignDistributionSet(ds,
|
||||
@@ -626,7 +638,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Various forbidden request attempts on the feedback resource. Ensures correct answering behaviour as expected to these kind of errors.
|
||||
*/
|
||||
@Test void badDeploymentActionFeedback() throws Exception {
|
||||
@Test
|
||||
void badDeploymentActionFeedback() throws Exception {
|
||||
final DistributionSet savedSet = testdataFactory.createDistributionSet("");
|
||||
final DistributionSet savedSet2 = testdataFactory.createDistributionSet("1");
|
||||
|
||||
@@ -665,7 +678,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that an invalid id in feedback body returns a bad request.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||
@@ -687,7 +701,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that a missing feedback result in feedback body returns a bad request.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||
@@ -713,7 +728,8 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that a missing finished result in feedback body returns a bad request.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||
|
||||
@@ -77,7 +77,8 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensure that the installed base resource is available as CBOR
|
||||
*/
|
||||
@Test void installedBaseResourceCbor() throws Exception {
|
||||
@Test
|
||||
void installedBaseResourceCbor() throws Exception {
|
||||
final Target target = testdataFactory.createTarget();
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||
|
||||
@@ -100,7 +101,8 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensure that assigned version is self assigned version
|
||||
*/
|
||||
@Test void installedVersion() throws Exception {
|
||||
@Test
|
||||
void installedVersion() throws Exception {
|
||||
final Target target = createTargetAndAssertNoActiveActions();
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||
|
||||
@@ -116,7 +118,8 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensure that installedVersion is version self assigned
|
||||
*/
|
||||
@Test void installedVersionNotExist() throws Exception {
|
||||
@Test
|
||||
void installedVersionNotExist() throws Exception {
|
||||
final Target target = createTargetAndAssertNoActiveActions();
|
||||
final String dsName = "unknown";
|
||||
final String dsVersion = "1.0.0";
|
||||
@@ -130,7 +133,8 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Test several deployments to a controller. Checks that action is represented as installedBase after installation.
|
||||
*/
|
||||
@Test void deploymentSeveralActionsInInstalledBase() throws Exception {
|
||||
@Test
|
||||
void deploymentSeveralActionsInInstalledBase() throws Exception {
|
||||
// Prepare test data
|
||||
final Target target = createTargetAndAssertNoActiveActions();
|
||||
|
||||
@@ -199,7 +203,8 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Test several deployments of same ds to a controller. Checks that cancelled action in history is not linked as installedBase.
|
||||
*/
|
||||
@Test void deploymentActionsOfSameDsWithCancelledActionInHistory() throws Exception {
|
||||
@Test
|
||||
void deploymentActionsOfSameDsWithCancelledActionInHistory() throws Exception {
|
||||
// Prepare test data
|
||||
final Target target = createTargetAndAssertNoActiveActions();
|
||||
|
||||
@@ -256,7 +261,8 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Test several deployments of same ds to a controller. Checks that latest cancelled action does not override actual installed ds.
|
||||
*/
|
||||
@Test void deploymentActionsOfSameDsWithCancelledAction() throws Exception {
|
||||
@Test
|
||||
void deploymentActionsOfSameDsWithCancelledAction() throws Exception {
|
||||
// Prepare test data
|
||||
final Target target = createTargetAndAssertNoActiveActions();
|
||||
|
||||
@@ -314,7 +320,8 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Test several deployments of same ds to a controller. Checks that latest running action does not override actual installed ds.
|
||||
*/
|
||||
@Test void deploymentActionsOfSameDsWithRunningAction() throws Exception {
|
||||
@Test
|
||||
void deploymentActionsOfSameDsWithRunningAction() throws Exception {
|
||||
// Prepare test data
|
||||
final Target target = createTargetAndAssertNoActiveActions();
|
||||
|
||||
@@ -368,7 +375,8 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Test open deployment to a controller. Checks that installedBase returns 404 for a pending action.
|
||||
*/
|
||||
@Test void installedBaseReturns404ForPendingAction() throws Exception {
|
||||
@Test
|
||||
void installedBaseReturns404ForPendingAction() throws Exception {
|
||||
// Prepare test data
|
||||
final Target target = createTargetAndAssertNoActiveActions();
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||
@@ -392,7 +400,8 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that artifacts are found, after the action was already closed.
|
||||
*/
|
||||
@Test void artifactsOfInstalledActionExist() throws Exception {
|
||||
@Test
|
||||
void artifactsOfInstalledActionExist() throws Exception {
|
||||
final Target target = createTargetAndAssertNoActiveActions();
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||
|
||||
@@ -470,7 +479,8 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Test download-only deployment to a controller. Checks that download-only is not represented as installedBase.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||
@@ -547,7 +557,8 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Test to verify that only a specific count of messages are returned based on the input actionHistory for getControllerInstalledAction endpoint.
|
||||
*/
|
||||
@Test void testActionHistoryCount() throws Exception {
|
||||
@Test
|
||||
void testActionHistoryCount() throws Exception {
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||
Target savedTarget = testdataFactory.createTarget("911");
|
||||
savedTarget = getFirstAssignedTarget(assignDistributionSet(ds.getId(), savedTarget.getControllerId()));
|
||||
@@ -599,7 +610,8 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Test various invalid access attempts to the installed resource und the expected behaviour of the server.
|
||||
*/
|
||||
@Test void badInstalledAction() throws Exception {
|
||||
@Test
|
||||
void badInstalledAction() throws Exception {
|
||||
final Target target = testdataFactory.createTarget(CONTROLLER_ID);
|
||||
|
||||
// not allowed methods
|
||||
|
||||
@@ -85,7 +85,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensure that the root poll resource is available as CBOR
|
||||
*/
|
||||
@Test void rootPollResourceCbor() throws Exception {
|
||||
@Test
|
||||
void rootPollResourceCbor() throws Exception {
|
||||
mvc.perform(get(CONTROLLER_BASE, tenantAware.getCurrentTenant(), 4711).accept(DdiRestConstants.MEDIA_TYPE_CBOR))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(content().contentType(DdiRestConstants.MEDIA_TYPE_CBOR))
|
||||
@@ -95,7 +96,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that the API returns JSON when no Accept header is specified by the client.
|
||||
*/
|
||||
@Test void apiReturnsJSONByDefault() throws Exception {
|
||||
@Test
|
||||
void apiReturnsJSONByDefault() throws Exception {
|
||||
final MvcResult result = mvc.perform(get(CONTROLLER_BASE, tenantAware.getCurrentTenant(), 4711))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -109,7 +111,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that target poll request does not change audit data on the entity.
|
||||
*/
|
||||
@Test @WithUser(principal = "knownPrincipal", authorities = { SpPermission.READ_TARGET, SpPermission.UPDATE_TARGET, SpPermission.CREATE_TARGET })
|
||||
@Test
|
||||
@WithUser(principal = "knownPrincipal", authorities = { SpPermission.READ_TARGET, SpPermission.UPDATE_TARGET, SpPermission.CREATE_TARGET })
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
||||
@@ -142,7 +145,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that server returns a not found response in case of empty controller ID.
|
||||
*/
|
||||
@Test @ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
||||
@Test
|
||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
||||
void rootRsWithoutId() throws Exception {
|
||||
mvc.perform(get("/controller/v1/"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -152,7 +156,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that the system creates a new target in plug and play manner, i.e. target is authenticated but does not exist yet.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetPollEvent.class, count = 1) })
|
||||
void rootRsPlugAndPlay() throws Exception {
|
||||
@@ -188,7 +193,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that tenant specific polling time, which is saved in the db, is delivered to the controller.
|
||||
*/
|
||||
@Test @WithUser(principal = "knownpricipal", allSpPermissions = false)
|
||||
@Test
|
||||
@WithUser(principal = "knownpricipal", allSpPermissions = false)
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetPollEvent.class, count = 1),
|
||||
@@ -213,7 +219,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that etag check results in not modified response if provided etag by client is identical to entity in repository.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetPollEvent.class, count = 6),
|
||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 2),
|
||||
@@ -342,7 +349,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that the source IP address of the polling target is correctly stored in repository
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetPollEvent.class, count = 1) })
|
||||
void rootRsPlugAndPlayIpAddress() throws Exception {
|
||||
@@ -371,7 +379,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that the source IP address of the polling target is not stored in repository if disabled
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetPollEvent.class, count = 1) })
|
||||
void rootRsIpAddressNotStoredIfDisabled() throws Exception {
|
||||
@@ -393,7 +402,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Controller trys to finish an update process after it has been finished by an error action status.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||
@@ -425,7 +435,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Controller sends attribute update request after device successfully closed software update.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||
@@ -456,7 +467,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Test to verify that only a specific count of messages are returned based on the input actionHistory for getControllerDeploymentActionFeedback endpoint.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||
@@ -501,7 +513,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Test to verify that a zero input value of actionHistory results in no action history appended for getControllerDeploymentActionFeedback endpoint.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||
@@ -546,7 +559,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Test to verify that entire action history is returned if the input value for actionHistory is -1, for getControllerDeploymentActionFeedback endpoint.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||
@@ -591,7 +605,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Test the polling time based on different maintenance window start and end time.
|
||||
*/
|
||||
@Test void sleepTimeResponseForDifferentMaintenanceWindowParameters() throws Exception {
|
||||
@Test
|
||||
void sleepTimeResponseForDifferentMaintenanceWindowParameters() throws Exception {
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||
|
||||
SecurityContextSwitch.runAs(SecurityContextSwitch.withUser("tenantadmin", TENANT_CONFIGURATION),
|
||||
@@ -642,7 +657,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Test download and update values before maintenance window start time.
|
||||
*/
|
||||
@Test void downloadAndUpdateStatusBeforeMaintenanceWindowStartTime() throws Exception {
|
||||
@Test
|
||||
void downloadAndUpdateStatusBeforeMaintenanceWindowStartTime() throws Exception {
|
||||
Target savedTarget = testdataFactory.createTarget("1911");
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||
savedTarget = getFirstAssignedTarget(assignDistributionSetWithMaintenanceWindow(ds.getId(),
|
||||
@@ -665,7 +681,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Test download and update values after maintenance window start time.
|
||||
*/
|
||||
@Test void downloadAndUpdateStatusDuringMaintenanceWindow() throws Exception {
|
||||
@Test
|
||||
void downloadAndUpdateStatusDuringMaintenanceWindow() throws Exception {
|
||||
Target savedTarget = testdataFactory.createTarget("1911");
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||
savedTarget = getFirstAssignedTarget(assignDistributionSetWithMaintenanceWindow(ds.getId(),
|
||||
@@ -688,7 +705,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Assign multiple DS in multi-assignment mode. The earliest active Action is exposed to the controller.
|
||||
*/
|
||||
@Test void earliestActionIsExposedToControllerInMultiAssignMode() throws Exception {
|
||||
@Test
|
||||
void earliestActionIsExposedToControllerInMultiAssignMode() throws Exception {
|
||||
enableMultiAssignments();
|
||||
final Target target = testdataFactory.createTarget();
|
||||
final DistributionSet ds1 = testdataFactory.createDistributionSet(UUID.randomUUID().toString());
|
||||
@@ -704,7 +722,8 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* The system should not create a new target because of a too long controller id.
|
||||
*/
|
||||
@Test void rootRsWithInvalidControllerId() throws Exception {
|
||||
@Test
|
||||
void rootRsWithInvalidControllerId() throws Exception {
|
||||
final String invalidControllerId = randomString(Target.CONTROLLER_ID_MAX_SIZE + 1);
|
||||
mvc.perform(get(CONTROLLER_BASE, tenantAware.getCurrentTenant(), invalidControllerId))
|
||||
.andExpect(status().isBadRequest());
|
||||
|
||||
@@ -51,7 +51,8 @@ class DosFilterTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that clients that are on the blacklist are forbidden
|
||||
*/
|
||||
@Test void blackListedClientIsForbidden() throws Exception {
|
||||
@Test
|
||||
void blackListedClientIsForbidden() throws Exception {
|
||||
mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant())
|
||||
.header(X_FORWARDED_FOR, "192.168.0.4 , 10.0.0.1 "))
|
||||
.andExpect(status().isForbidden());
|
||||
@@ -60,7 +61,8 @@ class DosFilterTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that a READ DoS attempt is blocked
|
||||
*/
|
||||
@Test void getFloodingAttackThatIsPrevented() throws Exception {
|
||||
@Test
|
||||
void getFloodingAttackThatIsPrevented() throws Exception {
|
||||
int requests = 0;
|
||||
MvcResult result;
|
||||
do {
|
||||
@@ -80,7 +82,8 @@ class DosFilterTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that an assumed READ DoS attempt is not blocked as the client (with IPv4 address) is on a whitelist
|
||||
*/
|
||||
@Test void unacceptableGetLoadButOnWhitelistIPv4() throws Exception {
|
||||
@Test
|
||||
void unacceptableGetLoadButOnWhitelistIPv4() throws Exception {
|
||||
for (int i = 0; i < 100; i++) {
|
||||
mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant())
|
||||
.header(X_FORWARDED_FOR, "127.0.0.1"))
|
||||
@@ -91,7 +94,8 @@ class DosFilterTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that an assumed READ DoS attempt is not blocked as the client (with IPv6 address) is on a whitelist
|
||||
*/
|
||||
@Test void unacceptableGetLoadButOnWhitelistIPv6() throws Exception {
|
||||
@Test
|
||||
void unacceptableGetLoadButOnWhitelistIPv6() throws Exception {
|
||||
for (int i = 0; i < 100; i++) {
|
||||
mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant())
|
||||
.header(X_FORWARDED_FOR, "0:0:0:0:0:0:0:1"))
|
||||
@@ -102,7 +106,8 @@ class DosFilterTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that a relatively high number of READ requests is allowed if it is below the DoS detection threshold
|
||||
*/
|
||||
@Test // No idea how to get rid of the Thread.sleep here
|
||||
@Test
|
||||
// No idea how to get rid of the Thread.sleep here
|
||||
@SuppressWarnings("squid:S2925")
|
||||
void acceptableGetLoad() throws Exception {
|
||||
for (int x = 0; x < 3; x++) {
|
||||
@@ -119,7 +124,8 @@ class DosFilterTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that a WRITE DoS attempt is blocked
|
||||
*/
|
||||
@Test void putPostFloddingAttackThatisPrevented() throws Exception {
|
||||
@Test
|
||||
void putPostFloddingAttackThatisPrevented() throws Exception {
|
||||
final Long actionId = prepareDeploymentBase();
|
||||
final String feedback = getJsonProceedingDeploymentActionFeedback();
|
||||
|
||||
@@ -143,7 +149,8 @@ class DosFilterTest extends AbstractDDiApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that a relatively high number of WRITE requests is allowed if it is below the DoS detection threshold
|
||||
*/
|
||||
@Test // No idea how to get rid of the Thread.sleep here
|
||||
@Test
|
||||
// No idea how to get rid of the Thread.sleep here
|
||||
@SuppressWarnings("squid:S2925")
|
||||
void acceptablePutPostLoad() throws Exception {
|
||||
final Long actionId = prepareDeploymentBase();
|
||||
|
||||
@@ -63,7 +63,8 @@ class GatewayTokenAuthenticatorTest {
|
||||
/**
|
||||
* Tests successful authentication with gateway token
|
||||
*/
|
||||
@Test void testWithGwToken() {
|
||||
@Test
|
||||
void testWithGwToken() {
|
||||
final ControllerSecurityToken securityToken = prepareSecurityToken(GATEWAY_TOKEN);
|
||||
when(tenantConfigurationManagementMock.getConfigurationValue(
|
||||
TenantConfigurationKey.AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_KEY, String.class))
|
||||
@@ -80,7 +81,8 @@ class GatewayTokenAuthenticatorTest {
|
||||
/**
|
||||
* Tests that if gateway token doesn't match, the authentication fails
|
||||
*/
|
||||
@Test void testWithBadGwToken() {
|
||||
@Test
|
||||
void testWithBadGwToken() {
|
||||
final ControllerSecurityToken securityToken = prepareSecurityToken(UNKNOWN_TOKEN);
|
||||
when(tenantConfigurationManagementMock.getConfigurationValue(
|
||||
TenantConfigurationKey.AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_KEY, String.class))
|
||||
@@ -95,14 +97,16 @@ class GatewayTokenAuthenticatorTest {
|
||||
/**
|
||||
* Tests that if gateway token miss, the authentication fails
|
||||
*/
|
||||
@Test void testWithoutGwToken() {
|
||||
@Test
|
||||
void testWithoutGwToken() {
|
||||
assertThat(authenticator.authenticate(new ControllerSecurityToken("DEFAULT", CONTROLLER_ID))).isNull();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that if disabled, the authentication fails
|
||||
*/
|
||||
@Test void testWithGwTokenButDisabled() {
|
||||
@Test
|
||||
void testWithGwTokenButDisabled() {
|
||||
final ControllerSecurityToken securityToken = prepareSecurityToken(GATEWAY_TOKEN);
|
||||
when(tenantConfigurationManagementMock.getConfigurationValue(
|
||||
TenantConfigurationKey.AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_ENABLED, Boolean.class))
|
||||
|
||||
@@ -74,7 +74,8 @@ class SecurityHeaderAuthenticatorTest {
|
||||
/**
|
||||
* Tests successful authentication with multiple a single hashes
|
||||
*/
|
||||
@Test void testWithSingleKnownHash() {
|
||||
@Test
|
||||
void testWithSingleKnownHash() {
|
||||
final ControllerSecurityToken securityToken = prepareSecurityToken(SINGLE_HASH);
|
||||
when(tenantConfigurationManagementMock.getConfigurationValue(
|
||||
TenantConfigurationKey.AUTHENTICATION_MODE_HEADER_AUTHORITY_NAME, String.class))
|
||||
@@ -91,7 +92,8 @@ class SecurityHeaderAuthenticatorTest {
|
||||
/**
|
||||
* Tests successful authentication with multiple hashes
|
||||
*/
|
||||
@Test void testWithMultipleKnownHashes() {
|
||||
@Test
|
||||
void testWithMultipleKnownHashes() {
|
||||
when(tenantConfigurationManagementMock.getConfigurationValue(
|
||||
TenantConfigurationKey.AUTHENTICATION_MODE_HEADER_AUTHORITY_NAME, String.class))
|
||||
.thenReturn(CONFIG_VALUE_MULTI_HASH);
|
||||
@@ -113,7 +115,8 @@ class SecurityHeaderAuthenticatorTest {
|
||||
/**
|
||||
* Tests that if the hash is unknown, the authentication fails
|
||||
*/
|
||||
@Test void testWithUnknownHash() {
|
||||
@Test
|
||||
void testWithUnknownHash() {
|
||||
final ControllerSecurityToken securityToken = prepareSecurityToken(UNKNOWN_HASH);
|
||||
when(tenantConfigurationManagementMock.getConfigurationValue(
|
||||
TenantConfigurationKey.AUTHENTICATION_MODE_HEADER_AUTHORITY_NAME, String.class))
|
||||
@@ -128,7 +131,8 @@ class SecurityHeaderAuthenticatorTest {
|
||||
/**
|
||||
* Tests that if CN doesn't match the CN in the security token, the authentication fails
|
||||
*/
|
||||
@Test void testWithNonMatchingCN() {
|
||||
@Test
|
||||
void testWithNonMatchingCN() {
|
||||
final ControllerSecurityToken securityToken = new ControllerSecurityToken("DEFAULT", "otherControllerID");
|
||||
securityToken.putHeader(CA_COMMON_NAME, CA_COMMON_NAME_VALUE);
|
||||
securityToken.putHeader(X_SSL_ISSUER_HASH_1, SINGLE_HASH);
|
||||
@@ -139,14 +143,16 @@ class SecurityHeaderAuthenticatorTest {
|
||||
/**
|
||||
* Tests that if the hash miss, the authentication fails
|
||||
*/
|
||||
@Test void testWithoutHash() {
|
||||
@Test
|
||||
void testWithoutHash() {
|
||||
assertThat(authenticator.authenticate(new ControllerSecurityToken("DEFAULT", CA_COMMON_NAME_VALUE))).isNull();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that if disabled, the authentication fails
|
||||
*/
|
||||
@Test void testWithSingleKnownHashButDisabled() {
|
||||
@Test
|
||||
void testWithSingleKnownHashButDisabled() {
|
||||
final ControllerSecurityToken securityToken = prepareSecurityToken(SINGLE_HASH);
|
||||
when(tenantConfigurationManagementMock.getConfigurationValue(
|
||||
TenantConfigurationKey.AUTHENTICATION_MODE_HEADER_ENABLED, Boolean.class))
|
||||
|
||||
@@ -68,7 +68,8 @@ class SecurityTokenAuthenticatorTest {
|
||||
/**
|
||||
* Tests successful authentication with gateway token
|
||||
*/
|
||||
@Test void testWithSecToken() {
|
||||
@Test
|
||||
void testWithSecToken() {
|
||||
final ControllerSecurityToken securityToken = prepareSecurityToken(SECURITY_TOKEN);
|
||||
when(tenantConfigurationManagementMock.getConfigurationValue(
|
||||
TenantConfigurationKey.AUTHENTICATION_MODE_TARGET_SECURITY_TOKEN_ENABLED, Boolean.class))
|
||||
@@ -87,7 +88,8 @@ class SecurityTokenAuthenticatorTest {
|
||||
/**
|
||||
* Tests that if gateway token doesn't match, the authentication fails
|
||||
*/
|
||||
@Test void testWithBadSecToken() {
|
||||
@Test
|
||||
void testWithBadSecToken() {
|
||||
final ControllerSecurityToken securityToken = prepareSecurityToken(UNKNOWN_TOKEN);
|
||||
when(tenantConfigurationManagementMock.getConfigurationValue(
|
||||
TenantConfigurationKey.AUTHENTICATION_MODE_TARGET_SECURITY_TOKEN_ENABLED, Boolean.class))
|
||||
@@ -99,14 +101,16 @@ class SecurityTokenAuthenticatorTest {
|
||||
/**
|
||||
* Tests that if gateway token miss, the authentication fails
|
||||
*/
|
||||
@Test void testWithoutSecToken() {
|
||||
@Test
|
||||
void testWithoutSecToken() {
|
||||
assertThat(authenticator.authenticate(new ControllerSecurityToken("DEFAULT", CONTROLLER_ID))).isNull();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that if disabled, the authentication fails
|
||||
*/
|
||||
@Test void testWithSecTokenButDisabled() {
|
||||
@Test
|
||||
void testWithSecTokenButDisabled() {
|
||||
final ControllerSecurityToken securityToken = prepareSecurityToken(SECURITY_TOKEN);
|
||||
when(tenantConfigurationManagementMock.getConfigurationValue(
|
||||
TenantConfigurationKey.AUTHENTICATION_MODE_TARGET_SECURITY_TOKEN_ENABLED, Boolean.class))
|
||||
|
||||
@@ -29,7 +29,8 @@ class AllowedHostNamesTest extends AbstractSecurityTest {
|
||||
/**
|
||||
* Tests whether a RequestRejectedException is thrown when not allowed host is used
|
||||
*/
|
||||
@Test void allowedHostNameWithNotAllowedHost() throws Exception {
|
||||
@Test
|
||||
void allowedHostNameWithNotAllowedHost() throws Exception {
|
||||
mvc.perform(get("/").header(HttpHeaders.HOST, "www.google.com"))
|
||||
.andExpect(status().isBadRequest());
|
||||
}
|
||||
@@ -37,7 +38,8 @@ class AllowedHostNamesTest extends AbstractSecurityTest {
|
||||
/**
|
||||
* Tests whether request is redirected when allowed host is used
|
||||
*/
|
||||
@Test void allowedHostNameWithAllowedHost() throws Exception {
|
||||
@Test
|
||||
void allowedHostNameWithAllowedHost() throws Exception {
|
||||
mvc.perform(get("/").header(HttpHeaders.HOST, "localhost"))
|
||||
.andExpect(status().is3xxRedirection());
|
||||
}
|
||||
@@ -45,7 +47,8 @@ class AllowedHostNamesTest extends AbstractSecurityTest {
|
||||
/**
|
||||
* Tests whether request without allowed host name and with ignored path end up with a client error
|
||||
*/
|
||||
@Test void notAllowedHostnameWithIgnoredPath() throws Exception {
|
||||
@Test
|
||||
void notAllowedHostnameWithIgnoredPath() throws Exception {
|
||||
mvc.perform(get("/index.html").header(HttpHeaders.HOST, "www.google.com"))
|
||||
.andExpect(status().is4xxClientError());
|
||||
}
|
||||
|
||||
@@ -28,7 +28,8 @@ class PreAuthorizeEnabledTest extends AbstractSecurityTest {
|
||||
/**
|
||||
* Tests whether request fail if a role is forbidden for the user
|
||||
*/
|
||||
@Test @WithUser(authorities = { SpPermission.READ_TARGET }, autoCreateTenant = false)
|
||||
@Test
|
||||
@WithUser(authorities = { SpPermission.READ_TARGET }, autoCreateTenant = false)
|
||||
void failIfNoRole() throws Exception {
|
||||
mvc.perform(get("/DEFAULT/controller/v1/controllerId"))
|
||||
.andExpect(result -> assertThat(result.getResponse().getStatus()).isEqualTo(HttpStatus.FORBIDDEN.value()));
|
||||
@@ -37,7 +38,8 @@ class PreAuthorizeEnabledTest extends AbstractSecurityTest {
|
||||
/**
|
||||
* Tests whether request succeed if a role is granted for the user
|
||||
*/
|
||||
@Test @WithUser(authorities = { SpPermission.SpringEvalExpressions.CONTROLLER_ROLE }, autoCreateTenant = false)
|
||||
@Test
|
||||
@WithUser(authorities = { SpPermission.SpringEvalExpressions.CONTROLLER_ROLE }, autoCreateTenant = false)
|
||||
void successIfHasRole() throws Exception {
|
||||
mvc.perform(get("/DEFAULT/controller/v1/controllerId"))
|
||||
.andExpect(result -> assertThat(result.getResponse().getStatus()).isEqualTo(HttpStatus.OK.value()));
|
||||
|
||||
Reference in New Issue
Block a user