Search in sources :

Example 1 with SupportedTransports

use of org.kie.server.services.api.SupportedTransports in project droolsjbpm-integration by kiegroup.

the class AbstractKieServerImplTest method testHealthCheckFailedExtension.

@Test
public void testHealthCheckFailedExtension() {
    extensions.add(new KieServerExtension() {

        @Override
        public List<Message> healthCheck(boolean report) {
            List<Message> messages = KieServerExtension.super.healthCheck(report);
            messages.add(new Message(Severity.ERROR, "TEST extension is unhealthy"));
            return messages;
        }

        @Override
        public void updateContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) {
        }

        @Override
        public boolean isUpdateContainerAllowed(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) {
            return false;
        }

        @Override
        public boolean isInitialized() {
            return true;
        }

        @Override
        public boolean isActive() {
            return true;
        }

        @Override
        public void init(KieServerImpl kieServer, KieServerRegistry registry) {
        }

        @Override
        public Integer getStartOrder() {
            return 10;
        }

        @Override
        public List<Object> getServices() {
            return null;
        }

        @Override
        public String getImplementedCapability() {
            return "TEST";
        }

        @Override
        public String getExtensionName() {
            return "TEST";
        }

        @Override
        public <T> T getAppComponents(Class<T> serviceType) {
            return null;
        }

        @Override
        public List<Object> getAppComponents(SupportedTransports type) {
            return null;
        }

        @Override
        public void disposeContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) {
        }

        @Override
        public void destroy(KieServerImpl kieServer, KieServerRegistry registry) {
        }

        @Override
        public void createContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) {
        }
    });
    kieServer.init();
    List<Message> healthMessages = kieServer.healthCheck(false);
    assertEquals(healthMessages.size(), 1);
    Message failedContainer = healthMessages.get(0);
    assertEquals(Severity.ERROR, failedContainer.getSeverity());
    assertEquals(1, failedContainer.getMessages().size());
    assertEquals("TEST extension is unhealthy", failedContainer.getMessages().iterator().next());
}
Also used : Message(org.kie.server.api.model.Message) KieServerExtension(org.kie.server.services.api.KieServerExtension) Matchers.anyString(org.mockito.Matchers.anyString) KieContainerInstance(org.kie.server.services.api.KieContainerInstance) SupportedTransports(org.kie.server.services.api.SupportedTransports) KieServerRegistry(org.kie.server.services.api.KieServerRegistry) KieContainerResourceList(org.kie.server.api.model.KieContainerResourceList) List(java.util.List) ArrayList(java.util.ArrayList) ServiceResponsesList(org.kie.server.api.model.ServiceResponsesList) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 Test (org.junit.Test)1 KieContainerResourceList (org.kie.server.api.model.KieContainerResourceList)1 Message (org.kie.server.api.model.Message)1 ServiceResponsesList (org.kie.server.api.model.ServiceResponsesList)1 KieContainerInstance (org.kie.server.services.api.KieContainerInstance)1 KieServerExtension (org.kie.server.services.api.KieServerExtension)1 KieServerRegistry (org.kie.server.services.api.KieServerRegistry)1 SupportedTransports (org.kie.server.services.api.SupportedTransports)1 Matchers.anyString (org.mockito.Matchers.anyString)1