Increase target name to 128 and target controller id to 256 (#849)
* Increase target name to 128 and target controller id to 256 * Fix test failures by using constant NamedEntity.NAME_MAX_SIZE + 1 * Use constant NamedEntity.NAME_MAX_SIZE + 1 for mgmt-resource tests * Add db migration scripts to increase the controllerId and name limit * Fix review issues * Use correct constant field for junit tests * Change Hawkbit documentation url of application-<db>.properties * Add new line at the end of db migration scripts * Update assertion description * Revert copyright years to its creator year * Add DDI-, AMQP- and controller management-tests Signed-off-by: Florian Ruschbaschan <Florian.Ruschbaschan@bosch-si.com>
This commit is contained in:
committed by
Stefan Behl
parent
568848bb27
commit
f6c0edffa5
@@ -21,8 +21,7 @@ import java.util.Optional;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import org.apache.commons.lang3.RandomStringUtils;
|
||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
||||||
import org.eclipse.hawkbit.amqp.AmqpProperties;
|
import org.eclipse.hawkbit.amqp.AmqpProperties;
|
||||||
import org.eclipse.hawkbit.dmf.amqp.api.EventTopic;
|
import org.eclipse.hawkbit.dmf.amqp.api.EventTopic;
|
||||||
import org.eclipse.hawkbit.dmf.amqp.api.MessageHeaderKey;
|
import org.eclipse.hawkbit.dmf.amqp.api.MessageHeaderKey;
|
||||||
@@ -60,6 +59,9 @@ import org.springframework.amqp.core.MessageProperties;
|
|||||||
import org.springframework.amqp.rabbit.core.RabbitAdmin;
|
import org.springframework.amqp.rabbit.core.RabbitAdmin;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
|
|
||||||
import io.qameta.allure.Description;
|
import io.qameta.allure.Description;
|
||||||
import io.qameta.allure.Feature;
|
import io.qameta.allure.Feature;
|
||||||
import io.qameta.allure.Step;
|
import io.qameta.allure.Step;
|
||||||
@@ -87,8 +89,8 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests register target")
|
@Description("Tests register target")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 2),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetPollEvent.class, count = 3) })
|
@Expect(type = TargetPollEvent.class, count = 3)})
|
||||||
public void registerTargets() {
|
public void registerTargets() {
|
||||||
final String controllerId = TARGET_PREFIX + "registerTargets";
|
final String controllerId = TARGET_PREFIX + "registerTargets";
|
||||||
registerAndAssertTargetWithExistingTenant(controllerId, 1);
|
registerAndAssertTargetWithExistingTenant(controllerId, 1);
|
||||||
@@ -101,38 +103,44 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests register invalid target withy empty controller id. Tests register invalid target with null controller id")
|
@Description("Tests register invalid target withy empty controller id.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 0)})
|
||||||
public void registerEmptyTarget() {
|
public void registerEmptyTarget() {
|
||||||
createAndSendThingCreated("", TENANT_EXIST);
|
createAndSendThingCreated("", TENANT_EXIST);
|
||||||
assertAllTargetsCount(0);
|
assertAllTargetsCount(0);
|
||||||
verifyOneDeadLetterMessage();
|
verifyOneDeadLetterMessage();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests register invalid target with whitspace controller id. Tests register invalid target with null controller id")
|
@Description("Tests register invalid target with whitspace controller id.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 0)})
|
||||||
public void registerWhitespaceTarget() {
|
public void registerWhitespaceTarget() {
|
||||||
createAndSendThingCreated("Invalid Invalid", TENANT_EXIST);
|
createAndSendThingCreated("Invalid Invalid", TENANT_EXIST);
|
||||||
assertAllTargetsCount(0);
|
assertAllTargetsCount(0);
|
||||||
verifyOneDeadLetterMessage();
|
verifyOneDeadLetterMessage();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests register invalid target with null controller id. Tests register invalid target with null controller id")
|
@Description("Tests register invalid target with null controller id.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 0)})
|
||||||
public void registerInvalidNullTargets() {
|
public void registerInvalidNullTarget() {
|
||||||
createAndSendThingCreated(null, TENANT_EXIST);
|
createAndSendThingCreated(null, TENANT_EXIST);
|
||||||
assertAllTargetsCount(0);
|
assertAllTargetsCount(0);
|
||||||
verifyOneDeadLetterMessage();
|
verifyOneDeadLetterMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Description("Tests register invalid target with too long controller id")
|
||||||
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 0)})
|
||||||
|
public void registerInvalidTargetWithTooLongControllerId() {
|
||||||
|
createAndSendThingCreated(RandomStringUtils.randomAlphabetic(Target.CONTROLLER_ID_MAX_SIZE + 1), TENANT_EXIST);
|
||||||
|
assertAllTargetsCount(0);
|
||||||
|
verifyOneDeadLetterMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests null reply to property in message header. This message should forwarded to the deadletter queue")
|
@Description("Tests null reply to property in message header. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 0)})
|
||||||
public void missingReplyToProperty() {
|
public void missingReplyToProperty() {
|
||||||
final String controllerId = TARGET_PREFIX + "missingReplyToProperty";
|
final String controllerId = TARGET_PREFIX + "missingReplyToProperty";
|
||||||
final Message createTargetMessage = createTargetMessage(controllerId, TENANT_EXIST);
|
final Message createTargetMessage = createTargetMessage(controllerId, TENANT_EXIST);
|
||||||
@@ -145,7 +153,7 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests missing reply to property in message header. This message should forwarded to the deadletter queue")
|
@Description("Tests missing reply to property in message header. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 0)})
|
||||||
public void emptyReplyToProperty() {
|
public void emptyReplyToProperty() {
|
||||||
final String controllerId = TARGET_PREFIX + "emptyReplyToProperty";
|
final String controllerId = TARGET_PREFIX + "emptyReplyToProperty";
|
||||||
final Message createTargetMessage = createTargetMessage(controllerId, TENANT_EXIST);
|
final Message createTargetMessage = createTargetMessage(controllerId, TENANT_EXIST);
|
||||||
@@ -158,7 +166,7 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests missing thing id property in message. This message should forwarded to the deadletter queue")
|
@Description("Tests missing thing id property in message. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 0)})
|
||||||
public void missingThingIdProperty() {
|
public void missingThingIdProperty() {
|
||||||
final Message createTargetMessage = createTargetMessage(null, TENANT_EXIST);
|
final Message createTargetMessage = createTargetMessage(null, TENANT_EXIST);
|
||||||
createTargetMessage.getMessageProperties().getHeaders().remove(MessageHeaderKey.THING_ID);
|
createTargetMessage.getMessageProperties().getHeaders().remove(MessageHeaderKey.THING_ID);
|
||||||
@@ -170,7 +178,7 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests null thing id property in message. This message should forwarded to the deadletter queue")
|
@Description("Tests null thing id property in message. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 0)})
|
||||||
public void nullThingIdProperty() {
|
public void nullThingIdProperty() {
|
||||||
final Message createTargetMessage = createTargetMessage(null, TENANT_EXIST);
|
final Message createTargetMessage = createTargetMessage(null, TENANT_EXIST);
|
||||||
getDmfClient().send(createTargetMessage);
|
getDmfClient().send(createTargetMessage);
|
||||||
@@ -181,7 +189,7 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests missing tenant message header. This message should forwarded to the deadletter queue")
|
@Description("Tests missing tenant message header. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 0)})
|
||||||
public void missingTenantHeader() {
|
public void missingTenantHeader() {
|
||||||
final String controllerId = TARGET_PREFIX + "missingTenantHeader";
|
final String controllerId = TARGET_PREFIX + "missingTenantHeader";
|
||||||
final Message createTargetMessage = createTargetMessage(controllerId, TENANT_EXIST);
|
final Message createTargetMessage = createTargetMessage(controllerId, TENANT_EXIST);
|
||||||
@@ -194,7 +202,7 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests null tenant message header. This message should forwarded to the deadletter queue")
|
@Description("Tests null tenant message header. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 0)})
|
||||||
public void nullTenantHeader() {
|
public void nullTenantHeader() {
|
||||||
final String controllerId = TARGET_PREFIX + "nullTenantHeader";
|
final String controllerId = TARGET_PREFIX + "nullTenantHeader";
|
||||||
final Message createTargetMessage = createTargetMessage(controllerId, null);
|
final Message createTargetMessage = createTargetMessage(controllerId, null);
|
||||||
@@ -206,7 +214,7 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests empty tenant message header. This message should forwarded to the deadletter queue")
|
@Description("Tests empty tenant message header. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 0)})
|
||||||
public void emptyTenantHeader() {
|
public void emptyTenantHeader() {
|
||||||
final String controllerId = TARGET_PREFIX + "emptyTenantHeader";
|
final String controllerId = TARGET_PREFIX + "emptyTenantHeader";
|
||||||
final Message createTargetMessage = createTargetMessage(controllerId, "");
|
final Message createTargetMessage = createTargetMessage(controllerId, "");
|
||||||
@@ -218,7 +226,7 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests tenant not exist. This message should forwarded to the deadletter queue")
|
@Description("Tests tenant not exist. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 0)})
|
||||||
public void tenantNotExist() {
|
public void tenantNotExist() {
|
||||||
final String controllerId = TARGET_PREFIX + "tenantNotExist";
|
final String controllerId = TARGET_PREFIX + "tenantNotExist";
|
||||||
final Message createTargetMessage = createTargetMessage(controllerId, "TenantNotExist");
|
final Message createTargetMessage = createTargetMessage(controllerId, "TenantNotExist");
|
||||||
@@ -230,7 +238,7 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests missing type message header. This message should forwarded to the deadletter queue")
|
@Description("Tests missing type message header. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 0)})
|
||||||
public void missingTypeHeader() {
|
public void missingTypeHeader() {
|
||||||
final Message createTargetMessage = createTargetMessage(null, TENANT_EXIST);
|
final Message createTargetMessage = createTargetMessage(null, TENANT_EXIST);
|
||||||
createTargetMessage.getMessageProperties().getHeaders().remove(MessageHeaderKey.TYPE);
|
createTargetMessage.getMessageProperties().getHeaders().remove(MessageHeaderKey.TYPE);
|
||||||
@@ -242,7 +250,7 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests null type message header. This message should forwarded to the deadletter queue")
|
@Description("Tests null type message header. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 0)})
|
||||||
public void nullTypeHeader() {
|
public void nullTypeHeader() {
|
||||||
final Message createTargetMessage = createTargetMessage(null, TENANT_EXIST);
|
final Message createTargetMessage = createTargetMessage(null, TENANT_EXIST);
|
||||||
createTargetMessage.getMessageProperties().getHeaders().put(MessageHeaderKey.TYPE, null);
|
createTargetMessage.getMessageProperties().getHeaders().put(MessageHeaderKey.TYPE, null);
|
||||||
@@ -254,7 +262,7 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests empty type message header. This message should forwarded to the deadletter queue")
|
@Description("Tests empty type message header. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 0)})
|
||||||
public void emptyTypeHeader() {
|
public void emptyTypeHeader() {
|
||||||
final Message createTargetMessage = createTargetMessage(null, TENANT_EXIST);
|
final Message createTargetMessage = createTargetMessage(null, TENANT_EXIST);
|
||||||
createTargetMessage.getMessageProperties().getHeaders().put(MessageHeaderKey.TYPE, "");
|
createTargetMessage.getMessageProperties().getHeaders().put(MessageHeaderKey.TYPE, "");
|
||||||
@@ -266,7 +274,7 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests invalid type message header. This message should forwarded to the deadletter queue")
|
@Description("Tests invalid type message header. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 0)})
|
||||||
public void invalidTypeHeader() {
|
public void invalidTypeHeader() {
|
||||||
final Message createTargetMessage = createTargetMessage(null, TENANT_EXIST);
|
final Message createTargetMessage = createTargetMessage(null, TENANT_EXIST);
|
||||||
createTargetMessage.getMessageProperties().getHeaders().put(MessageHeaderKey.TYPE, "NotExist");
|
createTargetMessage.getMessageProperties().getHeaders().put(MessageHeaderKey.TYPE, "NotExist");
|
||||||
@@ -278,7 +286,7 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests null topic message header. This message should forwarded to the deadletter queue")
|
@Description("Tests null topic message header. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 0)})
|
||||||
public void nullTopicHeader() {
|
public void nullTopicHeader() {
|
||||||
final Message eventMessage = createEventMessage(TENANT_EXIST, EventTopic.UPDATE_ACTION_STATUS, "");
|
final Message eventMessage = createEventMessage(TENANT_EXIST, EventTopic.UPDATE_ACTION_STATUS, "");
|
||||||
eventMessage.getMessageProperties().getHeaders().put(MessageHeaderKey.TOPIC, null);
|
eventMessage.getMessageProperties().getHeaders().put(MessageHeaderKey.TOPIC, null);
|
||||||
@@ -289,7 +297,7 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests null topic message header. This message should forwarded to the deadletter queue")
|
@Description("Tests null topic message header. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 0)})
|
||||||
public void emptyTopicHeader() {
|
public void emptyTopicHeader() {
|
||||||
final Message eventMessage = createEventMessage(TENANT_EXIST, EventTopic.UPDATE_ACTION_STATUS, "");
|
final Message eventMessage = createEventMessage(TENANT_EXIST, EventTopic.UPDATE_ACTION_STATUS, "");
|
||||||
eventMessage.getMessageProperties().getHeaders().put(MessageHeaderKey.TOPIC, "");
|
eventMessage.getMessageProperties().getHeaders().put(MessageHeaderKey.TOPIC, "");
|
||||||
@@ -300,7 +308,7 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests null topic message header. This message should forwarded to the deadletter queue")
|
@Description("Tests null topic message header. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 0)})
|
||||||
public void invalidTopicHeader() {
|
public void invalidTopicHeader() {
|
||||||
final Message eventMessage = createEventMessage(TENANT_EXIST, EventTopic.UPDATE_ACTION_STATUS, "");
|
final Message eventMessage = createEventMessage(TENANT_EXIST, EventTopic.UPDATE_ACTION_STATUS, "");
|
||||||
eventMessage.getMessageProperties().getHeaders().put(MessageHeaderKey.TOPIC, "NotExist");
|
eventMessage.getMessageProperties().getHeaders().put(MessageHeaderKey.TOPIC, "NotExist");
|
||||||
@@ -311,7 +319,7 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests missing topic message header. This message should forwarded to the deadletter queue")
|
@Description("Tests missing topic message header. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 0)})
|
||||||
public void missingTopicHeader() {
|
public void missingTopicHeader() {
|
||||||
final Message eventMessage = createEventMessage(TENANT_EXIST, EventTopic.UPDATE_ACTION_STATUS, "");
|
final Message eventMessage = createEventMessage(TENANT_EXIST, EventTopic.UPDATE_ACTION_STATUS, "");
|
||||||
eventMessage.getMessageProperties().getHeaders().remove(MessageHeaderKey.TOPIC);
|
eventMessage.getMessageProperties().getHeaders().remove(MessageHeaderKey.TOPIC);
|
||||||
@@ -322,7 +330,7 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests invalid null message content. This message should forwarded to the deadletter queue")
|
@Description("Tests invalid null message content. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 0)})
|
||||||
public void updateActionStatusWithNullContent() {
|
public void updateActionStatusWithNullContent() {
|
||||||
final Message eventMessage = createEventMessage(TENANT_EXIST, EventTopic.UPDATE_ACTION_STATUS, null);
|
final Message eventMessage = createEventMessage(TENANT_EXIST, EventTopic.UPDATE_ACTION_STATUS, null);
|
||||||
getDmfClient().send(eventMessage);
|
getDmfClient().send(eventMessage);
|
||||||
@@ -331,7 +339,7 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests invalid empty message content. This message should forwarded to the deadletter queue")
|
@Description("Tests invalid empty message content. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 0)})
|
||||||
public void updateActionStatusWithEmptyContent() {
|
public void updateActionStatusWithEmptyContent() {
|
||||||
final Message eventMessage = createEventMessage(TENANT_EXIST, EventTopic.UPDATE_ACTION_STATUS, "");
|
final Message eventMessage = createEventMessage(TENANT_EXIST, EventTopic.UPDATE_ACTION_STATUS, "");
|
||||||
getDmfClient().send(eventMessage);
|
getDmfClient().send(eventMessage);
|
||||||
@@ -340,7 +348,7 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests invalid json message content. This message should forwarded to the deadletter queue")
|
@Description("Tests invalid json message content. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 0)})
|
||||||
public void updateActionStatusWithInvalidJsonContent() {
|
public void updateActionStatusWithInvalidJsonContent() {
|
||||||
final Message eventMessage = createEventMessage(TENANT_EXIST, EventTopic.UPDATE_ACTION_STATUS,
|
final Message eventMessage = createEventMessage(TENANT_EXIST, EventTopic.UPDATE_ACTION_STATUS,
|
||||||
"Invalid Content");
|
"Invalid Content");
|
||||||
@@ -350,7 +358,7 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests invalid topic message header. This message should forwarded to the deadletter queue")
|
@Description("Tests invalid topic message header. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 0)})
|
||||||
public void updateActionStatusWithInvalidActionId() {
|
public void updateActionStatusWithInvalidActionId() {
|
||||||
final DmfActionUpdateStatus actionUpdateStatus = new DmfActionUpdateStatus(1L, DmfActionStatus.RUNNING);
|
final DmfActionUpdateStatus actionUpdateStatus = new DmfActionUpdateStatus(1L, DmfActionStatus.RUNNING);
|
||||||
final Message eventMessage = createEventMessage(TENANT_EXIST, EventTopic.UPDATE_ACTION_STATUS,
|
final Message eventMessage = createEventMessage(TENANT_EXIST, EventTopic.UPDATE_ACTION_STATUS,
|
||||||
@@ -361,14 +369,14 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests register target and send finished message")
|
@Description("Tests register target and send finished message")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = ActionUpdatedEvent.class, count = 1), @Expect(type = ActionCreatedEvent.class, count = 1),
|
@Expect(type = ActionUpdatedEvent.class, count = 1), @Expect(type = ActionCreatedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAttributesRequestedEvent.class, count = 1),
|
@Expect(type = TargetAttributesRequestedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 2), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 2), @Expect(type = TargetPollEvent.class, count = 1)})
|
||||||
public void finishActionStatus() {
|
public void finishActionStatus() {
|
||||||
final String controllerId = TARGET_PREFIX + "finishActionStatus";
|
final String controllerId = TARGET_PREFIX + "finishActionStatus";
|
||||||
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.FINISHED, Status.FINISHED, controllerId);
|
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.FINISHED, Status.FINISHED, controllerId);
|
||||||
@@ -376,13 +384,13 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Register a target and send a update action status (running). Verfiy if the updated action status is correct.")
|
@Description("Register a target and send a update action status (running). Verfiy if the updated action status is correct.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = ActionUpdatedEvent.class, count = 0), @Expect(type = ActionCreatedEvent.class, count = 1),
|
@Expect(type = ActionUpdatedEvent.class, count = 0), @Expect(type = ActionCreatedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1)})
|
||||||
public void runningActionStatus() {
|
public void runningActionStatus() {
|
||||||
final String controllerId = TARGET_PREFIX + "runningActionStatus";
|
final String controllerId = TARGET_PREFIX + "runningActionStatus";
|
||||||
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.RUNNING, Status.RUNNING, controllerId);
|
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.RUNNING, Status.RUNNING, controllerId);
|
||||||
@@ -390,13 +398,13 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Register a target and send an update action status (downloaded). Verfiy if the updated action status is correct.")
|
@Description("Register a target and send an update action status (downloaded). Verfiy if the updated action status is correct.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = ActionUpdatedEvent.class, count = 0), @Expect(type = ActionCreatedEvent.class, count = 1),
|
@Expect(type = ActionUpdatedEvent.class, count = 0), @Expect(type = ActionCreatedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1)})
|
||||||
public void downloadedActionStatus() {
|
public void downloadedActionStatus() {
|
||||||
final String controllerId = TARGET_PREFIX + "downloadedActionStatus";
|
final String controllerId = TARGET_PREFIX + "downloadedActionStatus";
|
||||||
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.DOWNLOADED, Status.DOWNLOADED, controllerId);
|
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.DOWNLOADED, Status.DOWNLOADED, controllerId);
|
||||||
@@ -404,13 +412,13 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Register a target and send a update action status (download). Verfiy if the updated action status is correct.")
|
@Description("Register a target and send a update action status (download). Verfiy if the updated action status is correct.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1)})
|
||||||
public void downloadActionStatus() {
|
public void downloadActionStatus() {
|
||||||
final String controllerId = TARGET_PREFIX + "downloadActionStatus";
|
final String controllerId = TARGET_PREFIX + "downloadActionStatus";
|
||||||
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.DOWNLOAD, Status.DOWNLOAD, controllerId);
|
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.DOWNLOAD, Status.DOWNLOAD, controllerId);
|
||||||
@@ -418,13 +426,13 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Register a target and send a update action status (error). Verfiy if the updated action status is correct.")
|
@Description("Register a target and send a update action status (error). Verfiy if the updated action status is correct.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = ActionUpdatedEvent.class, count = 1), @Expect(type = ActionCreatedEvent.class, count = 1),
|
@Expect(type = ActionUpdatedEvent.class, count = 1), @Expect(type = ActionCreatedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 2), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 2), @Expect(type = TargetPollEvent.class, count = 1)})
|
||||||
public void errorActionStatus() {
|
public void errorActionStatus() {
|
||||||
final String controllerId = TARGET_PREFIX + "errorActionStatus";
|
final String controllerId = TARGET_PREFIX + "errorActionStatus";
|
||||||
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.ERROR, Status.ERROR, controllerId);
|
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.ERROR, Status.ERROR, controllerId);
|
||||||
@@ -432,13 +440,13 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Register a target and send a update action status (warning). Verfiy if the updated action status is correct.")
|
@Description("Register a target and send a update action status (warning). Verfiy if the updated action status is correct.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1)})
|
||||||
public void warningActionStatus() {
|
public void warningActionStatus() {
|
||||||
final String controllerId = TARGET_PREFIX + "warningActionStatus";
|
final String controllerId = TARGET_PREFIX + "warningActionStatus";
|
||||||
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.WARNING, Status.WARNING, controllerId);
|
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.WARNING, Status.WARNING, controllerId);
|
||||||
@@ -446,13 +454,13 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Register a target and send a update action status (retrieved). Verfiy if the updated action status is correct.")
|
@Description("Register a target and send a update action status (retrieved). Verfiy if the updated action status is correct.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1)})
|
||||||
public void retrievedActionStatus() {
|
public void retrievedActionStatus() {
|
||||||
final String controllerId = TARGET_PREFIX + "retrievedActionStatus";
|
final String controllerId = TARGET_PREFIX + "retrievedActionStatus";
|
||||||
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.RETRIEVED, Status.RETRIEVED, controllerId);
|
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.RETRIEVED, Status.RETRIEVED, controllerId);
|
||||||
@@ -460,13 +468,13 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Register a target and send a invalid update action status (cancel). This message should forwarded to the deadletter queue")
|
@Description("Register a target and send a invalid update action status (cancel). This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1)})
|
||||||
public void cancelNotAllowActionStatus() {
|
public void cancelNotAllowActionStatus() {
|
||||||
final String controllerId = TARGET_PREFIX + "cancelNotAllowActionStatus";
|
final String controllerId = TARGET_PREFIX + "cancelNotAllowActionStatus";
|
||||||
registerTargetAndSendActionStatus(DmfActionStatus.CANCELED, controllerId);
|
registerTargetAndSendActionStatus(DmfActionStatus.CANCELED, controllerId);
|
||||||
@@ -475,13 +483,13 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Verfiy receiving a download and install message if a deployment is done before the target has polled the first time.")
|
@Description("Verfiy receiving a download and install message if a deployment is done before the target has polled the first time.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 2) })
|
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 2)})
|
||||||
public void receiveDownLoadAndInstallMessageAfterAssignment() {
|
public void receiveDownLoadAndInstallMessageAfterAssignment() {
|
||||||
final String controllerId = TARGET_PREFIX + "receiveDownLoadAndInstallMessageAfterAssignment";
|
final String controllerId = TARGET_PREFIX + "receiveDownLoadAndInstallMessageAfterAssignment";
|
||||||
|
|
||||||
@@ -501,13 +509,13 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Verfiy receiving a download message if a deployment is done with window configured but before maintenance window start time.")
|
@Description("Verfiy receiving a download message if a deployment is done with window configured but before maintenance window start time.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 2) })
|
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 2)})
|
||||||
public void receiveDownloadMessageBeforeMaintenanceWindowStartTime() {
|
public void receiveDownloadMessageBeforeMaintenanceWindowStartTime() {
|
||||||
final String controllerId = TARGET_PREFIX + "receiveDownLoadMessageBeforeMaintenanceWindowStartTime";
|
final String controllerId = TARGET_PREFIX + "receiveDownLoadMessageBeforeMaintenanceWindowStartTime";
|
||||||
|
|
||||||
@@ -528,13 +536,13 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Verify receiving a download_and_install message if a deployment is done with window configured and during maintenance window start time.")
|
@Description("Verify receiving a download_and_install message if a deployment is done with window configured and during maintenance window start time.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 2) })
|
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 2)})
|
||||||
public void receiveDownloadAndInstallMessageDuringMaintenanceWindow() {
|
public void receiveDownloadAndInstallMessageDuringMaintenanceWindow() {
|
||||||
final String controllerId = TARGET_PREFIX + "receiveDownLoadAndInstallMessageDuringMaintenanceWindow";
|
final String controllerId = TARGET_PREFIX + "receiveDownLoadAndInstallMessageDuringMaintenanceWindow";
|
||||||
|
|
||||||
@@ -555,14 +563,14 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Verfiy receiving a cancel update message if a deployment is canceled before the target has polled the first time.")
|
@Description("Verfiy receiving a cancel update message if a deployment is canceled before the target has polled the first time.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = CancelTargetAssignmentEvent.class, count = 1),
|
@Expect(type = CancelTargetAssignmentEvent.class, count = 1),
|
||||||
@Expect(type = ActionUpdatedEvent.class, count = 1), @Expect(type = TargetUpdatedEvent.class, count = 1),
|
@Expect(type = ActionUpdatedEvent.class, count = 1), @Expect(type = TargetUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetPollEvent.class, count = 2) })
|
@Expect(type = TargetPollEvent.class, count = 2)})
|
||||||
public void receiveCancelUpdateMessageAfterAssignmentWasCanceled() {
|
public void receiveCancelUpdateMessageAfterAssignmentWasCanceled() {
|
||||||
final String controllerId = TARGET_PREFIX + "receiveCancelUpdateMessageAfterAssignmentWasCanceled";
|
final String controllerId = TARGET_PREFIX + "receiveCancelUpdateMessageAfterAssignmentWasCanceled";
|
||||||
|
|
||||||
@@ -583,14 +591,14 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Register a target and send a invalid update action status (canceled). The current status (pending) is not a canceling state. This message should forwarded to the deadletter queue")
|
@Description("Register a target and send a invalid update action status (canceled). The current status (pending) is not a canceling state. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = ActionUpdatedEvent.class, count = 1), @Expect(type = ActionCreatedEvent.class, count = 1),
|
@Expect(type = ActionUpdatedEvent.class, count = 1), @Expect(type = ActionCreatedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
||||||
@Expect(type = CancelTargetAssignmentEvent.class, count = 1),
|
@Expect(type = CancelTargetAssignmentEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1)})
|
||||||
public void actionNotExists() {
|
public void actionNotExists() {
|
||||||
final String controllerId = TARGET_PREFIX + "actionNotExists";
|
final String controllerId = TARGET_PREFIX + "actionNotExists";
|
||||||
|
|
||||||
@@ -603,13 +611,13 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Register a target and send a invalid update action status (cancel_rejected). This message should forwarded to the deadletter queue")
|
@Description("Register a target and send a invalid update action status (cancel_rejected). This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1)})
|
||||||
public void canceledRejectedNotAllowActionStatus() {
|
public void canceledRejectedNotAllowActionStatus() {
|
||||||
final String controllerId = TARGET_PREFIX + "canceledRejectedNotAllowActionStatus";
|
final String controllerId = TARGET_PREFIX + "canceledRejectedNotAllowActionStatus";
|
||||||
registerTargetAndSendActionStatus(DmfActionStatus.CANCEL_REJECTED, controllerId);
|
registerTargetAndSendActionStatus(DmfActionStatus.CANCEL_REJECTED, controllerId);
|
||||||
@@ -618,14 +626,14 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Register a target and send a valid update action status (cancel_rejected). Verfiy if the updated action status is correct.")
|
@Description("Register a target and send a valid update action status (cancel_rejected). Verfiy if the updated action status is correct.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = CancelTargetAssignmentEvent.class, count = 1),
|
@Expect(type = CancelTargetAssignmentEvent.class, count = 1),
|
||||||
@Expect(type = ActionUpdatedEvent.class, count = 1), @Expect(type = ActionCreatedEvent.class, count = 1),
|
@Expect(type = ActionUpdatedEvent.class, count = 1), @Expect(type = ActionCreatedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1)})
|
||||||
public void canceledRejectedActionStatus() {
|
public void canceledRejectedActionStatus() {
|
||||||
final String controllerId = TARGET_PREFIX + "canceledRejectedActionStatus";
|
final String controllerId = TARGET_PREFIX + "canceledRejectedActionStatus";
|
||||||
|
|
||||||
@@ -637,8 +645,8 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Verify that sending an update controller attribute message to an existing target works. Verify that different update modes (merge, replace, remove) can be used.")
|
@Description("Verify that sending an update controller attribute message to an existing target works. Verify that different update modes (merge, replace, remove) can be used.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 4), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 4), @Expect(type = TargetPollEvent.class, count = 1)})
|
||||||
public void updateAttributesWithDifferentUpdateModes() {
|
public void updateAttributesWithDifferentUpdateModes() {
|
||||||
final String controllerId = TARGET_PREFIX + "updateAttributes";
|
final String controllerId = TARGET_PREFIX + "updateAttributes";
|
||||||
|
|
||||||
@@ -740,8 +748,8 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Verify that sending an update controller attribute message with no thingid header to an existing target does not work.")
|
@Description("Verify that sending an update controller attribute message with no thingid header to an existing target does not work.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 0), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 0), @Expect(type = TargetPollEvent.class, count = 1)})
|
||||||
public void updateAttributesWithNoThingId() {
|
public void updateAttributesWithNoThingId() {
|
||||||
final String controllerId = TARGET_PREFIX + "updateAttributesWithNoThingId";
|
final String controllerId = TARGET_PREFIX + "updateAttributesWithNoThingId";
|
||||||
|
|
||||||
@@ -765,8 +773,8 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Verify that sending an update controller attribute message with invalid body to an existing target does not work.")
|
@Description("Verify that sending an update controller attribute message with invalid body to an existing target does not work.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 0), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 0), @Expect(type = TargetPollEvent.class, count = 1)})
|
||||||
public void updateAttributesWithWrongBody() {
|
public void updateAttributesWithWrongBody() {
|
||||||
|
|
||||||
// setup
|
// setup
|
||||||
@@ -805,19 +813,17 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
verifyNumberOfDeadLetterMessages(3);
|
verifyNumberOfDeadLetterMessages(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests the download_only assignment: tests the handling of a target reporting DOWNLOADED")
|
@Description("Tests the download_only assignment: tests the handling of a target reporting DOWNLOADED")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = ActionUpdatedEvent.class, count = 1), @Expect(type = ActionCreatedEvent.class, count = 1),
|
@Expect(type = ActionUpdatedEvent.class, count = 1), @Expect(type = ActionCreatedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAttributesRequestedEvent.class, count = 1),
|
@Expect(type = TargetAttributesRequestedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 2), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 2), @Expect(type = TargetPollEvent.class, count = 1)})
|
||||||
public void downloadOnlyAssignmentFinishesActionWhenTargetReportsDownloaded()
|
public void downloadOnlyAssignmentFinishesActionWhenTargetReportsDownloaded() throws IOException {
|
||||||
throws IOException {
|
|
||||||
// create target
|
// create target
|
||||||
final String controllerId = TARGET_PREFIX + "registerTargets_1";
|
final String controllerId = TARGET_PREFIX + "registerTargets_1";
|
||||||
final DistributionSet distributionSet = createTargetAndDistributionSetAndAssign(controllerId, DOWNLOAD_ONLY);
|
final DistributionSet distributionSet = createTargetAndDistributionSetAndAssign(controllerId, DOWNLOAD_ONLY);
|
||||||
@@ -839,16 +845,14 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests the download_only assignment: tests the handling of a target reporting FINISHED")
|
@Description("Tests the download_only assignment: tests the handling of a target reporting FINISHED")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = ActionUpdatedEvent.class, count = 2),
|
@Expect(type = ActionUpdatedEvent.class, count = 2), @Expect(type = ActionCreatedEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1),
|
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAttributesRequestedEvent.class, count = 2),
|
@Expect(type = TargetAttributesRequestedEvent.class, count = 2),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 3),
|
@Expect(type = TargetUpdatedEvent.class, count = 3), @Expect(type = TargetPollEvent.class, count = 1)})
|
||||||
@Expect(type = TargetPollEvent.class, count = 1) })
|
|
||||||
public void downloadOnlyAssignmentAllowsActionStatusUpdatesWhenTargetReportsFinishedAndUpdatesInstalledDS()
|
public void downloadOnlyAssignmentAllowsActionStatusUpdatesWhenTargetReportsFinishedAndUpdatesInstalledDS()
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
|
||||||
@@ -874,7 +878,7 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServic
|
|||||||
sendActionUpdateStatus(new DmfActionUpdateStatus(actionId, DmfActionStatus.FINISHED));
|
sendActionUpdateStatus(new DmfActionUpdateStatus(actionId, DmfActionStatus.FINISHED));
|
||||||
assertAction(actionId, 2, Status.RUNNING, Status.DOWNLOADED, Status.FINISHED);
|
assertAction(actionId, 2, Status.RUNNING, Status.DOWNLOADED, Status.FINISHED);
|
||||||
Mockito.verifyZeroInteractions(getDeadletterListener());
|
Mockito.verifyZeroInteractions(getDeadletterListener());
|
||||||
|
|
||||||
verifyAssignedDsAndInstalledDs(controllerId, distributionSet.getId(), distributionSet.getId());
|
verifyAssignedDsAndInstalledDs(controllerId, distributionSet.getId(), distributionSet.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public interface NamedEntity extends TenantAwareBaseEntity {
|
|||||||
/**
|
/**
|
||||||
* Maximum length of name.
|
* Maximum length of name.
|
||||||
*/
|
*/
|
||||||
int NAME_MAX_SIZE = 64;
|
int NAME_MAX_SIZE = 128;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum length of description.
|
* Maximum length of description.
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public interface Target extends NamedEntity {
|
|||||||
/**
|
/**
|
||||||
* Maximum length of controllerId.
|
* Maximum length of controllerId.
|
||||||
*/
|
*/
|
||||||
int CONTROLLER_ID_MAX_SIZE = 64;
|
int CONTROLLER_ID_MAX_SIZE = 256;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum length of securityToken.
|
* Maximum length of securityToken.
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
ALTER TABLE sp_distribution_set ALTER COLUMN name SET DATA TYPE VARCHAR(128);
|
||||||
|
ALTER TABLE sp_distribution_set_type ALTER COLUMN name SET DATA TYPE VARCHAR(128);
|
||||||
|
ALTER TABLE sp_distributionset_tag ALTER COLUMN name SET DATA TYPE VARCHAR(128);
|
||||||
|
ALTER TABLE sp_base_software_module ALTER COLUMN name SET DATA TYPE VARCHAR(128);
|
||||||
|
ALTER TABLE sp_rollout ALTER COLUMN name SET DATA TYPE VARCHAR(128);
|
||||||
|
ALTER TABLE sp_rolloutgroup ALTER COLUMN name SET DATA TYPE VARCHAR(128);
|
||||||
|
ALTER TABLE sp_software_module_type ALTER COLUMN name SET DATA TYPE VARCHAR(128);
|
||||||
|
ALTER TABLE sp_target ALTER COLUMN name SET DATA TYPE VARCHAR(128);
|
||||||
|
ALTER TABLE sp_target_filter_query ALTER COLUMN name SET DATA TYPE VARCHAR(128);
|
||||||
|
ALTER TABLE sp_target_tag ALTER COLUMN name SET DATA TYPE VARCHAR(128);
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE sp_target ALTER COLUMN controller_id SET DATA TYPE VARCHAR(256);
|
||||||
@@ -27,11 +27,7 @@ CREATE TABLE sp_action
|
|||||||
maintenance_duration VARCHAR(40),
|
maintenance_duration VARCHAR(40),
|
||||||
maintenance_time_zone VARCHAR(40),
|
maintenance_time_zone VARCHAR(40),
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY (id)
|
||||||
);
|
);
|
||||||
|
|
||||||
ALTER TABLE sp_action ADD column maintenance_cron_schedule VARCHAR(40);
|
|
||||||
ALTER TABLE sp_action ADD column maintenance_duration VARCHAR(40);
|
|
||||||
ALTER TABLE sp_action ADD column maintenance_time_zone VARCHAR(40);
|
|
||||||
|
|
||||||
CREATE INDEX sp_idx_action_01
|
CREATE INDEX sp_idx_action_01
|
||||||
ON sp_action (tenant, distribution_set);
|
ON sp_action (tenant, distribution_set);
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
ALTER TABLE sp_distribution_set ALTER COLUMN name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_distribution_set_type ALTER COLUMN name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_distributionset_tag ALTER COLUMN name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_base_software_module ALTER COLUMN name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_rollout ALTER COLUMN name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_rolloutgroup ALTER COLUMN name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_software_module_type ALTER COLUMN name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_target ALTER COLUMN name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_target_filter_query ALTER COLUMN name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_target_tag ALTER COLUMN name VARCHAR(128);
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE sp_target ALTER COLUMN controller_id VARCHAR(256);
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
ALTER TABLE sp_distribution_set MODIFY name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_distribution_set_type MODIFY name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_distributionset_tag MODIFY name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_base_software_module MODIFY name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_rollout MODIFY name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_rolloutgroup MODIFY name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_software_module_type MODIFY name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_target MODIFY name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_target_filter_query MODIFY name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_target_tag MODIFY name VARCHAR(128);
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE sp_target MODIFY controller_id VARCHAR(256);
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
ALTER TABLE sp_distribution_set ALTER COLUMN name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_distribution_set_type ALTER COLUMN name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_distributionset_tag ALTER COLUMN name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_base_software_module ALTER COLUMN name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_rollout ALTER COLUMN name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_rolloutgroup ALTER COLUMN name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_software_module_type ALTER COLUMN name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_target ALTER COLUMN name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_target_filter_query ALTER COLUMN name VARCHAR(128);
|
||||||
|
ALTER TABLE sp_target_tag ALTER COLUMN name VARCHAR(128);
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE sp_target ALTER COLUMN controller_id VARCHAR(256);
|
||||||
@@ -33,6 +33,7 @@ import java.util.stream.IntStream;
|
|||||||
|
|
||||||
import javax.validation.ConstraintViolationException;
|
import javax.validation.ConstraintViolationException;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.RandomStringUtils;
|
||||||
import org.apache.commons.lang3.RandomUtils;
|
import org.apache.commons.lang3.RandomUtils;
|
||||||
import org.eclipse.hawkbit.repository.RepositoryProperties;
|
import org.eclipse.hawkbit.repository.RepositoryProperties;
|
||||||
import org.eclipse.hawkbit.repository.UpdateMode;
|
import org.eclipse.hawkbit.repository.UpdateMode;
|
||||||
@@ -89,8 +90,8 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
@Test
|
@Test
|
||||||
@Description("Verifies that management get access react as specfied on calls for non existing entities by means "
|
@Description("Verifies that management get access react as specfied on calls for non existing entities by means "
|
||||||
+ "of Optional not present.")
|
+ "of Optional not present.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 1) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 1)})
|
||||||
public void nonExistingEntityAccessReturnsNotPresent() {
|
public void nonExistingEntityAccessReturnsNotPresent() {
|
||||||
final Target target = testdataFactory.createTarget();
|
final Target target = testdataFactory.createTarget();
|
||||||
final SoftwareModule module = testdataFactory.createSoftwareModuleOs();
|
final SoftwareModule module = testdataFactory.createSoftwareModuleOs();
|
||||||
@@ -110,8 +111,8 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
@Test
|
@Test
|
||||||
@Description("Verifies that management queries react as specfied on calls for non existing entities "
|
@Description("Verifies that management queries react as specfied on calls for non existing entities "
|
||||||
+ " by means of throwing EntityNotFoundException.")
|
+ " by means of throwing EntityNotFoundException.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 1) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 1)})
|
||||||
public void entityQueriesReferringToNotExistingEntitiesThrowsException() throws URISyntaxException {
|
public void entityQueriesReferringToNotExistingEntitiesThrowsException() throws URISyntaxException {
|
||||||
final Target target = testdataFactory.createTarget();
|
final Target target = testdataFactory.createTarget();
|
||||||
final SoftwareModule module = testdataFactory.createSoftwareModuleOs();
|
final SoftwareModule module = testdataFactory.createSoftwareModuleOs();
|
||||||
@@ -146,13 +147,13 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Controller confirms successfull update with FINISHED status.")
|
@Description("Controller confirms successfull update with FINISHED status.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = TargetAttributesRequestedEvent.class, count = 1),
|
@Expect(type = TargetAttributesRequestedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3)})
|
||||||
public void controllerConfirmsUpdateWithFinished() {
|
public void controllerConfirmsUpdateWithFinished() {
|
||||||
final Long actionId = createTargetAndAssignDs();
|
final Long actionId = createTargetAndAssignDs();
|
||||||
|
|
||||||
@@ -160,8 +161,8 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
controllerManagement
|
controllerManagement
|
||||||
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.FINISHED));
|
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.FINISHED));
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.IN_SYNC,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.IN_SYNC, Action.Status.FINISHED,
|
||||||
Action.Status.FINISHED, Action.Status.FINISHED, false);
|
Action.Status.FINISHED, false);
|
||||||
|
|
||||||
assertThat(actionStatusRepository.count()).isEqualTo(7);
|
assertThat(actionStatusRepository.count()).isEqualTo(7);
|
||||||
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(7);
|
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(7);
|
||||||
@@ -169,11 +170,11 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Controller confirmation failes with invalid messages.")
|
@Description("Controller confirmation failes with invalid messages.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = TargetUpdatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = TargetUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3)})
|
||||||
public void controllerConfirmationFailsWithInvalidMessages() {
|
public void controllerConfirmationFailsWithInvalidMessages() {
|
||||||
final Long actionId = createTargetAndAssignDs();
|
final Long actionId = createTargetAndAssignDs();
|
||||||
|
|
||||||
@@ -197,22 +198,22 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
@Test
|
@Test
|
||||||
@Description("Controller confirms successfull update with FINISHED status on a action that is on canceling. "
|
@Description("Controller confirms successfull update with FINISHED status on a action that is on canceling. "
|
||||||
+ "Reason: The decission to ignore the cancellation is in fact up to the controller.")
|
+ "Reason: The decission to ignore the cancellation is in fact up to the controller.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 2),
|
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = CancelTargetAssignmentEvent.class, count = 1),
|
@Expect(type = CancelTargetAssignmentEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = TargetAttributesRequestedEvent.class, count = 1),
|
@Expect(type = TargetAttributesRequestedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3)})
|
||||||
public void controllerConfirmsUpdateWithFinishedAndIgnorsCancellationWithThat() {
|
public void controllerConfirmsUpdateWithFinishedAndIgnorsCancellationWithThat() {
|
||||||
final Long actionId = createTargetAndAssignDs();
|
final Long actionId = createTargetAndAssignDs();
|
||||||
deploymentManagement.cancelAction(actionId);
|
deploymentManagement.cancelAction(actionId);
|
||||||
|
|
||||||
controllerManagement
|
controllerManagement
|
||||||
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.FINISHED));
|
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.FINISHED));
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.IN_SYNC,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.IN_SYNC, Action.Status.FINISHED,
|
||||||
Action.Status.FINISHED, Action.Status.FINISHED, false);
|
Action.Status.FINISHED, false);
|
||||||
|
|
||||||
assertThat(actionStatusRepository.count()).isEqualTo(3);
|
assertThat(actionStatusRepository.count()).isEqualTo(3);
|
||||||
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(3);
|
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(3);
|
||||||
@@ -220,11 +221,11 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Update server rejects cancelation feedback if action is not in CANCELING state.")
|
@Description("Update server rejects cancelation feedback if action is not in CANCELING state.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = TargetUpdatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = TargetUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3)})
|
||||||
public void cancellationFeedbackRejectedIfActionIsNotInCanceling() {
|
public void cancellationFeedbackRejectedIfActionIsNotInCanceling() {
|
||||||
final Long actionId = createTargetAndAssignDs();
|
final Long actionId = createTargetAndAssignDs();
|
||||||
|
|
||||||
@@ -236,8 +237,8 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
|
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING, Action.Status.RUNNING,
|
||||||
Action.Status.RUNNING, Action.Status.RUNNING, true);
|
Action.Status.RUNNING, true);
|
||||||
|
|
||||||
assertThat(actionStatusRepository.count()).isEqualTo(1);
|
assertThat(actionStatusRepository.count()).isEqualTo(1);
|
||||||
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(1);
|
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(1);
|
||||||
@@ -246,26 +247,26 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Controller confirms action cancelation with FINISHED status.")
|
@Description("Controller confirms action cancelation with FINISHED status.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 2),
|
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = CancelTargetAssignmentEvent.class, count = 1),
|
@Expect(type = CancelTargetAssignmentEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3)})
|
||||||
public void controllerConfirmsActionCancelationWithFinished() {
|
public void controllerConfirmsActionCancelationWithFinished() {
|
||||||
final Long actionId = createTargetAndAssignDs();
|
final Long actionId = createTargetAndAssignDs();
|
||||||
|
|
||||||
deploymentManagement.cancelAction(actionId);
|
deploymentManagement.cancelAction(actionId);
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING, Action.Status.CANCELING,
|
||||||
Action.Status.CANCELING, Action.Status.CANCELING, true);
|
Action.Status.CANCELING, true);
|
||||||
|
|
||||||
simulateIntermediateStatusOnCancellation(actionId);
|
simulateIntermediateStatusOnCancellation(actionId);
|
||||||
|
|
||||||
controllerManagement
|
controllerManagement
|
||||||
.addCancelActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.FINISHED));
|
.addCancelActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.FINISHED));
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.IN_SYNC,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.IN_SYNC, Action.Status.CANCELED,
|
||||||
Action.Status.CANCELED, Action.Status.FINISHED, false);
|
Action.Status.FINISHED, false);
|
||||||
|
|
||||||
assertThat(actionStatusRepository.count()).isEqualTo(8);
|
assertThat(actionStatusRepository.count()).isEqualTo(8);
|
||||||
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(8);
|
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(8);
|
||||||
@@ -273,26 +274,26 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Controller confirms action cancelation with FINISHED status.")
|
@Description("Controller confirms action cancelation with FINISHED status.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 2),
|
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = CancelTargetAssignmentEvent.class, count = 1),
|
@Expect(type = CancelTargetAssignmentEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3)})
|
||||||
public void controllerConfirmsActionCancelationWithCanceled() {
|
public void controllerConfirmsActionCancelationWithCanceled() {
|
||||||
final Long actionId = createTargetAndAssignDs();
|
final Long actionId = createTargetAndAssignDs();
|
||||||
|
|
||||||
deploymentManagement.cancelAction(actionId);
|
deploymentManagement.cancelAction(actionId);
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING, Action.Status.CANCELING,
|
||||||
Action.Status.CANCELING, Action.Status.CANCELING, true);
|
Action.Status.CANCELING, true);
|
||||||
|
|
||||||
simulateIntermediateStatusOnCancellation(actionId);
|
simulateIntermediateStatusOnCancellation(actionId);
|
||||||
|
|
||||||
controllerManagement
|
controllerManagement
|
||||||
.addCancelActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.CANCELED));
|
.addCancelActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.CANCELED));
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.IN_SYNC,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.IN_SYNC, Action.Status.CANCELED,
|
||||||
Action.Status.CANCELED, Action.Status.CANCELED, false);
|
Action.Status.CANCELED, false);
|
||||||
|
|
||||||
assertThat(actionStatusRepository.count()).isEqualTo(8);
|
assertThat(actionStatusRepository.count()).isEqualTo(8);
|
||||||
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(8);
|
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(8);
|
||||||
@@ -301,26 +302,26 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
@Test
|
@Test
|
||||||
@Description("Controller rejects action cancelation with CANCEL_REJECTED status. Action goes back to RUNNING status as it expects "
|
@Description("Controller rejects action cancelation with CANCEL_REJECTED status. Action goes back to RUNNING status as it expects "
|
||||||
+ "that the controller will continue the original update.")
|
+ "that the controller will continue the original update.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 2),
|
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = CancelTargetAssignmentEvent.class, count = 1),
|
@Expect(type = CancelTargetAssignmentEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3)})
|
||||||
public void controllerRejectsActionCancelationWithReject() {
|
public void controllerRejectsActionCancelationWithReject() {
|
||||||
final Long actionId = createTargetAndAssignDs();
|
final Long actionId = createTargetAndAssignDs();
|
||||||
|
|
||||||
deploymentManagement.cancelAction(actionId);
|
deploymentManagement.cancelAction(actionId);
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING, Action.Status.CANCELING,
|
||||||
Action.Status.CANCELING, Action.Status.CANCELING, true);
|
Action.Status.CANCELING, true);
|
||||||
|
|
||||||
simulateIntermediateStatusOnCancellation(actionId);
|
simulateIntermediateStatusOnCancellation(actionId);
|
||||||
|
|
||||||
controllerManagement.addCancelActionStatus(
|
controllerManagement.addCancelActionStatus(
|
||||||
entityFactory.actionStatus().create(actionId).status(Action.Status.CANCEL_REJECTED));
|
entityFactory.actionStatus().create(actionId).status(Action.Status.CANCEL_REJECTED));
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING, Action.Status.RUNNING,
|
||||||
Action.Status.RUNNING, Action.Status.CANCEL_REJECTED, true);
|
Action.Status.CANCEL_REJECTED, true);
|
||||||
|
|
||||||
assertThat(actionStatusRepository.count()).isEqualTo(8);
|
assertThat(actionStatusRepository.count()).isEqualTo(8);
|
||||||
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(8);
|
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(8);
|
||||||
@@ -329,26 +330,26 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
@Test
|
@Test
|
||||||
@Description("Controller rejects action cancelation with ERROR status. Action goes back to RUNNING status as it expects "
|
@Description("Controller rejects action cancelation with ERROR status. Action goes back to RUNNING status as it expects "
|
||||||
+ "that the controller will continue the original update.")
|
+ "that the controller will continue the original update.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 2),
|
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = CancelTargetAssignmentEvent.class, count = 1),
|
@Expect(type = CancelTargetAssignmentEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3)})
|
||||||
public void controllerRejectsActionCancelationWithError() {
|
public void controllerRejectsActionCancelationWithError() {
|
||||||
final Long actionId = createTargetAndAssignDs();
|
final Long actionId = createTargetAndAssignDs();
|
||||||
|
|
||||||
deploymentManagement.cancelAction(actionId);
|
deploymentManagement.cancelAction(actionId);
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING, Action.Status.CANCELING,
|
||||||
Action.Status.CANCELING, Action.Status.CANCELING, true);
|
Action.Status.CANCELING, true);
|
||||||
|
|
||||||
simulateIntermediateStatusOnCancellation(actionId);
|
simulateIntermediateStatusOnCancellation(actionId);
|
||||||
|
|
||||||
controllerManagement
|
controllerManagement
|
||||||
.addCancelActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.ERROR));
|
.addCancelActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.ERROR));
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING, Action.Status.RUNNING,
|
||||||
Action.Status.RUNNING, Action.Status.ERROR, true);
|
Action.Status.ERROR, true);
|
||||||
|
|
||||||
assertThat(actionStatusRepository.count()).isEqualTo(8);
|
assertThat(actionStatusRepository.count()).isEqualTo(8);
|
||||||
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(8);
|
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(8);
|
||||||
@@ -362,8 +363,7 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
assertThat(targetManagement.getByControllerID(DEFAULT_CONTROLLER_ID).get().getUpdateStatus())
|
assertThat(targetManagement.getByControllerID(DEFAULT_CONTROLLER_ID).get().getUpdateStatus())
|
||||||
.isEqualTo(TargetUpdateStatus.PENDING);
|
.isEqualTo(TargetUpdateStatus.PENDING);
|
||||||
|
|
||||||
return deploymentManagement.findActiveActionsByTarget(PAGE, DEFAULT_CONTROLLER_ID).getContent()
|
return deploymentManagement.findActiveActionsByTarget(PAGE, DEFAULT_CONTROLLER_ID).getContent().get(0).getId();
|
||||||
.get(0).getId();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
@@ -373,8 +373,8 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
assertThat(targetManagement.getByControllerID(defaultControllerId).get().getUpdateStatus())
|
assertThat(targetManagement.getByControllerID(defaultControllerId).get().getUpdateStatus())
|
||||||
.isEqualTo(TargetUpdateStatus.PENDING);
|
.isEqualTo(TargetUpdateStatus.PENDING);
|
||||||
|
|
||||||
final Long id = deploymentManagement.findActiveActionsByTarget(PAGE, defaultControllerId).getContent()
|
final Long id = deploymentManagement.findActiveActionsByTarget(PAGE, defaultControllerId).getContent().get(0)
|
||||||
.get(0).getId();
|
.getId();
|
||||||
assertThat(id).isNotNull();
|
assertThat(id).isNotNull();
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -385,8 +385,8 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
assertThat(targetManagement.getByControllerID(defaultControllerId).get().getUpdateStatus())
|
assertThat(targetManagement.getByControllerID(defaultControllerId).get().getUpdateStatus())
|
||||||
.isEqualTo(TargetUpdateStatus.PENDING);
|
.isEqualTo(TargetUpdateStatus.PENDING);
|
||||||
|
|
||||||
final Long id = deploymentManagement.findActiveActionsByTarget(PAGE, defaultControllerId).getContent()
|
final Long id = deploymentManagement.findActiveActionsByTarget(PAGE, defaultControllerId).getContent().get(0)
|
||||||
.get(0).getId();
|
.getId();
|
||||||
assertThat(id).isNotNull();
|
assertThat(id).isNotNull();
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -395,55 +395,55 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
private void simulateIntermediateStatusOnCancellation(final Long actionId) {
|
private void simulateIntermediateStatusOnCancellation(final Long actionId) {
|
||||||
controllerManagement
|
controllerManagement
|
||||||
.addCancelActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.RUNNING));
|
.addCancelActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.RUNNING));
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING, Action.Status.CANCELING,
|
||||||
Action.Status.CANCELING, Action.Status.RUNNING, true);
|
Action.Status.RUNNING, true);
|
||||||
|
|
||||||
controllerManagement
|
controllerManagement
|
||||||
.addCancelActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.DOWNLOAD));
|
.addCancelActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.DOWNLOAD));
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING, Action.Status.CANCELING,
|
||||||
Action.Status.CANCELING, Action.Status.DOWNLOAD, true);
|
Action.Status.DOWNLOAD, true);
|
||||||
|
|
||||||
controllerManagement
|
controllerManagement
|
||||||
.addCancelActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.DOWNLOADED));
|
.addCancelActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.DOWNLOADED));
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING, Action.Status.CANCELING,
|
||||||
Action.Status.CANCELING, Action.Status.DOWNLOADED, true);
|
Action.Status.DOWNLOADED, true);
|
||||||
|
|
||||||
controllerManagement
|
controllerManagement
|
||||||
.addCancelActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.RETRIEVED));
|
.addCancelActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.RETRIEVED));
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING, Action.Status.CANCELING,
|
||||||
Action.Status.CANCELING, Action.Status.RETRIEVED, true);
|
Action.Status.RETRIEVED, true);
|
||||||
|
|
||||||
controllerManagement
|
controllerManagement
|
||||||
.addCancelActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.WARNING));
|
.addCancelActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.WARNING));
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING, Action.Status.CANCELING,
|
||||||
Action.Status.CANCELING, Action.Status.WARNING, true);
|
Action.Status.WARNING, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
private void simulateIntermediateStatusOnUpdate(final Long actionId) {
|
private void simulateIntermediateStatusOnUpdate(final Long actionId) {
|
||||||
controllerManagement
|
controllerManagement
|
||||||
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.RUNNING));
|
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.RUNNING));
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING, Action.Status.RUNNING,
|
||||||
Action.Status.RUNNING, Action.Status.RUNNING, true);
|
Action.Status.RUNNING, true);
|
||||||
|
|
||||||
controllerManagement
|
controllerManagement
|
||||||
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.DOWNLOAD));
|
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.DOWNLOAD));
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING, Action.Status.RUNNING,
|
||||||
Action.Status.RUNNING, Action.Status.DOWNLOAD, true);
|
Action.Status.DOWNLOAD, true);
|
||||||
controllerManagement
|
controllerManagement
|
||||||
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.DOWNLOADED));
|
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.DOWNLOADED));
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING, Action.Status.RUNNING,
|
||||||
Action.Status.RUNNING, Action.Status.DOWNLOADED, true);
|
Action.Status.DOWNLOADED, true);
|
||||||
|
|
||||||
controllerManagement
|
controllerManagement
|
||||||
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.RETRIEVED));
|
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.RETRIEVED));
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING, Action.Status.RUNNING,
|
||||||
Action.Status.RUNNING, Action.Status.RETRIEVED, true);
|
Action.Status.RETRIEVED, true);
|
||||||
|
|
||||||
controllerManagement
|
controllerManagement
|
||||||
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.WARNING));
|
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.WARNING));
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING, Action.Status.RUNNING,
|
||||||
Action.Status.RUNNING, Action.Status.WARNING, true);
|
Action.Status.WARNING, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertActionStatus(final Long actionId, final String controllerId,
|
private void assertActionStatus(final Long actionId, final String controllerId,
|
||||||
@@ -467,12 +467,12 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
@Test
|
@Test
|
||||||
@Description("Verifies that assignement verification works based on SHA1 hash. By design it is not important which artifact "
|
@Description("Verifies that assignement verification works based on SHA1 hash. By design it is not important which artifact "
|
||||||
+ "is actually used for the check as long as they have an identical binary, i.e. same SHA1 hash. ")
|
+ "is actually used for the check as long as they have an identical binary, i.e. same SHA1 hash. ")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 2),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 2),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = TargetUpdatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = TargetUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 6),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 6),
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 2) })
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 2)})
|
||||||
public void hasTargetArtifactAssignedIsTrueWithMultipleArtifacts() {
|
public void hasTargetArtifactAssignedIsTrueWithMultipleArtifacts() {
|
||||||
final int artifactSize = 5 * 1024;
|
final int artifactSize = 5 * 1024;
|
||||||
final byte[] random = RandomUtils.nextBytes(artifactSize);
|
final byte[] random = RandomUtils.nextBytes(artifactSize);
|
||||||
@@ -503,8 +503,8 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Register a controller which does not exist")
|
@Description("Register a controller which does not exist")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetPollEvent.class, count = 2) })
|
@Expect(type = TargetPollEvent.class, count = 2)})
|
||||||
public void findOrRegisterTargetIfItDoesNotExist() {
|
public void findOrRegisterTargetIfItDoesNotExist() {
|
||||||
final Target target = controllerManagement.findOrRegisterTargetIfItDoesNotExist("AA", LOCALHOST);
|
final Target target = controllerManagement.findOrRegisterTargetIfItDoesNotExist("AA", LOCALHOST);
|
||||||
assertThat(target).as("target should not be null").isNotNull();
|
assertThat(target).as("target should not be null").isNotNull();
|
||||||
@@ -512,17 +512,34 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
final Target sameTarget = controllerManagement.findOrRegisterTargetIfItDoesNotExist("AA", LOCALHOST);
|
final Target sameTarget = controllerManagement.findOrRegisterTargetIfItDoesNotExist("AA", LOCALHOST);
|
||||||
assertThat(target.getId()).as("Target should be the equals").isEqualTo(sameTarget.getId());
|
assertThat(target.getId()).as("Target should be the equals").isEqualTo(sameTarget.getId());
|
||||||
assertThat(targetRepository.count()).as("Only 1 target should be registred").isEqualTo(1L);
|
assertThat(targetRepository.count()).as("Only 1 target should be registred").isEqualTo(1L);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Description("Tries to register a target with an invalid controller id")
|
||||||
|
public void findOrRegisterTargetIfItDoesNotExistThrowsExceptionForInvalidControllerIdParam() {
|
||||||
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
|
.isThrownBy(() -> controllerManagement.findOrRegisterTargetIfItDoesNotExist(null, LOCALHOST))
|
||||||
|
.as("register target with null as controllerId should fail");
|
||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
.isThrownBy(() -> controllerManagement.findOrRegisterTargetIfItDoesNotExist("", LOCALHOST))
|
.isThrownBy(() -> controllerManagement.findOrRegisterTargetIfItDoesNotExist("", LOCALHOST))
|
||||||
.as("register target with empty controllerId should fail");
|
.as("register target with empty controllerId should fail");
|
||||||
|
|
||||||
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
|
.isThrownBy(() -> controllerManagement.findOrRegisterTargetIfItDoesNotExist(" ", LOCALHOST))
|
||||||
|
.as("register target with empty controllerId should fail");
|
||||||
|
|
||||||
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
|
.isThrownBy(() -> controllerManagement.findOrRegisterTargetIfItDoesNotExist(
|
||||||
|
RandomStringUtils.random(Target.CONTROLLER_ID_MAX_SIZE + 1), LOCALHOST))
|
||||||
|
.as("register target with too long controllerId should fail");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Register a controller which does not exist, when a ConcurrencyFailureException is raised, the " +
|
@Description("Register a controller which does not exist, when a ConcurrencyFailureException is raised, the "
|
||||||
"exception is rethrown after max retries")
|
+ "exception is rethrown after max retries")
|
||||||
public void findOrRegisterTargetIfItDoesNotExistThrowsExceptionAfterMaxRetries() {
|
public void findOrRegisterTargetIfItDoesNotExistThrowsExceptionAfterMaxRetries() {
|
||||||
final TargetRepository mockTargetRepository = Mockito.mock(TargetRepository.class);
|
final TargetRepository mockTargetRepository = Mockito.mock(TargetRepository.class);
|
||||||
when(mockTargetRepository.findOne(any())).thenThrow(ConcurrencyFailureException.class);
|
when(mockTargetRepository.findOne(any())).thenThrow(ConcurrencyFailureException.class);
|
||||||
((JpaControllerManagement) controllerManagement).setTargetRepository(mockTargetRepository);
|
((JpaControllerManagement) controllerManagement).setTargetRepository(mockTargetRepository);
|
||||||
|
|
||||||
@@ -538,20 +555,18 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Register a controller which does not exist, when a ConcurrencyFailureException is raised, the " +
|
@Description("Register a controller which does not exist, when a ConcurrencyFailureException is raised, the "
|
||||||
"exception is not rethrown when the max retries are not yet reached")
|
+ "exception is not rethrown when the max retries are not yet reached")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetPollEvent.class, count = 1)})
|
||||||
public void findOrRegisterTargetIfItDoesNotExistDoesNotThrowExceptionBeforeMaxRetries() {
|
public void findOrRegisterTargetIfItDoesNotExistDoesNotThrowExceptionBeforeMaxRetries() {
|
||||||
|
|
||||||
TargetRepository mockTargetRepository = Mockito.mock(TargetRepository.class);
|
TargetRepository mockTargetRepository = Mockito.mock(TargetRepository.class);
|
||||||
((JpaControllerManagement) controllerManagement).setTargetRepository(mockTargetRepository);
|
((JpaControllerManagement) controllerManagement).setTargetRepository(mockTargetRepository);
|
||||||
final Target target = testdataFactory.createTarget();
|
final Target target = testdataFactory.createTarget();
|
||||||
|
|
||||||
when(mockTargetRepository.findOne(any()))
|
when(mockTargetRepository.findOne(any())).thenThrow(ConcurrencyFailureException.class)
|
||||||
.thenThrow(ConcurrencyFailureException.class)
|
.thenThrow(ConcurrencyFailureException.class).thenReturn(Optional.of((JpaTarget) target));
|
||||||
.thenThrow(ConcurrencyFailureException.class)
|
|
||||||
.thenReturn(Optional.of((JpaTarget) target));
|
|
||||||
when(mockTargetRepository.save(any())).thenReturn(target);
|
when(mockTargetRepository.save(any())).thenReturn(target);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -567,8 +582,8 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Register a controller which does not exist, if a EntityAlreadyExistsException is raised, the " +
|
@Description("Register a controller which does not exist, if a EntityAlreadyExistsException is raised, the "
|
||||||
"exception is rethrown and no further retries will be attempted")
|
+ "exception is rethrown and no further retries will be attempted")
|
||||||
public void findOrRegisterTargetIfItDoesNotExistDoesntRetryWhenEntityAlreadyExistsException() {
|
public void findOrRegisterTargetIfItDoesNotExistDoesntRetryWhenEntityAlreadyExistsException() {
|
||||||
|
|
||||||
TargetRepository mockTargetRepository = Mockito.mock(TargetRepository.class);
|
TargetRepository mockTargetRepository = Mockito.mock(TargetRepository.class);
|
||||||
@@ -590,8 +605,8 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Retry is aborted when an unchecked exception is thrown and the exception should also be " +
|
@Description("Retry is aborted when an unchecked exception is thrown and the exception should also be "
|
||||||
"rethrown")
|
+ "rethrown")
|
||||||
public void recoverFindOrRegisterTargetIfItDoesNotExistIsNotInvokedForOtherExceptions() {
|
public void recoverFindOrRegisterTargetIfItDoesNotExistIsNotInvokedForOtherExceptions() {
|
||||||
|
|
||||||
TargetRepository mockTargetRepository = Mockito.mock(TargetRepository.class);
|
TargetRepository mockTargetRepository = Mockito.mock(TargetRepository.class);
|
||||||
@@ -602,7 +617,7 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
try {
|
try {
|
||||||
controllerManagement.findOrRegisterTargetIfItDoesNotExist("aControllerId", LOCALHOST);
|
controllerManagement.findOrRegisterTargetIfItDoesNotExist("aControllerId", LOCALHOST);
|
||||||
fail("Expected a RuntimeException to be thrown!");
|
fail("Expected a RuntimeException to be thrown!");
|
||||||
} catch (RuntimeException e){
|
} catch (RuntimeException e) {
|
||||||
verify(mockTargetRepository, times(1)).findOne(any());
|
verify(mockTargetRepository, times(1)).findOne(any());
|
||||||
} finally {
|
} finally {
|
||||||
// revert
|
// revert
|
||||||
@@ -612,9 +627,9 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Verify that targetVisible metadata is returned from repository")
|
@Description("Verify that targetVisible metadata is returned from repository")
|
||||||
@ExpectEvents({ @Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6) })
|
@Expect(type = SoftwareModuleUpdatedEvent.class, count = 6)})
|
||||||
public void findTargetVisibleMetaDataBySoftwareModuleId() {
|
public void findTargetVisibleMetaDataBySoftwareModuleId() {
|
||||||
final DistributionSet set = testdataFactory.createDistributionSet();
|
final DistributionSet set = testdataFactory.createDistributionSet();
|
||||||
testdataFactory.addSoftwareModuleMetadata(set);
|
testdataFactory.addSoftwareModuleMetadata(set);
|
||||||
@@ -629,8 +644,8 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Verify that controller registration does not result in a TargetPollEvent if feature is disabled")
|
@Description("Verify that controller registration does not result in a TargetPollEvent if feature is disabled")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetPollEvent.class, count = 0) })
|
@Expect(type = TargetPollEvent.class, count = 0)})
|
||||||
public void targetPollEventNotSendIfDisabled() {
|
public void targetPollEventNotSendIfDisabled() {
|
||||||
repositoryProperties.setPublishTargetPollEvent(false);
|
repositoryProperties.setPublishTargetPollEvent(false);
|
||||||
controllerManagement.findOrRegisterTargetIfItDoesNotExist("AA", LOCALHOST);
|
controllerManagement.findOrRegisterTargetIfItDoesNotExist("AA", LOCALHOST);
|
||||||
@@ -639,25 +654,25 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Controller tries to finish an update process after it has been finished by an error action status.")
|
@Description("Controller tries to finish an update process after it has been finished by an error action status.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3)})
|
||||||
public void tryToFinishWithErrorUpdateProcessMoreThanOnce() {
|
public void tryToFinishWithErrorUpdateProcessMoreThanOnce() {
|
||||||
final Long actionId = createTargetAndAssignDs();
|
final Long actionId = createTargetAndAssignDs();
|
||||||
|
|
||||||
// test and verify
|
// test and verify
|
||||||
controllerManagement
|
controllerManagement
|
||||||
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.RUNNING));
|
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.RUNNING));
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING, Action.Status.RUNNING,
|
||||||
Action.Status.RUNNING, Action.Status.RUNNING, true);
|
Action.Status.RUNNING, true);
|
||||||
|
|
||||||
controllerManagement
|
controllerManagement
|
||||||
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.ERROR));
|
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.ERROR));
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.ERROR,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.ERROR, Action.Status.ERROR,
|
||||||
Action.Status.ERROR, Action.Status.ERROR, false);
|
Action.Status.ERROR, false);
|
||||||
|
|
||||||
// try with disabled late feedback
|
// try with disabled late feedback
|
||||||
repositoryProperties.setRejectActionStatusForClosedAction(true);
|
repositoryProperties.setRejectActionStatusForClosedAction(true);
|
||||||
@@ -665,8 +680,8 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.FINISHED));
|
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.FINISHED));
|
||||||
|
|
||||||
// test
|
// test
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.ERROR,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.ERROR, Action.Status.ERROR,
|
||||||
Action.Status.ERROR, Action.Status.ERROR, false);
|
Action.Status.ERROR, false);
|
||||||
|
|
||||||
// try with enabled late feedback - should not make a difference as it
|
// try with enabled late feedback - should not make a difference as it
|
||||||
// only allows intermediate feedbacks and not multiple close
|
// only allows intermediate feedbacks and not multiple close
|
||||||
@@ -675,8 +690,8 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.FINISHED));
|
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.FINISHED));
|
||||||
|
|
||||||
// test
|
// test
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.ERROR,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.ERROR, Action.Status.ERROR,
|
||||||
Action.Status.ERROR, Action.Status.ERROR, false);
|
Action.Status.ERROR, false);
|
||||||
|
|
||||||
assertThat(actionStatusRepository.count()).isEqualTo(3);
|
assertThat(actionStatusRepository.count()).isEqualTo(3);
|
||||||
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(3);
|
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(3);
|
||||||
@@ -685,13 +700,13 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Controller trys to finish an update process after it has been finished by an FINISHED action status.")
|
@Description("Controller trys to finish an update process after it has been finished by an FINISHED action status.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = TargetAttributesRequestedEvent.class, count = 1),
|
@Expect(type = TargetAttributesRequestedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3)})
|
||||||
public void tryToFinishUpdateProcessMoreThanOnce() {
|
public void tryToFinishUpdateProcessMoreThanOnce() {
|
||||||
final Long actionId = prepareFinishedUpdate().getId();
|
final Long actionId = prepareFinishedUpdate().getId();
|
||||||
|
|
||||||
@@ -701,8 +716,8 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.FINISHED));
|
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.FINISHED));
|
||||||
|
|
||||||
// test
|
// test
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.IN_SYNC,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.IN_SYNC, Action.Status.FINISHED,
|
||||||
Action.Status.FINISHED, Action.Status.FINISHED, false);
|
Action.Status.FINISHED, false);
|
||||||
|
|
||||||
// try with enabled late feedback - should not make a difference as it
|
// try with enabled late feedback - should not make a difference as it
|
||||||
// only allows intermediate feedbacks and not multiple close
|
// only allows intermediate feedbacks and not multiple close
|
||||||
@@ -711,8 +726,8 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.FINISHED));
|
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Action.Status.FINISHED));
|
||||||
|
|
||||||
// test
|
// test
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.IN_SYNC,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.IN_SYNC, Action.Status.FINISHED,
|
||||||
Action.Status.FINISHED, Action.Status.FINISHED, false);
|
Action.Status.FINISHED, false);
|
||||||
|
|
||||||
assertThat(actionStatusRepository.count()).isEqualTo(3);
|
assertThat(actionStatusRepository.count()).isEqualTo(3);
|
||||||
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(3);
|
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(3);
|
||||||
@@ -722,13 +737,13 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
@Test
|
@Test
|
||||||
@Description("Controller trys to send an update feedback after it has been finished which is reject as the repository is "
|
@Description("Controller trys to send an update feedback after it has been finished which is reject as the repository is "
|
||||||
+ "configured to reject that.")
|
+ "configured to reject that.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = TargetAttributesRequestedEvent.class, count = 1),
|
@Expect(type = TargetAttributesRequestedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3)})
|
||||||
public void sendUpdatesForFinishUpdateProcessDropedIfDisabled() {
|
public void sendUpdatesForFinishUpdateProcessDropedIfDisabled() {
|
||||||
repositoryProperties.setRejectActionStatusForClosedAction(true);
|
repositoryProperties.setRejectActionStatusForClosedAction(true);
|
||||||
|
|
||||||
@@ -749,13 +764,13 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
@Test
|
@Test
|
||||||
@Description("Controller trys to send an update feedback after it has been finished which is accepted as the repository is "
|
@Description("Controller trys to send an update feedback after it has been finished which is accepted as the repository is "
|
||||||
+ "configured to accept them.")
|
+ "configured to accept them.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = TargetAttributesRequestedEvent.class, count = 1),
|
@Expect(type = TargetAttributesRequestedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3)})
|
||||||
public void sendUpdatesForFinishUpdateProcessAcceptedIfEnabled() {
|
public void sendUpdatesForFinishUpdateProcessAcceptedIfEnabled() {
|
||||||
repositoryProperties.setRejectActionStatusForClosedAction(false);
|
repositoryProperties.setRejectActionStatusForClosedAction(false);
|
||||||
|
|
||||||
@@ -775,8 +790,8 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Ensures that target attribute update is reflected by the repository.")
|
@Description("Ensures that target attribute update is reflected by the repository.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 3) })
|
@Expect(type = TargetUpdatedEvent.class, count = 3)})
|
||||||
public void updateTargetAttributes() throws Exception {
|
public void updateTargetAttributes() throws Exception {
|
||||||
final String controllerId = "test123";
|
final String controllerId = "test123";
|
||||||
final Target target = testdataFactory.createTarget(controllerId);
|
final Target target = testdataFactory.createTarget(controllerId);
|
||||||
@@ -831,8 +846,8 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Ensures that target attributes can be updated using different update modes.")
|
@Description("Ensures that target attributes can be updated using different update modes.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 4) })
|
@Expect(type = TargetUpdatedEvent.class, count = 4)})
|
||||||
public void updateTargetAttributesWithDifferentUpdateModes() {
|
public void updateTargetAttributesWithDifferentUpdateModes() {
|
||||||
|
|
||||||
final String controllerId = "testCtrl";
|
final String controllerId = "testCtrl";
|
||||||
@@ -929,8 +944,8 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Ensures that target attribute update fails if quota hits.")
|
@Description("Ensures that target attribute update fails if quota hits.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 2) })
|
@Expect(type = TargetUpdatedEvent.class, count = 2)})
|
||||||
public void updateTargetAttributesFailsIfTooManyEntries() throws Exception {
|
public void updateTargetAttributesFailsIfTooManyEntries() throws Exception {
|
||||||
final String controllerId = "test123";
|
final String controllerId = "test123";
|
||||||
final int allowedAttributes = quotaManagement.getMaxAttributeEntriesPerTarget();
|
final int allowedAttributes = quotaManagement.getMaxAttributeEntriesPerTarget();
|
||||||
@@ -1008,11 +1023,11 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Controller providing status entries fails if providing more than permitted by quota.")
|
@Description("Controller providing status entries fails if providing more than permitted by quota.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = TargetUpdatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = TargetUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3)})
|
||||||
public void controllerProvidesIntermediateFeedbackFailsIfQuotaHit() {
|
public void controllerProvidesIntermediateFeedbackFailsIfQuotaHit() {
|
||||||
final int allowStatusEntries = 10;
|
final int allowStatusEntries = 10;
|
||||||
final Long actionId = createTargetAndAssignDs();
|
final Long actionId = createTargetAndAssignDs();
|
||||||
@@ -1056,11 +1071,11 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Verifies that the quota specifying the maximum number of status entries per action is enforced.")
|
@Description("Verifies that the quota specifying the maximum number of status entries per action is enforced.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 2),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 2),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 2),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 2),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 2), @Expect(type = TargetUpdatedEvent.class, count = 2),
|
@Expect(type = ActionCreatedEvent.class, count = 2), @Expect(type = TargetUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 2),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 2),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 6) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 6)})
|
||||||
public void addActionStatusUpdatesUntilQuotaIsExceeded() {
|
public void addActionStatusUpdatesUntilQuotaIsExceeded() {
|
||||||
|
|
||||||
// any distribution set assignment causes 1 status entity to be created
|
// any distribution set assignment causes 1 status entity to be created
|
||||||
@@ -1092,11 +1107,11 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Verifies that the quota specifying the maximum number of messages per action status is enforced.")
|
@Description("Verifies that the quota specifying the maximum number of messages per action status is enforced.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = TargetUpdatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = TargetUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3)})
|
||||||
public void createActionStatusWithTooManyMessages() {
|
public void createActionStatusWithTooManyMessages() {
|
||||||
|
|
||||||
final int maxMessages = quotaManagement.getMaxMessagesPerActionStatus();
|
final int maxMessages = quotaManagement.getMaxMessagesPerActionStatus();
|
||||||
@@ -1120,87 +1135,80 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Verifies that a DOWNLOAD_ONLY action is not marked complete when the controller reports DOWNLOAD")
|
@Description("Verifies that a DOWNLOAD_ONLY action is not marked complete when the controller reports DOWNLOAD")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = TargetUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3)})
|
||||||
public void controllerReportsDownloadForDownloadOnlyAction() {
|
public void controllerReportsDownloadForDownloadOnlyAction() {
|
||||||
testdataFactory.createTarget();
|
testdataFactory.createTarget();
|
||||||
final Long actionId = createAndAssignDsAsDownloadOnly("downloadOnlyDs", DEFAULT_CONTROLLER_ID);
|
final Long actionId = createAndAssignDsAsDownloadOnly("downloadOnlyDs", DEFAULT_CONTROLLER_ID);
|
||||||
assertThat(actionId).isNotNull();
|
assertThat(actionId).isNotNull();
|
||||||
controllerManagement
|
controllerManagement
|
||||||
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Status.DOWNLOAD));
|
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Status.DOWNLOAD));
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.PENDING, Action.Status.RUNNING,
|
||||||
Action.Status.RUNNING, Action.Status.DOWNLOAD, true);
|
Action.Status.DOWNLOAD, true);
|
||||||
|
|
||||||
assertThat(actionStatusRepository.count()).isEqualTo(2);
|
assertThat(actionStatusRepository.count()).isEqualTo(2);
|
||||||
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(2);
|
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(2);
|
||||||
assertThat(actionRepository.activeActionExistsForControllerId(DEFAULT_CONTROLLER_ID))
|
assertThat(actionRepository.activeActionExistsForControllerId(DEFAULT_CONTROLLER_ID)).isEqualTo(true);
|
||||||
.isEqualTo(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Verifies that a DOWNLOAD_ONLY action is marked complete once the controller reports DOWNLOADED")
|
@Description("Verifies that a DOWNLOAD_ONLY action is marked complete once the controller reports DOWNLOADED")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = TargetUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
|
||||||
@Expect(type = TargetAttributesRequestedEvent.class, count = 1),
|
@Expect(type = TargetAttributesRequestedEvent.class, count = 1),
|
||||||
@Expect(type = ActionUpdatedEvent.class, count = 1),
|
@Expect(type = ActionUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3)})
|
||||||
public void controllerReportsDownloadedForDownloadOnlyAction() {
|
public void controllerReportsDownloadedForDownloadOnlyAction() {
|
||||||
testdataFactory.createTarget();
|
testdataFactory.createTarget();
|
||||||
final Long actionId = createAndAssignDsAsDownloadOnly("downloadOnlyDs", DEFAULT_CONTROLLER_ID);
|
final Long actionId = createAndAssignDsAsDownloadOnly("downloadOnlyDs", DEFAULT_CONTROLLER_ID);
|
||||||
assertThat(actionId).isNotNull();
|
assertThat(actionId).isNotNull();
|
||||||
controllerManagement
|
controllerManagement
|
||||||
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Status.DOWNLOADED));
|
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Status.DOWNLOADED));
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.IN_SYNC,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.IN_SYNC, Action.Status.DOWNLOADED,
|
||||||
Action.Status.DOWNLOADED, Action.Status.DOWNLOADED, false);
|
Action.Status.DOWNLOADED, false);
|
||||||
|
|
||||||
assertThat(actionStatusRepository.count()).isEqualTo(2);
|
assertThat(actionStatusRepository.count()).isEqualTo(2);
|
||||||
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(2);
|
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(2);
|
||||||
assertThat(actionRepository.activeActionExistsForControllerId(DEFAULT_CONTROLLER_ID))
|
assertThat(actionRepository.activeActionExistsForControllerId(DEFAULT_CONTROLLER_ID)).isEqualTo(false);
|
||||||
.isEqualTo(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Verifies that a controller can report a FINISHED event for a DOWNLOAD_ONLY non-active action.")
|
@Description("Verifies that a controller can report a FINISHED event for a DOWNLOAD_ONLY non-active action.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = TargetUpdatedEvent.class, count = 3),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 3),
|
|
||||||
@Expect(type = TargetAttributesRequestedEvent.class, count = 2),
|
@Expect(type = TargetAttributesRequestedEvent.class, count = 2),
|
||||||
@Expect(type = ActionUpdatedEvent.class, count = 2),
|
@Expect(type = ActionUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3)})
|
||||||
public void controllerReportsActionFinishedForDownloadOnlyActionThatIsNotActive() {
|
public void controllerReportsActionFinishedForDownloadOnlyActionThatIsNotActive() {
|
||||||
testdataFactory.createTarget();
|
testdataFactory.createTarget();
|
||||||
final Long actionId = createAndAssignDsAsDownloadOnly("downloadOnlyDs", DEFAULT_CONTROLLER_ID);
|
final Long actionId = createAndAssignDsAsDownloadOnly("downloadOnlyDs", DEFAULT_CONTROLLER_ID);
|
||||||
assertThat(actionId).isNotNull();
|
assertThat(actionId).isNotNull();
|
||||||
finishDownloadOnlyUpdateAndSendUpdateActionStatus(actionId, Status.FINISHED);
|
finishDownloadOnlyUpdateAndSendUpdateActionStatus(actionId, Status.FINISHED);
|
||||||
|
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.IN_SYNC,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.IN_SYNC, Action.Status.FINISHED,
|
||||||
Action.Status.FINISHED, Action.Status.FINISHED, false);
|
Action.Status.FINISHED, false);
|
||||||
|
|
||||||
assertThat(actionStatusRepository.count()).isEqualTo(3);
|
assertThat(actionStatusRepository.count()).isEqualTo(3);
|
||||||
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(3);
|
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(3);
|
||||||
assertThat(actionRepository.activeActionExistsForControllerId(DEFAULT_CONTROLLER_ID))
|
assertThat(actionRepository.activeActionExistsForControllerId(DEFAULT_CONTROLLER_ID)).isEqualTo(false);
|
||||||
.isEqualTo(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Verifies that multiple DOWNLOADED events for a DOWNLOAD_ONLY action are handled.")
|
@Description("Verifies that multiple DOWNLOADED events for a DOWNLOAD_ONLY action are handled.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = TargetUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
|
||||||
@Expect(type = TargetAttributesRequestedEvent.class, count = 3),
|
@Expect(type = TargetAttributesRequestedEvent.class, count = 3),
|
||||||
@Expect(type = ActionUpdatedEvent.class, count = 1),
|
@Expect(type = ActionUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3)})
|
||||||
public void controllerReportsMultipleDownloadedForDownloadOnlyAction() {
|
public void controllerReportsMultipleDownloadedForDownloadOnlyAction() {
|
||||||
testdataFactory.createTarget();
|
testdataFactory.createTarget();
|
||||||
final Long actionId = createAndAssignDsAsDownloadOnly("downloadOnlyDs", DEFAULT_CONTROLLER_ID);
|
final Long actionId = createAndAssignDsAsDownloadOnly("downloadOnlyDs", DEFAULT_CONTROLLER_ID);
|
||||||
@@ -1208,26 +1216,24 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
IntStream.range(0, 3).forEach(i -> controllerManagement
|
IntStream.range(0, 3).forEach(i -> controllerManagement
|
||||||
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Status.DOWNLOADED)));
|
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Status.DOWNLOADED)));
|
||||||
|
|
||||||
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.IN_SYNC,
|
assertActionStatus(actionId, DEFAULT_CONTROLLER_ID, TargetUpdateStatus.IN_SYNC, Status.DOWNLOADED,
|
||||||
Status.DOWNLOADED, Status.DOWNLOADED, false);
|
Status.DOWNLOADED, false);
|
||||||
|
|
||||||
assertThat(actionStatusRepository.count()).isEqualTo(4);
|
assertThat(actionStatusRepository.count()).isEqualTo(4);
|
||||||
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(4);
|
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(4);
|
||||||
assertThat(actionRepository.activeActionExistsForControllerId(DEFAULT_CONTROLLER_ID))
|
assertThat(actionRepository.activeActionExistsForControllerId(DEFAULT_CONTROLLER_ID)).isEqualTo(false);
|
||||||
.isEqualTo(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = QuotaExceededException.class)
|
@Test(expected = QuotaExceededException.class)
|
||||||
@Description("Verifies that quota is asserted when a controller reports too many DOWNLOADED events for a " +
|
@Description("Verifies that quota is asserted when a controller reports too many DOWNLOADED events for a "
|
||||||
"DOWNLOAD_ONLY action.")
|
+ "DOWNLOAD_ONLY action.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = TargetUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = TargetAttributesRequestedEvent.class, count = 9),
|
@Expect(type = TargetAttributesRequestedEvent.class, count = 9),
|
||||||
@Expect(type = ActionUpdatedEvent.class, count = 1),
|
@Expect(type = ActionUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3)})
|
||||||
public void quotaExceptionWhencontrollerReportsTooManyDownloadedMessagesForDownloadOnlyAction() {
|
public void quotaExceptionWhencontrollerReportsTooManyDownloadedMessagesForDownloadOnlyAction() {
|
||||||
final int maxMessages = quotaManagement.getMaxMessagesPerActionStatus();
|
final int maxMessages = quotaManagement.getMaxMessagesPerActionStatus();
|
||||||
testdataFactory.createTarget();
|
testdataFactory.createTarget();
|
||||||
@@ -1240,14 +1246,13 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Verifies that quota is enforced for UpdateActionStatus events for DOWNLOAD_ONLY assignments.")
|
@Description("Verifies that quota is enforced for UpdateActionStatus events for DOWNLOAD_ONLY assignments.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = TargetUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
|
||||||
@Expect(type = TargetAttributesRequestedEvent.class, count = 9),
|
@Expect(type = TargetAttributesRequestedEvent.class, count = 9),
|
||||||
@Expect(type = ActionUpdatedEvent.class, count = 1),
|
@Expect(type = ActionUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3)})
|
||||||
public void quotaEceededExceptionWhenControllerReportsTooManyUpdateActionStatusMessagesForDownloadOnlyAction() {
|
public void quotaEceededExceptionWhenControllerReportsTooManyUpdateActionStatusMessagesForDownloadOnlyAction() {
|
||||||
final int maxMessages = quotaManagement.getMaxMessagesPerActionStatus();
|
final int maxMessages = quotaManagement.getMaxMessagesPerActionStatus();
|
||||||
testdataFactory.createTarget();
|
testdataFactory.createTarget();
|
||||||
@@ -1278,12 +1283,11 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Verifies that quota is enforced for UpdateActionStatus events for FORCED assignments.")
|
@Description("Verifies that quota is enforced for UpdateActionStatus events for FORCED assignments.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = TargetUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1),
|
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3)})
|
||||||
public void quotaEceededExceptionWhenControllerReportsTooManyUpdateActionStatusMessagesForForced() {
|
public void quotaEceededExceptionWhenControllerReportsTooManyUpdateActionStatusMessagesForForced() {
|
||||||
final int maxMessages = quotaManagement.getMaxMessagesPerActionStatus();
|
final int maxMessages = quotaManagement.getMaxMessagesPerActionStatus();
|
||||||
final Long actionId = createTargetAndAssignDs();
|
final Long actionId = createTargetAndAssignDs();
|
||||||
@@ -1312,16 +1316,15 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Verifies that a target can report FINISHED/ERROR updates for DOWNLOAD_ONLY assignments regardless of " +
|
@Description("Verifies that a target can report FINISHED/ERROR updates for DOWNLOAD_ONLY assignments regardless of "
|
||||||
"repositoryProperties.rejectActionStatusForClosedAction value.")
|
+ "repositoryProperties.rejectActionStatusForClosedAction value.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 4),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 4),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 4),
|
@Expect(type = ActionCreatedEvent.class, count = 4), @Expect(type = TargetUpdatedEvent.class, count = 12),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 12),
|
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 4),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 4),
|
||||||
@Expect(type = TargetAttributesRequestedEvent.class, count = 6),
|
@Expect(type = TargetAttributesRequestedEvent.class, count = 6),
|
||||||
@Expect(type = ActionUpdatedEvent.class, count = 8),
|
@Expect(type = ActionUpdatedEvent.class, count = 8),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 12) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 12)})
|
||||||
public void targetCanAlwaysReportFinishedOrErrorAfterActionIsClosedForDownloadOnlyAssignments() {
|
public void targetCanAlwaysReportFinishedOrErrorAfterActionIsClosedForDownloadOnlyAssignments() {
|
||||||
|
|
||||||
testdataFactory.createTarget();
|
testdataFactory.createTarget();
|
||||||
@@ -1344,38 +1347,35 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
assertThat(actionId).isNotNull();
|
assertThat(actionId).isNotNull();
|
||||||
finishDownloadOnlyUpdateAndSendUpdateActionStatus(actionId3, Status.FINISHED);
|
finishDownloadOnlyUpdateAndSendUpdateActionStatus(actionId3, Status.FINISHED);
|
||||||
|
|
||||||
|
|
||||||
final Long actionId4 = createAndAssignDsAsDownloadOnly("downloadOnlyDs4", DEFAULT_CONTROLLER_ID);
|
final Long actionId4 = createAndAssignDsAsDownloadOnly("downloadOnlyDs4", DEFAULT_CONTROLLER_ID);
|
||||||
assertThat(actionId).isNotNull();
|
assertThat(actionId).isNotNull();
|
||||||
finishDownloadOnlyUpdateAndSendUpdateActionStatus(actionId4, Status.ERROR);
|
finishDownloadOnlyUpdateAndSendUpdateActionStatus(actionId4, Status.ERROR);
|
||||||
|
|
||||||
// actionStatusRepository should have 12 ActionStatusUpdates, 3 from each action
|
// actionStatusRepository should have 12 ActionStatusUpdates, 3 from
|
||||||
|
// each action
|
||||||
assertThat(actionStatusRepository.count()).isEqualTo(12L);
|
assertThat(actionStatusRepository.count()).isEqualTo(12L);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Step
|
@Step
|
||||||
private void finishDownloadOnlyUpdateAndSendUpdateActionStatus(final Long actionId, final Status status) {
|
private void finishDownloadOnlyUpdateAndSendUpdateActionStatus(final Long actionId, final Status status) {
|
||||||
// finishing action
|
// finishing action
|
||||||
controllerManagement.addUpdateActionStatus(entityFactory.actionStatus().create(actionId)
|
controllerManagement
|
||||||
.status(Status.DOWNLOADED));
|
.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(Status.DOWNLOADED));
|
||||||
|
|
||||||
controllerManagement.addUpdateActionStatus(entityFactory.actionStatus().create(actionId)
|
controllerManagement.addUpdateActionStatus(entityFactory.actionStatus().create(actionId).status(status));
|
||||||
.status(status));
|
assertThat(actionRepository.activeActionExistsForControllerId(DEFAULT_CONTROLLER_ID)).isEqualTo(false);
|
||||||
assertThat(actionRepository.activeActionExistsForControllerId(DEFAULT_CONTROLLER_ID))
|
|
||||||
.isEqualTo(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Verifies that a controller can report a FINISHED event for a DOWNLOAD_ONLY action after having" +
|
@Description("Verifies that a controller can report a FINISHED event for a DOWNLOAD_ONLY action after having"
|
||||||
" installed an intermediate update.")
|
+ " installed an intermediate update.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 2),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 2),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 2),
|
@Expect(type = ActionCreatedEvent.class, count = 2), @Expect(type = TargetUpdatedEvent.class, count = 5),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 5),
|
|
||||||
@Expect(type = TargetAttributesRequestedEvent.class, count = 3),
|
@Expect(type = TargetAttributesRequestedEvent.class, count = 3),
|
||||||
@Expect(type = ActionUpdatedEvent.class, count = 3),
|
@Expect(type = ActionUpdatedEvent.class, count = 3),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 2),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 2),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 6) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 6)})
|
||||||
public void controllerReportsFinishedForOldDownloadOnlyActionAfterSuccessfulForcedAssignment() {
|
public void controllerReportsFinishedForOldDownloadOnlyActionAfterSuccessfulForcedAssignment() {
|
||||||
|
|
||||||
testdataFactory.createTarget();
|
testdataFactory.createTarget();
|
||||||
@@ -1390,8 +1390,8 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
// assign distributionSet as FORCED assignment
|
// assign distributionSet as FORCED assignment
|
||||||
final Long forcedDistributionSetId = testdataFactory.createDistributionSet("forcedDs1").getId();
|
final Long forcedDistributionSetId = testdataFactory.createDistributionSet("forcedDs1").getId();
|
||||||
final DistributionSetAssignmentResult assignmentResult =
|
final DistributionSetAssignmentResult assignmentResult = assignDistributionSet(forcedDistributionSetId,
|
||||||
assignDistributionSet(forcedDistributionSetId, DEFAULT_CONTROLLER_ID, Action.ActionType.SOFT);
|
DEFAULT_CONTROLLER_ID, Action.ActionType.SOFT);
|
||||||
addUpdateActionStatus(assignmentResult.getActions().get(0).getId(), DEFAULT_CONTROLLER_ID, Status.FINISHED);
|
addUpdateActionStatus(assignmentResult.getActions().get(0).getId(), DEFAULT_CONTROLLER_ID, Status.FINISHED);
|
||||||
assertAssignedDistributionSetId(DEFAULT_CONTROLLER_ID, forcedDistributionSetId);
|
assertAssignedDistributionSetId(DEFAULT_CONTROLLER_ID, forcedDistributionSetId);
|
||||||
assertInstalledDistributionSetId(DEFAULT_CONTROLLER_ID, forcedDistributionSetId);
|
assertInstalledDistributionSetId(DEFAULT_CONTROLLER_ID, forcedDistributionSetId);
|
||||||
@@ -1421,7 +1421,7 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
final Optional<Target> target = controllerManagement.getByControllerId(controllerId);
|
final Optional<Target> target = controllerManagement.getByControllerId(controllerId);
|
||||||
assertThat(target).isPresent();
|
assertThat(target).isPresent();
|
||||||
final DistributionSet installedDistributionSet = ((JpaTarget) target.get()).getInstalledDistributionSet();
|
final DistributionSet installedDistributionSet = ((JpaTarget) target.get()).getInstalledDistributionSet();
|
||||||
if(dsId == null){
|
if (dsId == null) {
|
||||||
assertThat(installedDistributionSet).isNull();
|
assertThat(installedDistributionSet).isNull();
|
||||||
} else {
|
} else {
|
||||||
assertThat(installedDistributionSet.getId()).isEqualTo(dsId);
|
assertThat(installedDistributionSet.getId()).isEqualTo(dsId);
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
|
|||||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||||
import org.eclipse.hawkbit.repository.model.MetaData;
|
import org.eclipse.hawkbit.repository.model.MetaData;
|
||||||
|
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||||
|
import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.repository.test.matcher.Expect;
|
import org.eclipse.hawkbit.repository.test.matcher.Expect;
|
||||||
@@ -218,7 +220,7 @@ public class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
.isThrownBy(() -> distributionSetManagement.create(entityFactory.distributionSet().create().version("a")
|
.isThrownBy(() -> distributionSetManagement.create(entityFactory.distributionSet().create().version("a")
|
||||||
.name(RandomStringUtils.randomAlphanumeric(65))))
|
.name(RandomStringUtils.randomAlphanumeric(NamedEntity.NAME_MAX_SIZE + 1))))
|
||||||
.as("entity with too long name should not be created");
|
.as("entity with too long name should not be created");
|
||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class).isThrownBy(
|
assertThatExceptionOfType(ConstraintViolationException.class).isThrownBy(
|
||||||
@@ -232,7 +234,7 @@ public class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
.isThrownBy(() -> distributionSetManagement.update(entityFactory.distributionSet().update(set.getId())
|
.isThrownBy(() -> distributionSetManagement.update(entityFactory.distributionSet().update(set.getId())
|
||||||
.name(RandomStringUtils.randomAlphanumeric(65))))
|
.name(RandomStringUtils.randomAlphanumeric(NamedEntity.NAME_MAX_SIZE + 1))))
|
||||||
.as("entity with too long name should not be updated");
|
.as("entity with too long name should not be updated");
|
||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
@@ -251,21 +253,21 @@ public class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
.isThrownBy(() -> distributionSetManagement.create(entityFactory.distributionSet().create().name("a")
|
.isThrownBy(() -> distributionSetManagement.create(entityFactory.distributionSet().create().name("a")
|
||||||
.version(RandomStringUtils.randomAlphanumeric(65))))
|
.version(RandomStringUtils.randomAlphanumeric(NamedVersionedEntity.VERSION_MAX_SIZE + 1))))
|
||||||
.as("entity with too long name should not be created");
|
.as("entity with too long version should not be created");
|
||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class).isThrownBy(
|
assertThatExceptionOfType(ConstraintViolationException.class).isThrownBy(
|
||||||
() -> distributionSetManagement.create(entityFactory.distributionSet().create().name("a").version("")))
|
() -> distributionSetManagement.create(entityFactory.distributionSet().create().name("a").version("")))
|
||||||
.as("entity with too long name should not be created");
|
.as("entity with too short version should not be created");
|
||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
.isThrownBy(() -> distributionSetManagement.update(entityFactory.distributionSet().update(set.getId())
|
.isThrownBy(() -> distributionSetManagement.update(entityFactory.distributionSet().update(set.getId())
|
||||||
.version(RandomStringUtils.randomAlphanumeric(65))))
|
.version(RandomStringUtils.randomAlphanumeric(NamedVersionedEntity.VERSION_MAX_SIZE + 1))))
|
||||||
.as("entity with too long name should not be updated");
|
.as("entity with too long version should not be updated");
|
||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class).isThrownBy(
|
assertThatExceptionOfType(ConstraintViolationException.class).isThrownBy(
|
||||||
() -> distributionSetManagement.update(entityFactory.distributionSet().update(set.getId()).version("")))
|
() -> distributionSetManagement.update(entityFactory.distributionSet().update(set.getId()).version("")))
|
||||||
.as("entity with too short name should not be updated");
|
.as("entity with too short version should not be updated");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ import org.eclipse.hawkbit.repository.exception.QuotaExceededException;
|
|||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSetType;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSetType;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||||
|
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||||
|
import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
|
||||||
import org.eclipse.hawkbit.repository.test.matcher.Expect;
|
import org.eclipse.hawkbit.repository.test.matcher.Expect;
|
||||||
import org.eclipse.hawkbit.repository.test.matcher.ExpectEvents;
|
import org.eclipse.hawkbit.repository.test.matcher.ExpectEvents;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -128,7 +130,7 @@ public class DistributionSetTypeManagementTest extends AbstractJpaIntegrationTes
|
|||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
.isThrownBy(() -> distributionSetManagement.create(entityFactory.distributionSet().create().version("a")
|
.isThrownBy(() -> distributionSetManagement.create(entityFactory.distributionSet().create().version("a")
|
||||||
.name(RandomStringUtils.randomAlphanumeric(65))))
|
.name(RandomStringUtils.randomAlphanumeric(NamedEntity.NAME_MAX_SIZE + 1))))
|
||||||
.as("set with too long name should not be created");
|
.as("set with too long name should not be created");
|
||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
@@ -147,7 +149,7 @@ public class DistributionSetTypeManagementTest extends AbstractJpaIntegrationTes
|
|||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
.isThrownBy(() -> distributionSetManagement.update(entityFactory.distributionSet().update(set.getId())
|
.isThrownBy(() -> distributionSetManagement.update(entityFactory.distributionSet().update(set.getId())
|
||||||
.name(RandomStringUtils.randomAlphanumeric(65))))
|
.name(RandomStringUtils.randomAlphanumeric(NamedEntity.NAME_MAX_SIZE + 1))))
|
||||||
.as("set with too long name should not be updated");
|
.as("set with too long name should not be updated");
|
||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
@@ -165,7 +167,7 @@ public class DistributionSetTypeManagementTest extends AbstractJpaIntegrationTes
|
|||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
.isThrownBy(() -> distributionSetManagement.create(entityFactory.distributionSet().create().name("a")
|
.isThrownBy(() -> distributionSetManagement.create(entityFactory.distributionSet().create().name("a")
|
||||||
.version(RandomStringUtils.randomAlphanumeric(65))))
|
.version(RandomStringUtils.randomAlphanumeric(NamedVersionedEntity.VERSION_MAX_SIZE + 1))))
|
||||||
.as("set with too long version should not be created");
|
.as("set with too long version should not be created");
|
||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
@@ -184,7 +186,7 @@ public class DistributionSetTypeManagementTest extends AbstractJpaIntegrationTes
|
|||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
.isThrownBy(() -> distributionSetManagement.update(entityFactory.distributionSet().update(set.getId())
|
.isThrownBy(() -> distributionSetManagement.update(entityFactory.distributionSet().update(set.getId())
|
||||||
.version(RandomStringUtils.randomAlphanumeric(65))))
|
.version(RandomStringUtils.randomAlphanumeric(NamedVersionedEntity.VERSION_MAX_SIZE + 1))))
|
||||||
.as("set with too long version should not be updated");
|
.as("set with too long version should not be updated");
|
||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ import org.eclipse.hawkbit.repository.model.Action.Status;
|
|||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSetAssignmentResult;
|
import org.eclipse.hawkbit.repository.model.DistributionSetAssignmentResult;
|
||||||
import org.eclipse.hawkbit.repository.model.MetaData;
|
import org.eclipse.hawkbit.repository.model.MetaData;
|
||||||
|
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||||
import org.eclipse.hawkbit.repository.model.Tag;
|
import org.eclipse.hawkbit.repository.model.Tag;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetMetadata;
|
import org.eclipse.hawkbit.repository.model.TargetMetadata;
|
||||||
@@ -251,7 +252,7 @@ public class TargetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
.isThrownBy(() -> targetManagement.create(entityFactory.target().create().controllerId("a")
|
.isThrownBy(() -> targetManagement.create(entityFactory.target().create().controllerId("a")
|
||||||
.name(RandomStringUtils.randomAlphanumeric(65))))
|
.name(RandomStringUtils.randomAlphanumeric(NamedEntity.NAME_MAX_SIZE + 1))))
|
||||||
.as("target with too long name should not be created");
|
.as("target with too long name should not be created");
|
||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
@@ -261,7 +262,7 @@ public class TargetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
.isThrownBy(() -> targetManagement.update(entityFactory.target().update(target.getControllerId())
|
.isThrownBy(() -> targetManagement.update(entityFactory.target().update(target.getControllerId())
|
||||||
.name(RandomStringUtils.randomAlphanumeric(65))))
|
.name(RandomStringUtils.randomAlphanumeric(NamedEntity.NAME_MAX_SIZE + 1))))
|
||||||
.as("target with too long name should not be updated");
|
.as("target with too long name should not be updated");
|
||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
@@ -281,7 +282,7 @@ public class TargetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
.isThrownBy(() -> targetManagement.create(entityFactory.target().create().controllerId("a")
|
.isThrownBy(() -> targetManagement.create(entityFactory.target().create().controllerId("a")
|
||||||
.securityToken(RandomStringUtils.randomAlphanumeric(129))))
|
.securityToken(RandomStringUtils.randomAlphanumeric(Target.SECURITY_TOKEN_MAX_SIZE + 1))))
|
||||||
.as("target with too long token should not be created");
|
.as("target with too long token should not be created");
|
||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
@@ -291,7 +292,7 @@ public class TargetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
.isThrownBy(() -> targetManagement.update(entityFactory.target().update(target.getControllerId())
|
.isThrownBy(() -> targetManagement.update(entityFactory.target().update(target.getControllerId())
|
||||||
.securityToken(RandomStringUtils.randomAlphanumeric(129))))
|
.securityToken(RandomStringUtils.randomAlphanumeric(Target.SECURITY_TOKEN_MAX_SIZE + 1))))
|
||||||
.as("target with too long token should not be updated");
|
.as("target with too long token should not be updated");
|
||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
@@ -340,8 +341,8 @@ public class TargetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
.as("target with null controller id should not be created");
|
.as("target with null controller id should not be created");
|
||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
.isThrownBy(() -> targetManagement
|
.isThrownBy(() -> targetManagement.create(entityFactory.target().create()
|
||||||
.create(entityFactory.target().create().controllerId(RandomStringUtils.randomAlphanumeric(65))))
|
.controllerId(RandomStringUtils.randomAlphanumeric(Target.CONTROLLER_ID_MAX_SIZE + 1))))
|
||||||
.as("target with too long controller id should not be created");
|
.as("target with too long controller id should not be created");
|
||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import org.eclipse.hawkbit.repository.event.remote.entity.TargetCreatedEvent;
|
|||||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetTagUpdatedEvent;
|
import org.eclipse.hawkbit.repository.event.remote.entity.TargetTagUpdatedEvent;
|
||||||
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaTargetTag;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaTargetTag;
|
||||||
|
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||||
import org.eclipse.hawkbit.repository.model.Tag;
|
import org.eclipse.hawkbit.repository.model.Tag;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||||
@@ -132,7 +133,8 @@ public class TargetTagManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
.isThrownBy(() -> targetTagManagement
|
.isThrownBy(() -> targetTagManagement
|
||||||
.create(entityFactory.tag().create().name(RandomStringUtils.randomAlphanumeric(65))))
|
.create(entityFactory.tag().create().name(RandomStringUtils.randomAlphanumeric(
|
||||||
|
NamedEntity.NAME_MAX_SIZE + 1))))
|
||||||
.as("tag with too long name should not be created");
|
.as("tag with too long name should not be created");
|
||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
@@ -141,7 +143,8 @@ public class TargetTagManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
.isThrownBy(() -> targetTagManagement
|
.isThrownBy(() -> targetTagManagement
|
||||||
.update(entityFactory.tag().update(tag.getId()).name(RandomStringUtils.randomAlphanumeric(65))))
|
.update(entityFactory.tag().update(tag.getId()).name(RandomStringUtils.randomAlphanumeric(
|
||||||
|
NamedEntity.NAME_MAX_SIZE + 1))))
|
||||||
.as("tag with too long name should not be updated");
|
.as("tag with too long name should not be updated");
|
||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class).isThrownBy(
|
assertThatExceptionOfType(ConstraintViolationException.class).isThrownBy(
|
||||||
|
|||||||
@@ -105,12 +105,12 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Ensures that targets cannot be created e.g. in plug'n play scenarios when tenant does not exists but can be created if the tenant exists.")
|
@Description("Ensures that targets cannot be created e.g. in plug'n play scenarios when tenant does not exists but can be created if the tenant exists.")
|
||||||
@WithUser(tenantId = "tenantDoesNotExists", allSpPermissions = true, authorities = { CONTROLLER_ROLE,
|
@WithUser(tenantId = "tenantDoesNotExists", allSpPermissions = true, authorities = {CONTROLLER_ROLE,
|
||||||
SYSTEM_ROLE }, autoCreateTenant = false)
|
SYSTEM_ROLE}, autoCreateTenant = false)
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetPollEvent.class, count = 1),
|
@Expect(type = TargetPollEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetTypeCreatedEvent.class, count = 3),
|
@Expect(type = DistributionSetTypeCreatedEvent.class, count = 3),
|
||||||
@Expect(type = SoftwareModuleTypeCreatedEvent.class, count = 2) })
|
@Expect(type = SoftwareModuleTypeCreatedEvent.class, count = 2)})
|
||||||
public void targetCannotBeRegisteredIfTenantDoesNotExistsButWhenExists() throws Exception {
|
public void targetCannotBeRegisteredIfTenantDoesNotExistsButWhenExists() throws Exception {
|
||||||
|
|
||||||
mvc.perform(get("/default-tenant/", tenantAware.getCurrentTenant())).andDo(MockMvcResultPrinter.print())
|
mvc.perform(get("/default-tenant/", tenantAware.getCurrentTenant())).andDo(MockMvcResultPrinter.print())
|
||||||
@@ -131,10 +131,10 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Ensures that target poll request does not change audit data on the entity.")
|
@Description("Ensures that target poll request does not change audit data on the entity.")
|
||||||
@WithUser(principal = "knownPrincipal", authorities = { SpPermission.READ_TARGET, SpPermission.UPDATE_TARGET,
|
@WithUser(principal = "knownPrincipal", authorities = {SpPermission.READ_TARGET, SpPermission.UPDATE_TARGET,
|
||||||
SpPermission.CREATE_TARGET }, allSpPermissions = false)
|
SpPermission.CREATE_TARGET}, allSpPermissions = false)
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1)})
|
||||||
public void targetPollDoesNotModifyAuditData() throws Exception {
|
public void targetPollDoesNotModifyAuditData() throws Exception {
|
||||||
// create target first with "knownPrincipal" user and audit data
|
// create target first with "knownPrincipal" user and audit data
|
||||||
final String knownTargetControllerId = "target1";
|
final String knownTargetControllerId = "target1";
|
||||||
@@ -162,15 +162,15 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Ensures that server returns a not found response in case of empty controlloer ID.")
|
@Description("Ensures that server returns a not found response in case of empty controlloer ID.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 0)})
|
||||||
public void rootRsWithoutId() throws Exception {
|
public void rootRsWithoutId() throws Exception {
|
||||||
mvc.perform(get("/controller/v1/")).andDo(MockMvcResultPrinter.print()).andExpect(status().isNotFound());
|
mvc.perform(get("/controller/v1/")).andDo(MockMvcResultPrinter.print()).andExpect(status().isNotFound());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Ensures that the system creates a new target in plug and play manner, i.e. target is authenticated but does not exist yet.")
|
@Description("Ensures that the system creates a new target in plug and play manner, i.e. target is authenticated but does not exist yet.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetPollEvent.class, count = 1)})
|
||||||
public void rootRsPlugAndPlay() throws Exception {
|
public void rootRsPlugAndPlay() throws Exception {
|
||||||
|
|
||||||
final long current = System.currentTimeMillis();
|
final long current = System.currentTimeMillis();
|
||||||
@@ -198,8 +198,8 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
|||||||
@Test
|
@Test
|
||||||
@Description("Ensures that tenant specific polling time, which is saved in the db, is delivered to the controller.")
|
@Description("Ensures that tenant specific polling time, which is saved in the db, is delivered to the controller.")
|
||||||
@WithUser(principal = "knownpricipal", allSpPermissions = false)
|
@WithUser(principal = "knownpricipal", allSpPermissions = false)
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetPollEvent.class, count = 1)})
|
||||||
public void pollWithModifiedGloablPollingTime() throws Exception {
|
public void pollWithModifiedGloablPollingTime() throws Exception {
|
||||||
securityRule.runAs(WithSpringAuthorityRule.withUser("tenantadmin", HAS_AUTH_TENANT_CONFIGURATION), () -> {
|
securityRule.runAs(WithSpringAuthorityRule.withUser("tenantadmin", HAS_AUTH_TENANT_CONFIGURATION), () -> {
|
||||||
tenantConfigurationManagement.addOrUpdateConfiguration(TenantConfigurationKey.POLLING_TIME_INTERVAL,
|
tenantConfigurationManagement.addOrUpdateConfiguration(TenantConfigurationKey.POLLING_TIME_INTERVAL,
|
||||||
@@ -218,14 +218,14 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Ensures that etag check results in not modified response if provided etag by client is identical to entity in repository.")
|
@Description("Ensures that etag check results in not modified response if provided etag by client is identical to entity in repository.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetPollEvent.class, count = 6),
|
@Expect(type = TargetPollEvent.class, count = 6),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 2),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 2),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 3), @Expect(type = ActionUpdatedEvent.class, count = 1),
|
@Expect(type = TargetUpdatedEvent.class, count = 3), @Expect(type = ActionUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 2),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 2),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 2),
|
@Expect(type = ActionCreatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetAttributesRequestedEvent.class, count = 1),
|
@Expect(type = TargetAttributesRequestedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 6) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 6)})
|
||||||
public void rootRsNotModified() throws Exception {
|
public void rootRsNotModified() throws Exception {
|
||||||
final String etag = mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant()))
|
final String etag = mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant()))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
@@ -289,8 +289,8 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
|||||||
@Test
|
@Test
|
||||||
@Description("Ensures that the target state machine of a precomissioned target switches from "
|
@Description("Ensures that the target state machine of a precomissioned target switches from "
|
||||||
+ "UNKNOWN to REGISTERED when the target polls for the first time.")
|
+ "UNKNOWN to REGISTERED when the target polls for the first time.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1)})
|
||||||
public void rootRsPrecommissioned() throws Exception {
|
public void rootRsPrecommissioned() throws Exception {
|
||||||
testdataFactory.createTarget("4711");
|
testdataFactory.createTarget("4711");
|
||||||
|
|
||||||
@@ -314,8 +314,8 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Ensures that the source IP address of the polling target is correctly stored in repository")
|
@Description("Ensures that the source IP address of the polling target is correctly stored in repository")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetPollEvent.class, count = 1)})
|
||||||
public void rootRsPlugAndPlayIpAddress() throws Exception {
|
public void rootRsPlugAndPlayIpAddress() throws Exception {
|
||||||
// test
|
// test
|
||||||
final String knownControllerId1 = "0815";
|
final String knownControllerId1 = "0815";
|
||||||
@@ -341,8 +341,8 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Ensures that the source IP address of the polling target is not stored in repository if disabled")
|
@Description("Ensures that the source IP address of the polling target is not stored in repository if disabled")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetPollEvent.class, count = 1)})
|
||||||
public void rootRsIpAddressNotStoredIfDisabled() throws Exception {
|
public void rootRsIpAddressNotStoredIfDisabled() throws Exception {
|
||||||
securityProperties.getClients().setTrackRemoteIp(false);
|
securityProperties.getClients().setTrackRemoteIp(false);
|
||||||
|
|
||||||
@@ -360,12 +360,12 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Controller trys to finish an update process after it has been finished by an error action status.")
|
@Description("Controller trys to finish an update process after it has been finished by an error action status.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3)})
|
||||||
public void tryToFinishAnUpdateProcessAfterItHasBeenFinished() throws Exception {
|
public void tryToFinishAnUpdateProcessAfterItHasBeenFinished() throws Exception {
|
||||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||||
Target savedTarget = testdataFactory.createTarget("911");
|
Target savedTarget = testdataFactory.createTarget("911");
|
||||||
@@ -385,13 +385,13 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Controller sends attribute update request after device successfully closed software update.")
|
@Description("Controller sends attribute update request after device successfully closed software update.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 2),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 2),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 2), @Expect(type = ActionUpdatedEvent.class, count = 2),
|
@Expect(type = ActionCreatedEvent.class, count = 2), @Expect(type = ActionUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 6), @Expect(type = TargetPollEvent.class, count = 4),
|
@Expect(type = TargetUpdatedEvent.class, count = 6), @Expect(type = TargetPollEvent.class, count = 4),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3),
|
||||||
@Expect(type = TargetAttributesRequestedEvent.class, count = 1) })
|
@Expect(type = TargetAttributesRequestedEvent.class, count = 1)})
|
||||||
public void attributeUpdateRequestSendingAfterSuccessfulDeployment() throws Exception {
|
public void attributeUpdateRequestSendingAfterSuccessfulDeployment() throws Exception {
|
||||||
final DistributionSet ds = testdataFactory.createDistributionSet("1");
|
final DistributionSet ds = testdataFactory.createDistributionSet("1");
|
||||||
final Target savedTarget = testdataFactory.createTarget("922");
|
final Target savedTarget = testdataFactory.createTarget("922");
|
||||||
@@ -464,13 +464,13 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Test to verify that only a specific count of messages are returned based on the input actionHistory for getControllerDeploymentActionFeedback endpoint.")
|
@Description("Test to verify that only a specific count of messages are returned based on the input actionHistory for getControllerDeploymentActionFeedback endpoint.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 2),
|
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetAttributesRequestedEvent.class, count = 1),
|
@Expect(type = TargetAttributesRequestedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3)})
|
||||||
public void testActionHistoryCount() throws Exception {
|
public void testActionHistoryCount() throws Exception {
|
||||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||||
Target savedTarget = testdataFactory.createTarget("911");
|
Target savedTarget = testdataFactory.createTarget("911");
|
||||||
@@ -500,13 +500,13 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Test to verify that a zero input value of actionHistory results in no action history appended for getControllerDeploymentActionFeedback endpoint.")
|
@Description("Test to verify that a zero input value of actionHistory results in no action history appended for getControllerDeploymentActionFeedback endpoint.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 2),
|
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetAttributesRequestedEvent.class, count = 1),
|
@Expect(type = TargetAttributesRequestedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3)})
|
||||||
public void testActionHistoryZeroInput() throws Exception {
|
public void testActionHistoryZeroInput() throws Exception {
|
||||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||||
Target savedTarget = testdataFactory.createTarget("911");
|
Target savedTarget = testdataFactory.createTarget("911");
|
||||||
@@ -532,13 +532,13 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Test to verify that entire action history is returned if the input value for actionHistory is -1, for getControllerDeploymentActionFeedback endpoint.")
|
@Description("Test to verify that entire action history is returned if the input value for actionHistory is -1, for getControllerDeploymentActionFeedback endpoint.")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 2),
|
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = ActionUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
@Expect(type = TargetUpdatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetAttributesRequestedEvent.class, count = 1),
|
@Expect(type = TargetAttributesRequestedEvent.class, count = 1),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3)})
|
||||||
public void testActionHistoryNegativeInput() throws Exception {
|
public void testActionHistoryNegativeInput() throws Exception {
|
||||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||||
Target savedTarget = testdataFactory.createTarget("911");
|
Target savedTarget = testdataFactory.createTarget("911");
|
||||||
@@ -671,6 +671,14 @@ public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Description("The system should not create a new target because of a too long controller id.")
|
||||||
|
public void rootRsWithInvalidControllerId() throws Exception {
|
||||||
|
String invalidControllerId = RandomStringUtils.randomAlphabetic(Target.CONTROLLER_ID_MAX_SIZE + 1);
|
||||||
|
mvc.perform(get("/{tenant}/controller/v1/{controllerId}", tenantAware.getCurrentTenant(), invalidControllerId))
|
||||||
|
.andExpect(status().isBadRequest());
|
||||||
|
}
|
||||||
|
|
||||||
public void assertDeploymentActionIsExposedToTarget(final String controllerId, final long expectedActionId)
|
public void assertDeploymentActionIsExposedToTarget(final String controllerId, final long expectedActionId)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
final String expectedDeploymentBaseLink = String.format("/%s/controller/v1/%s/deploymentBase/%d",
|
final String expectedDeploymentBaseLink = String.format("/%s/controller/v1/%s/deploymentBase/%d",
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import org.eclipse.hawkbit.repository.model.Action;
|
|||||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
|
import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
|
||||||
|
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetWithActionType;
|
import org.eclipse.hawkbit.repository.model.TargetWithActionType;
|
||||||
@@ -989,7 +990,7 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
|
|||||||
.andExpect(status().isBadRequest());
|
.andExpect(status().isBadRequest());
|
||||||
|
|
||||||
final DistributionSet toLongName = testdataFactory
|
final DistributionSet toLongName = testdataFactory
|
||||||
.generateDistributionSet(RandomStringUtils.randomAlphanumeric(80));
|
.generateDistributionSet(RandomStringUtils.randomAlphanumeric(NamedEntity.NAME_MAX_SIZE + 1));
|
||||||
mvc.perform(post("/rest/v1/distributionsets").content(JsonBuilder.distributionSets(Arrays.asList(toLongName)))
|
mvc.perform(post("/rest/v1/distributionsets").content(JsonBuilder.distributionSets(Arrays.asList(toLongName)))
|
||||||
.contentType(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
.contentType(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
||||||
.andExpect(status().isBadRequest());
|
.andExpect(status().isBadRequest());
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
|||||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleTypeCreate;
|
import org.eclipse.hawkbit.repository.builder.SoftwareModuleTypeCreate;
|
||||||
import org.eclipse.hawkbit.repository.exception.QuotaExceededException;
|
import org.eclipse.hawkbit.repository.exception.QuotaExceededException;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||||
|
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||||
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
||||||
@@ -618,7 +619,7 @@ public class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIn
|
|||||||
.andExpect(status().isBadRequest());
|
.andExpect(status().isBadRequest());
|
||||||
|
|
||||||
final DistributionSetType toLongName = entityFactory.distributionSetType().create().key("test123")
|
final DistributionSetType toLongName = entityFactory.distributionSetType().create().key("test123")
|
||||||
.name(RandomStringUtils.randomAlphanumeric(80)).build();
|
.name(RandomStringUtils.randomAlphanumeric(NamedEntity.NAME_MAX_SIZE + 1)).build();
|
||||||
mvc.perform(post("/rest/v1/distributionsettypes")
|
mvc.perform(post("/rest/v1/distributionsettypes")
|
||||||
.content(JsonBuilder.distributionSetTypes(Arrays.asList(toLongName)))
|
.content(JsonBuilder.distributionSetTypes(Arrays.asList(toLongName)))
|
||||||
.contentType(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
.contentType(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.apache.commons.lang3.RandomStringUtils;
|
import org.apache.commons.lang3.RandomStringUtils;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||||
|
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||||
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
||||||
@@ -371,7 +372,7 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
|
|||||||
.andExpect(status().isBadRequest());
|
.andExpect(status().isBadRequest());
|
||||||
|
|
||||||
final SoftwareModuleType toLongName = entityFactory.softwareModuleType().create().key("test123")
|
final SoftwareModuleType toLongName = entityFactory.softwareModuleType().create().key("test123")
|
||||||
.name(RandomStringUtils.randomAlphanumeric(80)).build();
|
.name(RandomStringUtils.randomAlphanumeric(NamedEntity.NAME_MAX_SIZE + 1)).build();
|
||||||
mvc.perform(
|
mvc.perform(
|
||||||
post("/rest/v1/softwaremoduletypes").content(JsonBuilder.softwareModuleTypes(Arrays.asList(toLongName)))
|
post("/rest/v1/softwaremoduletypes").content(JsonBuilder.softwareModuleTypes(Arrays.asList(toLongName)))
|
||||||
.contentType(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import org.eclipse.hawkbit.repository.model.Action.Status;
|
|||||||
import org.eclipse.hawkbit.repository.model.ActionStatus;
|
import org.eclipse.hawkbit.repository.model.ActionStatus;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.MetaData;
|
import org.eclipse.hawkbit.repository.model.MetaData;
|
||||||
|
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetMetadata;
|
import org.eclipse.hawkbit.repository.model.TargetMetadata;
|
||||||
@@ -722,7 +723,7 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
|
|||||||
@Description("Verfies that a properties of new targets are validated as in allowed size range.")
|
@Description("Verfies that a properties of new targets are validated as in allowed size range.")
|
||||||
public void createTargetWithInvalidPropertyBadRequest() throws Exception {
|
public void createTargetWithInvalidPropertyBadRequest() throws Exception {
|
||||||
final Target test1 = entityFactory.target().create().controllerId("id1")
|
final Target test1 = entityFactory.target().create().controllerId("id1")
|
||||||
.name(RandomStringUtils.randomAlphanumeric(80)).build();
|
.name(RandomStringUtils.randomAlphanumeric(NamedEntity.NAME_MAX_SIZE + 1)).build();
|
||||||
|
|
||||||
final MvcResult mvcResult = mvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING)
|
final MvcResult mvcResult = mvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING)
|
||||||
.content(JsonBuilder.targets(Arrays.asList(test1), true)).contentType(MediaType.APPLICATION_JSON))
|
.content(JsonBuilder.targets(Arrays.asList(test1), true)).contentType(MediaType.APPLICATION_JSON))
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2019 Bosch Software Innovations GmbH and others.
|
||||||
|
#
|
||||||
|
# All rights reserved. This program and the accompanying materials
|
||||||
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
# which accompanies this distribution, and is available at
|
||||||
|
# http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
#
|
||||||
|
|
||||||
|
# This profile adds basic configurations for a DB2 DB usage.
|
||||||
|
# Keep in mind that you need the DB2 driver in your classpath on compile.
|
||||||
|
# see https://www.eclipse.org/hawkbit/guides/runhawkbit/
|
||||||
|
|
||||||
|
spring.jpa.database=DB2
|
||||||
|
spring.datasource.url=jdbc:db2://localhost:50000/hawkbit
|
||||||
|
spring.datasource.username=db2inst1
|
||||||
|
spring.datasource.password=db2inst1-pwd
|
||||||
|
spring.datasource.driverClassName=com.ibm.db2.jcc.DB2Driver
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
# This profile adds basic configurations for a Microsoft SQL Server DB usage.
|
# This profile adds basic configurations for a Microsoft SQL Server DB usage.
|
||||||
# Keep in mind that you need the SQL server driver in your classpath on compile.
|
# Keep in mind that you need the SQL server driver in your classpath on compile.
|
||||||
# see https://www.eclipse.org/hawkbit/documentation/guide/runhawkbit.html
|
# see https://www.eclipse.org/hawkbit/guides/runhawkbit/
|
||||||
|
|
||||||
spring.jpa.database=SQL_SERVER
|
spring.jpa.database=SQL_SERVER
|
||||||
spring.datasource.url=jdbc:sqlserver://localhost:1433;database=hawkbit
|
spring.datasource.url=jdbc:sqlserver://localhost:1433;database=hawkbit
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
# This profile adds basic configurations for a MySQL DB usage.
|
# This profile adds basic configurations for a MySQL DB usage.
|
||||||
# Keep in mind that you need the MariaDB driver in your classpath on compile.
|
# Keep in mind that you need the MariaDB driver in your classpath on compile.
|
||||||
# see https://www.eclipse.org/hawkbit/documentation/guide/runhawkbit.html
|
# see https://www.eclipse.org/hawkbit/guides/runhawkbit/
|
||||||
|
|
||||||
spring.jpa.database=MYSQL
|
spring.jpa.database=MYSQL
|
||||||
spring.datasource.url=jdbc:mysql://localhost:3306/hawkbit
|
spring.datasource.url=jdbc:mysql://localhost:3306/hawkbit
|
||||||
|
|||||||
Reference in New Issue
Block a user