test_class.declarator: SERVER_MBEAN = "WebSphere:cell=bhutNode02Cell,j2eeType=J2EEServer," +
                                           "mbeanIdentifier=cells/bhutNode02Cell/nodes/bhutNode02/servers/server1/server.xml#Server_1245012281417," +
                                           "name=server1,node=bhutNode02,platform=proxy,process=server1,processType=UnManagedProcess," +
                                           "spec=1.0,type=Server,version=6.1.0.33"
test_class.modifier: private static
test_class.original_string: private static String SERVER_MBEAN = "WebSphere:cell=bhutNode02Cell,j2eeType=J2EEServer," +
                                           "mbeanIdentifier=cells/bhutNode02Cell/nodes/bhutNode02/servers/server1/server.xml#Server_1245012281417," +
                                           "name=server1,node=bhutNode02,platform=proxy,process=server1,processType=UnManagedProcess," +
                                           "spec=1.0,type=Server,version=6.1.0.33";
test_class.type: String
test_class.var_name: SERVER_MBEAN
test_class.declarator: SERVER_VERSION_V6 =
              "--------------------------------------------------------------------------------\n" +
              "IBM WebSphere Application Server Product Installation Status Report\n" +
              "--------------------------------------------------------------------------------\n" +
              "\n" +
              "Report at date and time November 29, 2010 11:46:41 AM CET\n" +
              "\n" +
              "Installation\n" +
              "--------------------------------------------------------------------------------\n" +
              "Product Directory        /opt/websphere/was61\n" +
              "Version Directory        /opt/websphere/was61/properties/version\n" +
              "DTD Directory            /opt/websphere/was61/properties/version/dtd\n" +
              "Log Directory            /opt/websphere/was61/logs\n" +
              "Backup Directory         /opt/websphere/was61/properties/version/nif/backup\n" +
              "TMP Directory            /tmp\n" +
              "\n" +
              "Product List\n" +
              "--------------------------------------------------------------------------------\n" +
              "ND                       installed\n" +
              "\n" +
              "Installed Product\n" +
              "--------------------------------------------------------------------------------\n" +
              "Name                     IBM WebSphere Application Server - ND\n" +
              "Version                  6.1.0.33\n" +
              "ID                       ND\n" +
              "Build Level              cf331032.09\n" +
              "Build Date               8/14/10\n" +
              "\n" +
              "--------------------------------------------------------------------------------\n" +
              "End Installation Status Report\n" +
              "--------------------------------------------------------------------------------"
test_class.modifier: private static
test_class.original_string: private static String SERVER_VERSION_V6 =
              "--------------------------------------------------------------------------------\n" +
              "IBM WebSphere Application Server Product Installation Status Report\n" +
              "--------------------------------------------------------------------------------\n" +
              "\n" +
              "Report at date and time November 29, 2010 11:46:41 AM CET\n" +
              "\n" +
              "Installation\n" +
              "--------------------------------------------------------------------------------\n" +
              "Product Directory        /opt/websphere/was61\n" +
              "Version Directory        /opt/websphere/was61/properties/version\n" +
              "DTD Directory            /opt/websphere/was61/properties/version/dtd\n" +
              "Log Directory            /opt/websphere/was61/logs\n" +
              "Backup Directory         /opt/websphere/was61/properties/version/nif/backup\n" +
              "TMP Directory            /tmp\n" +
              "\n" +
              "Product List\n" +
              "--------------------------------------------------------------------------------\n" +
              "ND                       installed\n" +
              "\n" +
              "Installed Product\n" +
              "--------------------------------------------------------------------------------\n" +
              "Name                     IBM WebSphere Application Server - ND\n" +
              "Version                  6.1.0.33\n" +
              "ID                       ND\n" +
              "Build Level              cf331032.09\n" +
              "Build Date               8/14/10\n" +
              "\n" +
              "--------------------------------------------------------------------------------\n" +
              "End Installation Status Report\n" +
              "--------------------------------------------------------------------------------";
test_class.type: String
test_class.var_name: SERVER_VERSION_V6
test_class.file: agent/core/src/test/java/org/jolokia/detector/WebSphereDetectorTest.java
test_class.identifier: WebSphereDetectorTest
test_class.superclass: extends BaseDetectorTest
test_case.body: @Test
      public void detect() throws MalformedObjectNameException, InstanceNotFoundException, ReflectionException, AttributeNotFoundException, MBeanException {
          ServerDetector detector = new WebsphereDetector();
          ObjectName serverMbean = new ObjectName(SERVER_MBEAN);
          MBeanServer mockServer = createMock(MBeanServer.class);
          expect(mockServer.queryNames(new ObjectName("*:j2eeType=J2EEServer,type=Server,*"),null)).
                  andStubReturn(new HashSet<ObjectName>(Arrays.asList(serverMbean)));
          expect(mockServer.isRegistered(serverMbean)).andStubReturn(true);
          expect(mockServer.getAttribute(serverMbean,"platformName")).andReturn("IBM WebSphere Application Server");
          expect(mockServer.getAttribute(serverMbean,"serverVersion")).andReturn(SERVER_VERSION_V6);
          replay(mockServer);
  
          ServerHandle info = detector.detect(getMBeanServerManager(mockServer));
          assertEquals(info.getVendor(),"IBM");
          assertEquals(info.getProduct(),"websphere");
          assertNotNull(info.getExtraInfo(null));
          assertEquals(info.getExtraInfo(null).get("buildDate"),"8/14/10");
      }
test_case.class_method_signature: WebSphereDetectorTest.detect()
test_case.full_signature: @Test public void detect()
test_case.identifier: detect
test_case.invocations: createMock andStubReturn expect queryNames asList andStubReturn expect isRegistered andReturn expect getAttribute andReturn expect getAttribute replay detect getMBeanServerManager assertEquals getVendor assertEquals getProduct assertNotNull getExtraInfo assertEquals get getExtraInfo
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void detect()
focal_class.declarator: SERVER_VERSION_PATTERN =
              Pattern.compile("^Version\\s+([0-9.]+)\\s*$.*?^Build Date\\s+([0-9/]+)\\s*$",
                              Pattern.MULTILINE | Pattern.DOTALL | Pattern.CASE_INSENSITIVE)
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern SERVER_VERSION_PATTERN =
              Pattern.compile("^Version\\s+([0-9.]+)\\s*$.*?^Build Date\\s+([0-9/]+)\\s*$",
                              Pattern.MULTILINE | Pattern.DOTALL | Pattern.CASE_INSENSITIVE);
focal_class.type: Pattern
focal_class.var_name: SERVER_VERSION_PATTERN
focal_class.declarator: INTERNAL_ERROR_MSG = "Internal: Found AdminServiceFactory but can not call methods on it (wrong WAS version ?)"
focal_class.modifier: public static final
focal_class.original_string: public static final  String  INTERNAL_ERROR_MSG = "Internal: Found AdminServiceFactory but can not call methods on it (wrong WAS version ?)";
focal_class.type: String
focal_class.var_name: INTERNAL_ERROR_MSG
focal_class.declarator: isWebsphere = ClassUtil.checkForClass("com.ibm.websphere.management.AdminServiceFactory")
focal_class.modifier: private
focal_class.original_string: private boolean isWebsphere = ClassUtil.checkForClass("com.ibm.websphere.management.AdminServiceFactory");
focal_class.type: boolean
focal_class.var_name: isWebsphere
focal_class.declarator: isWebsphere7 = ClassUtil.checkForClass("com.ibm.websphere.management.AdminContext")
focal_class.modifier: private
focal_class.original_string: private boolean isWebsphere7 = ClassUtil.checkForClass("com.ibm.websphere.management.AdminContext");
focal_class.type: boolean
focal_class.var_name: isWebsphere7
focal_class.declarator: isWebsphere6 = isWebsphere && !isWebsphere7
focal_class.modifier: private
focal_class.original_string: private boolean isWebsphere6 = isWebsphere && !isWebsphere7;
focal_class.type: boolean
focal_class.var_name: isWebsphere6
focal_class.file: agent/core/src/main/java/org/jolokia/detector/WebsphereDetector.java
focal_class.identifier: WebsphereDetector
focal_class.class_method_signature: WebsphereDetector.detect(MBeanServerExecutor pMBeanServerExecutor)
focal_class.full_signature: public ServerHandle detect(MBeanServerExecutor pMBeanServerExecutor)
focal_class.identifier: detect
focal_class.modifiers: public
focal_class.parameters: (MBeanServerExecutor pMBeanServerExecutor)
focal_class.return: ServerHandle
focal_class.signature: ServerHandle detect(MBeanServerExecutor pMBeanServerExecutor)
focal_class.class_method_signature: WebsphereDetector.addMBeanServers(Set<MBeanServerConnection> servers)
focal_class.full_signature: @Override public void addMBeanServers(Set<MBeanServerConnection> servers)
focal_class.identifier: addMBeanServers
focal_class.modifiers: @Override public
focal_class.parameters: (Set<MBeanServerConnection> servers)
focal_class.return: void
focal_class.signature: void addMBeanServers(Set<MBeanServerConnection> servers)
focal_class.superclass: extends AbstractServerDetector
focal_method.body: public ServerHandle detect(MBeanServerExecutor pMBeanServerExecutor) {
          String serverVersion =
                  getSingleStringAttribute(pMBeanServerExecutor, "*:j2eeType=J2EEServer,type=Server,*", "serverVersion");
          if (serverVersion != null && serverVersion.contains("WebSphere")) {
              Matcher matcher = SERVER_VERSION_PATTERN.matcher(serverVersion);
              if (matcher.find()) {
                  String version = matcher.group(1);
                  String date = matcher.group(2);
                  JSONObject extraInfo = new JSONObject();
                  if (date != null) {
                      extraInfo.put("buildDate",date);
                  }
                  return new WebsphereServerHandle(version, extraInfo.size() > 0 ? extraInfo : null);
              }
              return null;
          } else if (isWebsphere) {
              return new WebsphereServerHandle(isWebsphere6 ? "6" : "7 or 8", null);
          }
          return null;
      }
focal_method.class_method_signature: WebsphereDetector.detect(MBeanServerExecutor pMBeanServerExecutor)
focal_method.full_signature: public ServerHandle detect(MBeanServerExecutor pMBeanServerExecutor)
focal_method.identifier: detect
focal_method.invocations: getSingleStringAttribute contains matcher find group group put size
focal_method.modifiers: public
focal_method.parameters: (MBeanServerExecutor pMBeanServerExecutor)
focal_method.return: ServerHandle
focal_method.signature: ServerHandle detect(MBeanServerExecutor pMBeanServerExecutor)