Package org.rhq.plugins.jbossas5.helper

Examples of org.rhq.plugins.jbossas5.helper.JBossProperties


    @SuppressWarnings("static-access")
    private String findConfigurationFile(ResourceComponent parentResourceComponent) {
        try {
            if (parentResourceComponent instanceof ApplicationServerComponent) {
                ApplicationServerComponent parentComponent = (ApplicationServerComponent) parentResourceComponent;

                return parentComponent.getResourceContext().getPluginConfiguration().getSimple("serverHomeDir")
                    .getStringValue()
                    + JBOSS_AS5_CONFIGURATION_FILE_RELATIVE_PATH;

            }
        } catch (java.lang.NoClassDefFoundError e) {
            //Do absolutely nothing, that means the class loader does not have this module loaded.
            //Just continue with the next discovery attempt.
        }

        try {
            if (parentResourceComponent instanceof JBossASServerComponent) {
                JBossASServerComponent parentComponent = (JBossASServerComponent) parentResourceComponent;

                return parentComponent.getPluginConfiguration()
                    .getSimple(parentComponent.CONFIGURATION_PATH_CONFIG_PROP).getStringValue()
                    + JBOSS_AS4_CONFIGURATION_FILE_RELATIVE_PATH;
            }
        } catch (java.lang.NoClassDefFoundError e) {
            //Do absolutely nothing, that means the class loader does not have this module loaded.
View Full Code Here


        System.out.println("creating response message: " + response.getErrorMessage());

        // Enable Destination Statistics using JMX
        System.out.println("Enable Destination Statistics..");
        Resource asResource = AppServerUtils.getASResource();
        ApplicationServerComponent asResourceComponenet = (ApplicationServerComponent) PluginContainer.getInstance()
            .getInventoryManager().getResourceComponent(asResource);

        EmsConnection emsConnection = asResourceComponenet.getEmsConnection();
        if (emsConnection == null) {
            throw new RuntimeException("Can not connect to the server");
        }
        EmsBean bean = emsConnection.getBean("jboss.messaging:service=ServerPeer");
View Full Code Here

    public void testDiscoverDeployedPackages() 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.
        ResourceContext<ApplicationServerComponent<?>> mockResourceContext = mock(ResourceContext.class);

        ApplicationServerComponent mockApplicationServerComponent = mock(ApplicationServerComponent.class);
        when(mockResourceContext.getParentResourceComponent()).thenReturn(mockApplicationServerComponent);
        when(mockApplicationServerComponent.getResourceContext()).thenReturn(mockResourceContext);
        Configuration mockConfiguration = mock(Configuration.class);
        when(mockResourceContext.getPluginConfiguration()).thenReturn(mockConfiguration);
        when(mockConfiguration.getSimpleValue(eq("homeDir"), isNull(String.class))).thenReturn("testHomeDir");

        File mockDirectory = mock(File.class);
View Full Code Here

            if (!downloadedFile.exists()) {
                throw new FileNotFoundException("File to download [" + destinationFileLocation + "] does not exist");
            }

            if (downloadedFile.length() == 0) {
                throw new EmptyFileException("Downloaded file [" + destinationFileLocation + "] is empty");
            }
        } finally {
            // Close the stream if there was an error thrown from downloadPackageBits
            try {
                bufferedOutput.close();
View Full Code Here

    public Set<DiscoveredResourceDetails> discoverResources(
      ResourceDiscoveryContext<ProfileServiceComponent<?>> context)
      throws InvalidPluginConfigurationException, Exception {

    ProfileServiceComponent parentComponent = context
        .getParentResourceComponent();

    Configuration defaultPluginConfig = context.getDefaultPluginConfiguration();

    EmsConnection connection = parentComponent.getEmsConnection();

    Set<DiscoveredResourceDetails> resources = new HashSet<DiscoveredResourceDetails>();

    Pattern pattern = Pattern.compile(REGEX);
View Full Code Here

  @Parameters( { "principal", "credentials", "testJarPath", "xmlFilePath" })
  public void start(@Optional String principal, @Optional String credentials,
      @Optional String testJarPath, String xmlFilePath) {
    try {
      TestHelper.startContainer(principal, credentials);
      ProfileServiceComponent serverComp = (ProfileServiceComponent) AppServerUtils
          .getASComponentProxy(ProfileServiceComponent.class);
      connection = serverComp.getEmsConnection();
      remoteClientTest = new RemoteClientTest();
      remoteClientTest.deployXmlExample(xmlFilePath);
      remoteClientTest.deployCacheExample(testJarPath);
      remoteClientTest.runTest();
View Full Code Here

            .thenReturn(mockFileContentDelegate);
        when(mockFileContentDelegate.saveDeploymentSHA(any(File.class), any(File.class), any(File.class))).thenReturn(
            "abcd1234");

        //create object to test and inject required dependencies
        StandaloneManagedDeploymentComponent objectUnderTest = new StandaloneManagedDeploymentComponent();

        Field[] fields = AbstractManagedDeploymentComponent.class.getDeclaredFields();

        for (Field field : fields) {
            if (field.getName().equals("deploymentFile")) {
                field.setAccessible(true);
                field.set(objectUnderTest, mockFile);
            }
        }

        //run code under test
        Set<ResourcePackageDetails> result = objectUnderTest.discoverDeployedPackages(mockPackageType);

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

        ResourcePackageDetails resultPackageDetails = (ResourcePackageDetails) result.toArray()[0];
View Full Code Here

        PowerMockito.whenNew(FileOutputStream.class).withParameterTypes(File.class).withArguments(any(File.class))
            .thenReturn(mockFileOutputStream);

        //create object to test and inject required dependencies
        StandaloneManagedDeploymentComponent objectUnderTest = spy(new StandaloneManagedDeploymentComponent());
        when(objectUnderTest.getResourceContext()).thenReturn(mockResourceContext);

        Field[] fields = AbstractManagedDeploymentComponent.class.getDeclaredFields();
        for (Field field : fields) {
            if (field.getName().equals("deploymentFile")) {
                field.setAccessible(true);
View Full Code Here

        MeasurementScheduleRequest request, ResourceType resourceType, String deploymentName) {
        String metricName = metricProperty.getName();
        MetaType type = metricProperty.getMetaType();
        MetaValue value = metricProperty.getValue();
        if (value != null) {
            MeasurementAdapter measurementAdapter = MeasurementAdapterFactory.getMeasurementPropertyAdapter(type);
            MeasurementDefinition measurementDefinition = ResourceTypeUtils.getMeasurementDefinition(resourceType,
                metricName);
            if (measurementDefinition != null) {
                measurementAdapter.setMeasurementData(report, value, request, measurementDefinition);
            }
        } else {
            LOG.debug("Unable to obtain metric data for resource: " + deploymentName + " metric: " + metricName);
        }
    }
View Full Code Here

                    if (value != null) {
                        MeasurementDefinition measurementDefinition = ResourceTypeUtils.getMeasurementDefinition(
                            context.getResourceType(), metricName);

                        if (type.isSimple()) {
                            MeasurementAdapter measurementAdapter = new SimpleMetaValueMeasurementAdapter();
                            if (measurementDefinition != null & measurementAdapter != null)
                                measurementAdapter.setMeasurementData(report, value, request, measurementDefinition);
                        }
                        if (type.isComposite()) {

                            ManagedObject obj = prop.getManagedObject();
                            Object attachment = obj.getAttachment();
View Full Code Here

TOP

Related Classes of org.rhq.plugins.jbossas5.helper.JBossProperties

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.