Examples of CreateResourceReport


Examples of org.rhq.core.pluginapi.inventory.CreateResourceReport

            log.debug("Creating " + creationType + "-based resource of type '" + request.getResourceTypeName()
                + "' and with parent with id " + request.getParentResourceId() + "...");
        }

        // Create the report to send the plugin
        CreateResourceReport report = new CreateResourceReport(request.getResourceName(), resourceType, request
            .getPluginConfiguration(), request.getResourceConfiguration(), request.getPackageDetails());

        // Execute the create against the plugin
        CreateChildResourceFacet facet = getCreateChildResourceFacet(request.getParentResourceId(), request
            .getTimeout());
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.CreateResourceReport

            log.debug("Creating " + creationType + "-based resource of type '" + request.getResourceTypeName()
                + "' and with parent with id " + request.getParentResourceId() + "...");
        }

        // Create the report to send the plugin
        CreateResourceReport report = new CreateResourceReport(request.getResourceName(), resourceType, request
            .getPluginConfiguration(), request.getResourceConfiguration(), request.getPackageDetails());

        // Execute the create against the plugin
        CreateChildResourceFacet facet = getCreateChildResourceFacet(request.getParentResourceId(), request
            .getTimeout());
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.CreateResourceReport

        super.updateResourceConfiguration(report);
    }

    @Override
    public CreateResourceReport createResource(CreateResourceReport reportIn) {
        CreateResourceReport report = reportIn;
        Configuration config = report.getResourceConfiguration();
        String name = config.getSimple(SambaShareComponent.NAME_RESOURCE_CONFIG_PROP).getStringValue();
        report.setResourceKey(name);
        report.setResourceName(name);
        return super.createResource(report);
    }
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.CreateResourceReport

        rc.put(new PropertySimple("socket-binding-group", "standard-sockets"));
        ResourceType rt = new ResourceType("ServerGroup", PLUGIN_NAME, ResourceCategory.SERVICE, null);

        String serverGroupName = "_test-sg";
        try {
            CreateResourceReport report = new CreateResourceReport(serverGroupName, rt, new Configuration(), rc, null);
            report = hcc.createResource(report);

            assert report != null : "Report was null.";
            assert report.getStatus() == CreateResourceStatus.SUCCESS : "Create was a failure: "
                + report.getErrorMessage();
        } finally {
            Remove r = new Remove("server-group", serverGroupName);
            connection.execute(r);
        }
    }
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.CreateResourceReport

        rc.put(new PropertySimple("socket-binding-group", "standard-sockets"));
        ResourceType rt = new ResourceType("ServerGroup", PLUGIN_NAME, ResourceCategory.SERVICE, null);

        String serverGroupName = "_test-sg";
        try {
            CreateResourceReport report = new CreateResourceReport(serverGroupName, rt, new Configuration(), rc, null);
            report = hcc.createResource(report);

            assert report != null : "Report was null.";
            assert report.getStatus() == CreateResourceStatus.FAILURE : "Is AS7-1430 solved ?";
            assert report.getException() == null : report.getException();
        } finally {
            Remove r = new Remove("server-group", serverGroupName);
            connection.execute(r);
        }
    }
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.CreateResourceReport

        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";
            assert report.getResourceName().equals(TEST_WAR_FILE_NAME);
            assert report.getResourceKey().equals("deployment=" + TEST_WAR_FILE_NAME);
        } finally {
            Remove r = new Remove("deployment", TEST_WAR_FILE_NAME);
            getDomainControllerASConnection().execute(r);
        }
    }
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.CreateResourceReport

        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";
            assert report.getResourceName().equals(TEST_WAR_FILE_NAME);
            assert report.getResourceKey().equals("server-group=main-server-group,deployment=" + TEST_WAR_FILE_NAME) : "Resource key was wrong";
        } finally {
            Address sgd = new Address("server-group", "main-server-group");
            sgd.add("deployment", TEST_WAR_FILE_NAME);
            Remove r = new Remove(sgd);
            getDomainControllerASConnection().execute(r);
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.CreateResourceReport

    @SuppressWarnings({ "unchecked" })
    @Test
    public void createResourceWithType() throws Exception {
        //tell the method story as it happens: mock or create dependencies and configure
        //those dependencies to get the method under test to completion.
        CreateResourceReport mockReport = mock(CreateResourceReport.class);

        Configuration mockConfiguration = mock(Configuration.class);
        when(mockReport.getResourceConfiguration()).thenReturn(mockConfiguration);

        PropertySimple typePropertySimple = new PropertySimple("__type", "xyz");
        when(mockConfiguration.get(eq("__type"))).thenReturn(typePropertySimple);

        ResourceType mockResourceType = mock(ResourceType.class);
        when(mockReport.getResourceType()).thenReturn(mockResourceType);

        ConfigurationDefinition mockConfigurationDefinition = mock(ConfigurationDefinition.class);
        when(mockResourceType.getResourceConfigurationDefinition()).thenReturn(mockConfigurationDefinition);

        Map<String, PropertyDefinition> mockMap = (Map<String, PropertyDefinition>) mock(Map.class);
        when(mockConfigurationDefinition.getPropertyDefinitions()).thenReturn(mockMap);

        CreateResourceDelegate mockCreateResourceDelegate = mock(CreateResourceDelegate.class);
        PowerMockito.whenNew(CreateResourceDelegate.class)
            .withParameterTypes(ConfigurationDefinition.class, ASConnection.class, Address.class)
            .withArguments(any(ConfigurationDefinition.class), any(ASConnection.class), any(Address.class))
            .thenReturn(mockCreateResourceDelegate);

        when(mockReport.getResourceConfiguration()).thenReturn(mockConfiguration);

        when(mockReport.getPluginConfiguration()).thenReturn(mockConfiguration);

        PropertySimple pathPropertySimple = new PropertySimple("path", "xyz");
        PowerMockito.whenNew(PropertySimple.class).withParameterTypes(String.class, Object.class)
            .withArguments(eq("path"), eq("xyz")).thenReturn(pathPropertySimple);

        when(mockCreateResourceDelegate.createResource(eq(mockReport))).thenReturn(mockReport);

        ASConnection mockASConnection = mock(ASConnection.class);

        //create object to test and inject required dependencies
        TemplatedSubResourcesComponent objectUnderTest = new TemplatedSubResourcesComponent();
        objectUnderTest.testConnection = mockASConnection;

        //run code under test
        CreateResourceReport result = objectUnderTest.createResource(mockReport);

        //verify the results (Assert and mock verification)
        Assert.assertEquals(result, mockReport);

        verify(mockMap, times(1)).remove(eq("__type"));
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.CreateResourceReport

    @SuppressWarnings({ "unchecked" })
    @Test
    public void createResourceWithName() throws Exception {
        //tell the method story as it happens: mock or create dependencies and configure
        //those dependencies to get the method under test to completion.
        CreateResourceReport mockReport = mock(CreateResourceReport.class);

        Configuration mockConfiguration = mock(Configuration.class);
        when(mockReport.getResourceConfiguration()).thenReturn(mockConfiguration);

        PropertySimple namePropertySimple = new PropertySimple("__name", "xyz");
        when(mockConfiguration.get(eq("__type"))).thenReturn(null);
        when(mockConfiguration.get(eq("__name"))).thenReturn(namePropertySimple);

        ResourceType mockResourceType = mock(ResourceType.class);
        when(mockReport.getResourceType()).thenReturn(mockResourceType);

        ConfigurationDefinition mockConfigurationDefinition = mock(ConfigurationDefinition.class);
        when(mockResourceType.getResourceConfigurationDefinition()).thenReturn(mockConfigurationDefinition);

        Map<String, PropertyDefinition> mockMap = (Map<String, PropertyDefinition>) mock(Map.class);
        when(mockConfigurationDefinition.getPropertyDefinitions()).thenReturn(mockMap);

        CreateResourceDelegate mockCreateResourceDelegate = mock(CreateResourceDelegate.class);
        PowerMockito.whenNew(CreateResourceDelegate.class)
            .withParameterTypes(ConfigurationDefinition.class, ASConnection.class, Address.class)
            .withArguments(any(ConfigurationDefinition.class), any(ASConnection.class), any(Address.class))
            .thenReturn(mockCreateResourceDelegate);

        when(mockReport.getResourceConfiguration()).thenReturn(mockConfiguration);

        when(mockReport.getPluginConfiguration()).thenReturn(mockConfiguration);

        when(mockCreateResourceDelegate.createResource(eq(mockReport))).thenReturn(mockReport);

        ASConnection mockASConnection = mock(ASConnection.class);

        //create object to test and inject required dependencies
        TemplatedSubResourcesComponent objectUnderTest = new TemplatedSubResourcesComponent();
        objectUnderTest.testConnection = mockASConnection;

        //run code under test
        CreateResourceReport result = objectUnderTest.createResource(mockReport);

        //verify the results (Assert and mock verification)
        Assert.assertEquals(result, mockReport);

        verify(mockMap, times(1)).remove(eq("__name"));
View Full Code Here

Examples of org.rhq.core.pluginapi.inventory.CreateResourceReport

        //public method will be tested, while the rest will be mocked.
        TomcatVHostComponent objectUnderTest = mock(TomcatVHostComponent.class);

        //tell the method story as it happens: mock dependencies and configure
        //those dependencies to get the method under test to completion.
        CreateResourceReport mockCreateResourceReport = mock(CreateResourceReport.class);
        ResourceType mockResourceType = mock(ResourceType.class);
        when(mockCreateResourceReport.getResourceType()).thenReturn(mockResourceType);
        when(mockResourceType.getName()).thenReturn("Tomcat Web Application (WAR)");

        ResourcePackageDetails mockResourcePackageDetails = mock(ResourcePackageDetails.class);
        when(mockCreateResourceReport.getPackageDetails()).thenReturn(mockResourcePackageDetails);
        PackageDetailsKey mockPackageDetailsKey = mock(PackageDetailsKey.class);
        when(mockResourcePackageDetails.getKey()).thenReturn(mockPackageDetailsKey);
        when(mockPackageDetailsKey.getName()).thenReturn("testApplication.war");

        Configuration mockConfiguration = mock(Configuration.class);
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.