test_class.declarator: vmHandler
test_class.original_string: VirtualMachineHandler vmHandler;
test_class.type: VirtualMachineHandler
test_class.var_name: vmHandler
test_class.file: agent/jvm/src/test/java/org/jolokia/jvmagent/client/util/VirtualMachineHandlerTest.java
test_class.identifier: VirtualMachineHandlerTest
test_case.body: @Test
      public void findProcess() throws Exception, NoSuchMethodException, IllegalAccessException {
          List<ProcessDescription> procs = filterOwnProcess(vmHandler.listProcesses());
          for (ProcessDescription desc : procs) {
              try {
                  if (desc.getDisplay() != null && desc.getDisplay().length() > 0) {
                      Pattern singleHitPattern = Pattern.compile("^" + Pattern.quote(desc.getDisplay()) + "$");
                      assertTrue(tryAttach(singleHitPattern.pattern()));
                      break;
                  }
              } catch (Exception exp) {
                  // We ignore error which happen spuriously
                  System.out.println("Cannot attach to " + desc.getDisplay() + " (" + desc.getId() + "): " + exp);
                  exp.printStackTrace();
              }
          }
  
          assertFalse(tryAttach("RobertMakClaudioPizarro",".*No.*process.*"));
          if (procs.size() >= 2) {
              assertFalse(tryAttach(".",procs.get(0).getId()));
          }
      }
test_case.class_method_signature: VirtualMachineHandlerTest.findProcess()
test_case.full_signature: @Test public void findProcess()
test_case.identifier: findProcess
test_case.invocations: filterOwnProcess listProcesses getDisplay length getDisplay compile quote getDisplay assertTrue tryAttach pattern println getDisplay getId printStackTrace assertFalse tryAttach size assertFalse tryAttach getId get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void findProcess()
focal_class.declarator: options
focal_class.modifier: private
focal_class.original_string: private OptionsAndArgs options;
focal_class.type: OptionsAndArgs
focal_class.var_name: options
focal_class.file: agent/jvm/src/main/java/org/jolokia/jvmagent/client/util/VirtualMachineHandler.java
focal_class.identifier: VirtualMachineHandler
focal_class.class_method_signature: VirtualMachineHandler.VirtualMachineHandler(OptionsAndArgs pOptions)
focal_class.full_signature: public  VirtualMachineHandler(OptionsAndArgs pOptions)
focal_class.identifier: VirtualMachineHandler
focal_class.modifiers: public
focal_class.parameters: (OptionsAndArgs pOptions)
focal_class.signature:  VirtualMachineHandler(OptionsAndArgs pOptions)
focal_class.class_method_signature: VirtualMachineHandler.attachVirtualMachine()
focal_class.full_signature: public Object attachVirtualMachine()
focal_class.identifier: attachVirtualMachine
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Object
focal_class.signature: Object attachVirtualMachine()
focal_class.class_method_signature: VirtualMachineHandler.getPidErrorMesssage(String pid, String label, Class vmClass)
focal_class.full_signature: private String getPidErrorMesssage(String pid, String label, Class vmClass)
focal_class.identifier: getPidErrorMesssage
focal_class.modifiers: private
focal_class.parameters: (String pid, String label, Class vmClass)
focal_class.return: String
focal_class.signature: String getPidErrorMesssage(String pid, String label, Class vmClass)
focal_class.class_method_signature: VirtualMachineHandler.detachAgent(Object pVm)
focal_class.full_signature: public void detachAgent(Object pVm)
focal_class.identifier: detachAgent
focal_class.modifiers: public
focal_class.parameters: (Object pVm)
focal_class.return: void
focal_class.signature: void detachAgent(Object pVm)
focal_class.class_method_signature: VirtualMachineHandler.listProcesses()
focal_class.full_signature: public List<ProcessDescription> listProcesses()
focal_class.identifier: listProcesses
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: List<ProcessDescription>
focal_class.signature: List<ProcessDescription> listProcesses()
focal_class.class_method_signature: VirtualMachineHandler.findProcess(Pattern pPattern)
focal_class.full_signature: public ProcessDescription findProcess(Pattern pPattern)
focal_class.identifier: findProcess
focal_class.modifiers: public
focal_class.parameters: (Pattern pPattern)
focal_class.return: ProcessDescription
focal_class.signature: ProcessDescription findProcess(Pattern pPattern)
focal_class.class_method_signature: VirtualMachineHandler.getProcessId(OptionsAndArgs pOpts)
focal_class.full_signature: private String getProcessId(OptionsAndArgs pOpts)
focal_class.identifier: getProcessId
focal_class.modifiers: private
focal_class.parameters: (OptionsAndArgs pOpts)
focal_class.return: String
focal_class.signature: String getProcessId(OptionsAndArgs pOpts)
focal_class.class_method_signature: VirtualMachineHandler.getOwnProcessId()
focal_class.full_signature: private String getOwnProcessId()
focal_class.identifier: getOwnProcessId
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getOwnProcessId()
focal_class.class_method_signature: VirtualMachineHandler.lookupVirtualMachineClass()
focal_class.full_signature: private Class lookupVirtualMachineClass()
focal_class.identifier: lookupVirtualMachineClass
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: Class
focal_class.signature: Class lookupVirtualMachineClass()
focal_method.body: public ProcessDescription findProcess(Pattern pPattern)
              throws InvocationTargetException, NoSuchMethodException, IllegalAccessException {
          List<ProcessDescription> ret = new ArrayList<ProcessDescription>();
          String ownId = getOwnProcessId();
  
          for (ProcessDescription desc : listProcesses()) {
              Matcher matcher = pPattern.matcher(desc.getDisplay());
              if (!desc.getId().equals(ownId) && matcher.find()) {
                  ret.add(desc);
              }
          }
          if (ret.size() == 1) {
              return ret.get(0);
          } else if (ret.size() == 0) {
              throw new IllegalArgumentException("No attachable process found matching \"" + pPattern.pattern() + "\"");
          } else {
              StringBuilder buf = new StringBuilder();
              for (ProcessDescription desc : ret) {
                  buf.append(desc.getId()).append(" (").append(desc.getDisplay()).append("),");
              }
              throw new IllegalArgumentException("More than one attachable process found matching \"" +
                                                 pPattern.pattern() + "\": " + buf.substring(0,buf.length()-1));
          }
      }
focal_method.class_method_signature: VirtualMachineHandler.findProcess(Pattern pPattern)
focal_method.full_signature: public ProcessDescription findProcess(Pattern pPattern)
focal_method.identifier: findProcess
focal_method.invocations: getOwnProcessId listProcesses matcher getDisplay equals getId find add size get size pattern append append append append getId getDisplay pattern substring length
focal_method.modifiers: public
focal_method.parameters: (Pattern pPattern)
focal_method.return: ProcessDescription
focal_method.signature: ProcessDescription findProcess(Pattern pPattern)