Search in sources :

Example 16 with Policy

use of com.redhat.cloud.policies.app.model.Policy in project policies-ui-backend by RedHatInsights.

the class FullTriggerHandlingTest method testActionUpdate4.

@Test
void testActionUpdate4() {
    Policy p = createPolicy();
    p.actions = "notification";
    FullTrigger ft = new FullTrigger(p);
    p.actions = null;
    ft.updateFromPolicy(p);
    assertEquals(0, ft.trigger.actions.size());
}
Also used : Policy(com.redhat.cloud.policies.app.model.Policy) FullTrigger(com.redhat.cloud.policies.app.model.engine.FullTrigger) Test(org.junit.jupiter.api.Test)

Example 17 with Policy

use of com.redhat.cloud.policies.app.model.Policy in project policies-ui-backend by RedHatInsights.

the class FullTriggerHandlingTest method testNameUpdate.

@Test
void testNameUpdate() {
    Policy p = createPolicy();
    FullTrigger ft = new FullTrigger(p);
    p.name = p.name + "-2";
    ft.updateFromPolicy(p);
    assertEquals("hula-2", ft.trigger.name);
}
Also used : Policy(com.redhat.cloud.policies.app.model.Policy) FullTrigger(com.redhat.cloud.policies.app.model.engine.FullTrigger) Test(org.junit.jupiter.api.Test)

Example 18 with Policy

use of com.redhat.cloud.policies.app.model.Policy in project policies-ui-backend by RedHatInsights.

the class FullTriggerHandlingTest method testActionWithParam.

@Test
void testActionWithParam() {
    Policy p = createPolicy();
    p.actions = "notification maybe-param";
    FullTrigger ft = new FullTrigger(p);
    assertEquals(1, ft.trigger.actions.size());
}
Also used : Policy(com.redhat.cloud.policies.app.model.Policy) FullTrigger(com.redhat.cloud.policies.app.model.engine.FullTrigger) Test(org.junit.jupiter.api.Test)

Example 19 with Policy

use of com.redhat.cloud.policies.app.model.Policy in project policies-ui-backend by RedHatInsights.

the class FullTriggerHandlingTest method testDescriptionUpdate.

@Test
void testDescriptionUpdate() {
    Policy p = createPolicy();
    FullTrigger ft = new FullTrigger(p);
    p.description = p.description + "-2";
    ft.updateFromPolicy(p);
    assertEquals("some text-2", ft.trigger.description);
}
Also used : Policy(com.redhat.cloud.policies.app.model.Policy) FullTrigger(com.redhat.cloud.policies.app.model.engine.FullTrigger) Test(org.junit.jupiter.api.Test)

Example 20 with Policy

use of com.redhat.cloud.policies.app.model.Policy in project policies-ui-backend by RedHatInsights.

the class FullTriggerHandlingTest method testEnabledUpdate.

@Test
void testEnabledUpdate() {
    Policy p = createPolicy();
    FullTrigger ft = new FullTrigger(p);
    p.isEnabled = true;
    ft.updateFromPolicy(p);
    assertTrue(ft.trigger.enabled);
}
Also used : Policy(com.redhat.cloud.policies.app.model.Policy) FullTrigger(com.redhat.cloud.policies.app.model.engine.FullTrigger) Test(org.junit.jupiter.api.Test)

Aggregations

Policy (com.redhat.cloud.policies.app.model.Policy)21 Msg (com.redhat.cloud.policies.app.model.Msg)11 FullTrigger (com.redhat.cloud.policies.app.model.engine.FullTrigger)11 Path (javax.ws.rs.Path)11 Operation (org.eclipse.microprofile.openapi.annotations.Operation)9 APIResponse (org.eclipse.microprofile.openapi.annotations.responses.APIResponse)9 NotFoundException (javax.ws.rs.NotFoundException)8 Test (org.junit.jupiter.api.Test)8 Transactional (javax.transaction.Transactional)7 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)6 ConnectException (java.net.ConnectException)6 PersistenceException (javax.persistence.PersistenceException)6 SystemException (javax.transaction.SystemException)6 ProcessingException (javax.ws.rs.ProcessingException)6 WebApplicationException (javax.ws.rs.WebApplicationException)6 ConstraintViolationException (org.hibernate.exception.ConstraintViolationException)6 POST (javax.ws.rs.POST)5 ResponseBuilder (javax.ws.rs.core.Response.ResponseBuilder)5 Parameter (org.eclipse.microprofile.openapi.annotations.parameters.Parameter)5 GET (javax.ws.rs.GET)4