< prev index next >

test/jdk/sun/tools/jmap/BasicJMapTest.java

Print this page




  62     }
  63 
  64     private static void testHisto() throws Exception {
  65         OutputAnalyzer output = jmap("-histo:");
  66         output.shouldHaveExitValue(0);
  67         OutputAnalyzer output1 = jmap("-histo");
  68         output1.shouldHaveExitValue(0);
  69     }
  70 
  71     private static void testHistoLive() throws Exception {
  72         OutputAnalyzer output = jmap("-histo:live");
  73         output.shouldHaveExitValue(0);
  74     }
  75 
  76     private static void testHistoAll() throws Exception {
  77         OutputAnalyzer output = jmap("-histo:all");
  78         output.shouldHaveExitValue(0);
  79     }
  80 
  81     private static void testHistoParallelZero() throws Exception {
  82         OutputAnalyzer output = jmap("-histo:parallelThreadNum=0");
  83         output.shouldHaveExitValue(0);
  84     }
  85 
  86     private static void testHistoParallel() throws Exception {
  87         OutputAnalyzer output = jmap("-histo:parallelThreadNum=2");
  88         output.shouldHaveExitValue(0);
  89     }
  90 
  91     private static void testHistoNonParallel() throws Exception {
  92         OutputAnalyzer output = jmap("-histo:parallelThreadNum=1");
  93         output.shouldHaveExitValue(0);
  94     }
  95 
  96     private static void testHistoToFile() throws Exception {
  97         histoToFile(false);
  98     }
  99 
 100     private static void testHistoLiveToFile() throws Exception {
 101         histoToFile(true);
 102     }
 103 
 104     private static void testHistoAllToFile() throws Exception {
 105         boolean explicitAll = true;
 106         histoToFile(false, explicitAll);
 107     }
 108 
 109     private static void testHistoFileParallelZero() throws Exception {
 110         histoToFile(false, false, 0);
 111     }
 112 


 132             file.delete();
 133         }
 134         OutputAnalyzer output;
 135         if (live) {
 136             output = jmap("-histo:live,file=" + file.getName());
 137         } else if (explicitAll == true) {
 138             output = jmap("-histo:all,file=" + file.getName());
 139         } else {
 140             output = jmap("-histo:file=" + file.getName());
 141         }
 142         output.shouldHaveExitValue(0);
 143         output.shouldContain("Heap inspection file created");
 144         file.delete();
 145     }
 146 
 147     private static void histoToFile(boolean live,
 148                                     boolean explicitAll,
 149                                     int parallelThreadNum) throws Exception {
 150         String liveArg = "";
 151         String fileArg = "";
 152         String parArg = "parallelThreadNum=" + parallelThreadNum;
 153         String allArgs = "-histo:";
 154 
 155         if (live == true && explicitAll == true) {
 156             fail("Illegal argument setting for jmap -histo");
 157         }
 158         if (live == true ) {
 159             liveArg = "live,";
 160         } else if(explicitAll) {
 161             liveArg = "all,";
 162         }
 163 
 164         File file = new File("jmap.histo.file" + System.currentTimeMillis() + ".histo");
 165         if (file.exists()) {
 166             file.delete();
 167         }
 168         fileArg = "file=" + file.getName();
 169 
 170         OutputAnalyzer output;
 171         allArgs = allArgs + liveArg + fileArg + "," + parArg + "";
 172         if (live) {




  62     }
  63 
  64     private static void testHisto() throws Exception {
  65         OutputAnalyzer output = jmap("-histo:");
  66         output.shouldHaveExitValue(0);
  67         OutputAnalyzer output1 = jmap("-histo");
  68         output1.shouldHaveExitValue(0);
  69     }
  70 
  71     private static void testHistoLive() throws Exception {
  72         OutputAnalyzer output = jmap("-histo:live");
  73         output.shouldHaveExitValue(0);
  74     }
  75 
  76     private static void testHistoAll() throws Exception {
  77         OutputAnalyzer output = jmap("-histo:all");
  78         output.shouldHaveExitValue(0);
  79     }
  80 
  81     private static void testHistoParallelZero() throws Exception {
  82         OutputAnalyzer output = jmap("-histo:parallel=0");
  83         output.shouldHaveExitValue(0);
  84     }
  85 
  86     private static void testHistoParallel() throws Exception {
  87         OutputAnalyzer output = jmap("-histo:parallel=2");
  88         output.shouldHaveExitValue(0);
  89     }
  90 
  91     private static void testHistoNonParallel() throws Exception {
  92         OutputAnalyzer output = jmap("-histo:parallel=1");
  93         output.shouldHaveExitValue(0);
  94     }
  95 
  96     private static void testHistoToFile() throws Exception {
  97         histoToFile(false);
  98     }
  99 
 100     private static void testHistoLiveToFile() throws Exception {
 101         histoToFile(true);
 102     }
 103 
 104     private static void testHistoAllToFile() throws Exception {
 105         boolean explicitAll = true;
 106         histoToFile(false, explicitAll);
 107     }
 108 
 109     private static void testHistoFileParallelZero() throws Exception {
 110         histoToFile(false, false, 0);
 111     }
 112 


 132             file.delete();
 133         }
 134         OutputAnalyzer output;
 135         if (live) {
 136             output = jmap("-histo:live,file=" + file.getName());
 137         } else if (explicitAll == true) {
 138             output = jmap("-histo:all,file=" + file.getName());
 139         } else {
 140             output = jmap("-histo:file=" + file.getName());
 141         }
 142         output.shouldHaveExitValue(0);
 143         output.shouldContain("Heap inspection file created");
 144         file.delete();
 145     }
 146 
 147     private static void histoToFile(boolean live,
 148                                     boolean explicitAll,
 149                                     int parallelThreadNum) throws Exception {
 150         String liveArg = "";
 151         String fileArg = "";
 152         String parArg = "parallel=" + parallelThreadNum;
 153         String allArgs = "-histo:";
 154 
 155         if (live == true && explicitAll == true) {
 156             fail("Illegal argument setting for jmap -histo");
 157         }
 158         if (live == true ) {
 159             liveArg = "live,";
 160         } else if(explicitAll) {
 161             liveArg = "all,";
 162         }
 163 
 164         File file = new File("jmap.histo.file" + System.currentTimeMillis() + ".histo");
 165         if (file.exists()) {
 166             file.delete();
 167         }
 168         fileArg = "file=" + file.getName();
 169 
 170         OutputAnalyzer output;
 171         allArgs = allArgs + liveArg + fileArg + "," + parArg + "";
 172         if (live) {


< prev index next >