Package org.rhq.modules.plugins.jbossas7

Examples of org.rhq.modules.plugins.jbossas7.BaseComponent


        assertTrue(executeRead(asConnection).isSuccess());
    }

    @Test(timeOut = 60 * 1000)
    public void testWithDefaultConnectionPersistence() throws Exception {
        ASConnectionParams asConnectionParams = new ASConnectionParamsBuilder() //
            .setHost(DC_HOST) //
            .setPort(DC_HTTP_PORT) //
            .setUsername(MANAGEMENT_USERNAME) //
            .setPassword(MANAGEMENT_PASSWORD) //
            .createASConnectionParams();
View Full Code Here


        assertTrue(executeRead(asConnection).isSuccess());
    }

    @Test(timeOut = 60 * 1000)
    public void shouldFailForTooLongKeepAliveDuration() throws Exception {
        ASConnectionParams asConnectionParams = new ASConnectionParamsBuilder() //
            .setHost(DC_HOST) //
            .setPort(DC_HTTP_PORT) //
            .setUsername(MANAGEMENT_USERNAME) //
            .setPassword(MANAGEMENT_PASSWORD) //
            .setKeepAliveTimeout(Long.valueOf(1000 * 60 * 60)) //
View Full Code Here

@Test(groups = { "integration", "nonpc" }, dependsOnGroups = "discovery")
public abstract class AbstractIntegrationTest {

    String uploadToAs(String deploymentPath) throws IOException {
        String fileName = new File(deploymentPath).getName();
        ASConnectionParams asConnectionParams = new ASConnectionParamsBuilder() //
            .setHost(DC_HOST) //
            .setPort(DC_HTTP_PORT) //
            .setUsername(MANAGEMENT_USERNAME) //
            .setPassword(MANAGEMENT_PASSWORD) //
            .createASConnectionParams();
View Full Code Here

    private ASConnectionFactory() {
        // Utility class
    }

    public static ASConnection getStandaloneASConnection() {
        ASConnectionParams asConnectionParams = new ASConnectionParamsBuilder() //
            .setHost(STANDALONE_HOST) //
            .setPort(STANDALONE_HTTP_PORT) //
            .setUsername(MANAGEMENT_USERNAME) //
            .setPassword(MANAGEMENT_PASSWORD) //
            .createASConnectionParams();
View Full Code Here

            .createASConnectionParams();
        return new ASConnection(asConnectionParams);
    }

    public static ASConnection getDomainControllerASConnection() {
        ASConnectionParams asConnectionParams = new ASConnectionParamsBuilder() //
            .setHost(DC_HOST) //
            .setPort(DC_HTTP_PORT) //
            .setUsername(MANAGEMENT_USERNAME) //
            .setPassword(MANAGEMENT_PASSWORD) //
            .createASConnectionParams();
View Full Code Here

        executorService.shutdownNow();
    }

    @Test(timeOut = 60 * 1000)
    public void testWithDisabledConnectionPersistence() throws Exception {
        ASConnectionParams asConnectionParams = new ASConnectionParamsBuilder() //
            .setHost(DC_HOST) //
            .setPort(DC_HTTP_PORT) //
            .setUsername(MANAGEMENT_USERNAME) //
            .setPassword(MANAGEMENT_PASSWORD) //
            .setKeepAliveTimeout(Long.valueOf(-1)) //
View Full Code Here

        assertTrue(executeRead(asConnection).isSuccess());
    }

    @Test(timeOut = 60 * 1000)
    public void testWithDefaultConnectionPersistence() throws Exception {
        ASConnectionParams asConnectionParams = new ASConnectionParamsBuilder() //
            .setHost(DC_HOST) //
            .setPort(DC_HTTP_PORT) //
            .setUsername(MANAGEMENT_USERNAME) //
            .setPassword(MANAGEMENT_PASSWORD) //
            .createASConnectionParams();
View Full Code Here

        assertTrue(executeRead(asConnection).isSuccess());
    }

    @Test(timeOut = 60 * 1000)
    public void shouldFailForTooLongKeepAliveDuration() throws Exception {
        ASConnectionParams asConnectionParams = new ASConnectionParamsBuilder() //
            .setHost(DC_HOST) //
            .setPort(DC_HTTP_PORT) //
            .setUsername(MANAGEMENT_USERNAME) //
            .setPassword(MANAGEMENT_PASSWORD) //
            .setKeepAliveTimeout(Long.valueOf(1000 * 60 * 60)) //
View Full Code Here

            .setHost(DC_HOST) //
            .setPort(DC_HTTP_PORT) //
            .setUsername(MANAGEMENT_USERNAME) //
            .setPassword(MANAGEMENT_PASSWORD) //
            .createASConnectionParams();
        ASUploadConnection conn = new ASUploadConnection(asConnectionParams, fileName);
        OutputStream os = conn.getOutputStream();

        InputStream fis = getClass().getClassLoader().getResourceAsStream(deploymentPath);
        if (fis == null) {
            File inputFile = new File(deploymentPath);
            if (!inputFile.canRead()) {
                throw new FileNotFoundException("Input stream for path [" + deploymentPath
                    + "] could not be opened - does the file exist either in the test classpath or on the filesystem?");
            }
            fis = new FileInputStream(inputFile);
        }

        StreamUtil.copy(fis, os, false);
        try {
            fis.close();
        } catch (IOException e) {
            // ignore
        }

        JsonNode node = conn.finishUpload();
        //        System.out.println(node);
        assert node != null : "No result from upload - node was null";
        assert node.has("outcome") : "No outcome from upload";
        String outcome = node.get("outcome").getTextValue();
        assert outcome.equals("success") : "Upload was no success, but: [" + outcome + "]";
View Full Code Here

    /**
     * Test the real API code for uploading - case 1: just upload to /deployment
     * @throws Exception if anything goes wrong.
     */
    public void testUploadViaCreateChild1() throws Exception {
        BaseComponent bc = new BaseComponent();
        bc.setPath("");
        ResourceType rt = new ResourceType();
        rt.setName("Deployment");
        Resource resource = new Resource("deployment=" + TEST_WAR_FILE_NAME, TEST_WAR_FILE_NAME, rt); // TODO resource key?
        resource.setUuid(UUID.randomUUID().toString());
        StandaloneASComponent parentComponent = new StandaloneASComponent();
        parentComponent.setConnection(getDomainControllerASConnection());
        ResourceContext context = new ResourceContext(resource, parentComponent, null, null, null, null, null, null,
            null, null, null, null, null, null);
        bc.start(context);

        String bytes_value = uploadToAs(TEST_WAR_PATH);

        ResourcePackageDetails details = new ResourcePackageDetails(new PackageDetailsKey(TEST_WAR_FILE_NAME, "1.0",
            "deployment", "all"));
        CreateResourceReport report = new CreateResourceReport(TEST_WAR_FILE_NAME, rt, new Configuration(),
            new Configuration(), details);
        try {
            report = bc.runDeploymentMagicOnServer(report, TEST_WAR_FILE_NAME, TEST_WAR_FILE_NAME, bytes_value);
            assert report != null;
            assert report.getErrorMessage() == null : "Report contained an unexpected error: "
                + report.getErrorMessage();
            assert report.getStatus() != null : "Report did not contain a status";
            assert report.getStatus() == CreateResourceStatus.SUCCESS : "Status was no success";
View Full Code Here

TOP

Related Classes of org.rhq.modules.plugins.jbossas7.BaseComponent

Copyright © 2018 www.massapicom. 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.