예제 #1
0
 private void printDebugAttributeGroup(AttributeGroup group) {
   for (CollectionAttribute collectionAttribute : group.getAttributes()) {
     logger.debug("Attribute Type   '{}'", collectionAttribute.getAttributeType());
     logger.debug("Attribute Name   '{}'", collectionAttribute.getName());
     logger.debug("Attrubute Number '{}'", collectionAttribute.getNumericValue());
     logger.debug("Attrubute Value  '{}'", collectionAttribute.getStringValue());
   }
 }
  /** {@inheritDoc} */
  public void visit(CollectionSetVisitor visitor) {
    log()
        .debug(
            "XmpCollectionResource: visit starting with "
                + getGroups().size()
                + " attribute groups");

    visitor.visitResource(this);

    // visit the attribute groups one at a time
    for (AttributeGroup ag : getGroups()) {
      ag.visit(visitor);
    }

    visitor.completeResource(this);

    log().debug("XmpCollectionResource: visit finished for " + agent);
  } /* visit */
예제 #3
0
  @Test
  public void collectSingleMbeanWithOneCompAttribWithOneIgnoredCompMembers() {
    String collectionName = "collectSingleMbeanWithOneCompAttribWithOneIgnoredCompMembers";
    jmxNodeInfo.setMBeans(jmxConfigFactory.getMBeanInfo(collectionName));
    jmxNodeInfo.setDsMap(
        generateDataSourceMap(jmxConfigFactory.getAttributeMap(collectionName, "", "")));

    // start collection
    CollectionSet collectionSet = jmxCollector.collect(collectionAgent, null, null);
    JMXCollectionSet jmxCollectionSet = (JMXCollectionSet) collectionSet;
    JMXCollectionResource jmxCollectionResource = jmxCollectionSet.getResource();
    AttributeGroup group =
        jmxCollectionResource.getGroup(new AttributeGroupType("java_lang_type_Memory", "all"));
    assertEquals(3, group.getAttributes().size());
    printDebugAttributeGroup(group);

    assertEquals(
        "Collection: " + collectionName + " run successfully", 1, collectionSet.getStatus());
  }
예제 #4
0
  @Test
  public void collectSingleMbeanWithSingleAttribute() {
    String collectionName = "collectSingleMbeanWithSingleAttribute";
    jmxNodeInfo.setMBeans(jmxConfigFactory.getMBeanInfo(collectionName));
    jmxNodeInfo.setDsMap(
        generateDataSourceMap(jmxConfigFactory.getAttributeMap(collectionName, "", "")));

    // start collection
    CollectionSet collectionSet = jmxCollector.collect(collectionAgent, null, null);
    JMXCollectionSet jmxCollectionSet = (JMXCollectionSet) collectionSet;
    JMXCollectionResource jmxCollectionResource = jmxCollectionSet.getResource();
    AttributeGroup group =
        jmxCollectionResource.getGroup(new AttributeGroupType("java_lang_type_Compilation", "all"));
    assertEquals(1, group.getAttributes().size());
    printDebugAttributeGroup(group);

    // ToDo Tak how to check if all metrics where collected?
    assertEquals(
        "Collection: " + collectionName + " run successfully", 1, collectionSet.getStatus());
  }