Examples of KieContainerResource


Examples of org.kie.server.api.model.KieContainerResource

        this(containerId, status, null);
    }

    public KieContainerInstance(String containerId, KieContainerStatus status, InternalKieContainer kieContainer) {
        super();
        this.resource = new KieContainerResource(containerId, kieContainer != null ? new ReleaseId(kieContainer.getContainerReleaseId()) : null, status);
        this.kieContainer = kieContainer;
    }
View Full Code Here

Examples of org.kie.server.api.model.KieContainerResource

        createAndDeployKJar(releaseId2);
    }

    @Test
    public void testCreateContainer() throws Exception {
        ServiceResponse<KieContainerResource> reply = client.createContainer("kie1", new KieContainerResource("kie1",
                                                                                                              releaseId1));
        Assert.assertEquals(ServiceResponse.ResponseType.SUCCESS, reply.getType());
    }
View Full Code Here

Examples of org.kie.server.api.model.KieContainerResource

    }

    @Test
    public void testCreateContainerNonExistingGAV() throws Exception {
        ServiceResponse<KieContainerResource> reply = client.createContainer("bad-gav",
                                                                             new KieContainerResource("bad-gav",
                                                                                                      new ReleaseId(
                                                                                                              "foo",
                                                                                                              "bar",
                                                                                                              "0.0.0")));
        Assert.assertEquals(ServiceResponse.ResponseType.FAILURE, reply.getType());
View Full Code Here

Examples of org.kie.server.api.model.KieContainerResource

        Assert.assertEquals(ServiceResponse.ResponseType.FAILURE, reply.getType());
    }

    @Test
    public void testCreateContainerNonExistingGAV2() throws Exception {
        KieContainerResource resource = new KieContainerResource("no-gav2-container",
                                                                 new ReleaseId("foo", "bar", "0.0.0"));

        ClientResponse<ServiceResponse<KieContainerResource>> response = null;
        try {
            ClientRequest clientRequest = newRequest(BASE_URI + "/containers/" + resource.getContainerId());
            response = clientRequest.body(
                    MediaType.APPLICATION_XML_TYPE, resource).put(
                    new GenericType<ServiceResponse<KieContainerResource>>() {
                    });
            Assert.assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatus());
            Assert.assertEquals(ServiceResponse.ResponseType.FAILURE, response.getEntity().getType());
        } catch (Exception e) {
            throw new ClientResponseFailure(
                    "Unexpected exception creating container: " + resource.getContainerId() + " with release-id " + resource.getReleaseId(),
                    e, response);
        }
    }
View Full Code Here

Examples of org.kie.server.api.model.KieContainerResource

    }

    @Test
    public void testCreateContainerAfterFailure() throws Exception {
        // non-existing ID to simulate failure
        KieContainerResource resource = new KieContainerResource("kie1", new ReleaseId("non-existing", "non-existing",
                                                                                       "0.0.0"));
        ServiceResponse<KieContainerResource> reply = client.createContainer(resource.getContainerId(), resource);

        Assert.assertEquals(ServiceResponse.ResponseType.FAILURE, reply.getType());

        // now try to re-create the container with a valid release ID
        resource.setReleaseId(releaseId1);
        reply = client.createContainer(resource.getContainerId(), resource);

        Assert.assertEquals(ServiceResponse.ResponseType.SUCCESS, reply.getType());
    }
View Full Code Here

Examples of org.kie.server.api.model.KieContainerResource

        Assert.assertEquals(ServiceResponse.ResponseType.SUCCESS, reply.getType());
    }

    @Test
    public void testGetContainerInfo() throws Exception {
        client.createContainer("container-info", new KieContainerResource("container-info", releaseId1));
        ServiceResponse<KieContainerResource> reply = client.getContainerInfo("container-info");
        Assert.assertEquals(ServiceResponse.ResponseType.SUCCESS, reply.getType());

        KieContainerResource info = reply.getResult();
        Assert.assertEquals(KieContainerStatus.STARTED, info.getStatus());
    }
View Full Code Here

Examples of org.kie.server.api.model.KieContainerResource

        Assert.assertEquals(ServiceResponse.ResponseType.FAILURE, reply.getType());
    }

    @Test
    public void testListContainers() throws Exception {
        client.createContainer("list-containers-c1", new KieContainerResource("list-containers-c1", releaseId1));
        client.createContainer("list-containers-c2", new KieContainerResource("list-containers-c2", releaseId1));
        ServiceResponse<KieContainerResourceList> reply = client.listContainers();
        Assert.assertEquals(ServiceResponse.ResponseType.SUCCESS, reply.getType());
        List<KieContainerResource> containers = reply.getResult().getContainers();
        Assert.assertEquals("Number of listed containers!", 2, containers.size());
        assertContainsContainer(containers, "list-containers-c1");
View Full Code Here

Examples of org.kie.server.api.model.KieContainerResource

        assertContainsContainer(containers, "list-containers-c2");
    }

    @Test
    public void testUpdateReleaseIdForExistingContainer() throws Exception {
        client.createContainer("update-releaseId", new KieContainerResource("update-releaseId", releaseId1));

        ServiceResponse<ReleaseId> reply = client.updateReleaseId("update-releaseId", releaseId2);
        Assert.assertEquals(ServiceResponse.ResponseType.SUCCESS, reply.getType());
        Assert.assertEquals(releaseId2, reply.getResult());
View Full Code Here

Examples of org.kie.server.api.model.KieContainerResource

        Assert.assertEquals(ServiceResponse.ResponseType.SUCCESS, disposeReply.getType());
    }

    @Test
    public void testDisposeContainer() throws Exception {
        client.createContainer("dispose-container", new KieContainerResource("dispose-container", releaseId1));
        ServiceResponse<Void> reply = client.disposeContainer("dispose-container");
        Assert.assertEquals(ServiceResponse.ResponseType.SUCCESS, reply.getType());
        // verify the container is no longer returned when calling listContainers()
        ServiceResponse<KieContainerResourceList> listReply = client.listContainers();
        Assert.assertEquals(ServiceResponse.ResponseType.SUCCESS, listReply.getType());
View Full Code Here

Examples of org.kie.server.api.model.KieContainerResource

        buildAndDeployMavenProject(ClassLoader.class.getResource("/kjars-sources/container-isolation-kjar2").getFile());
    }

    @Test
    public void testUseClassWithSameFQNInDifferentContainers() {
        assertSuccess(client.createContainer("container-isolation-kjar1", new KieContainerResource("container-isolation-kjar1", kjar1)));

        String payload1 = "<batch-execution lookup=\"kjar1.session\">\n" +
                "  <insert out-identifier=\"person\">\n" +
                "    <org.kie.server.testing.Person/>\n" +
                "  </insert>\n" +
                "  <fire-all-rules />\n" +
                "</batch-execution>";
        ServiceResponse<String> response1 = client.executeCommands("container-isolation-kjar1", payload1);
        assertSuccess(response1);
        String result1 = response1.getResult();
        assertTrue("Person's id should be 'Person from kjar1'!. Got result: " + result1, result1.contains("<id>Person from kjar1</id>"));

        // now execute the same commands, but for the second container. The rule in there should set different id
        // (namely "Person from kjar2") for the inserted person
        assertSuccess(client.createContainer("container-isolation-kjar2", new KieContainerResource("container-isolation-kjar2", kjar2)));
        String payload2 = "<batch-execution lookup=\"kjar2.session\">\n" +
                "  <insert out-identifier=\"person\">\n" +
                "    <org.kie.server.testing.Person/>\n" +
                "  </insert>\n" +
                "  <fire-all-rules />\n" +
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.