62 testDumpAll();
63 }
64
65 private static void testHisto() throws Exception {
66 OutputAnalyzer output = jmap("-histo:");
67 output.shouldHaveExitValue(0);
68 OutputAnalyzer output1 = jmap("-histo");
69 output1.shouldHaveExitValue(0);
70 }
71
72 private static void testHistoLive() throws Exception {
73 OutputAnalyzer output = jmap("-histo:live");
74 output.shouldHaveExitValue(0);
75 }
76
77 private static void testHistoAll() throws Exception {
78 OutputAnalyzer output = jmap("-histo:all");
79 output.shouldHaveExitValue(0);
80 }
81
82 private static void testHistoToFile() throws Exception {
83 histoToFile(false);
84 }
85
86 private static void testHistoLiveToFile() throws Exception {
87 histoToFile(true);
88 }
89
90 private static void testHistoAllToFile() throws Exception {
91 boolean explicitAll = true;
92 histoToFile(false, explicitAll);
93 }
94
95 private static void histoToFile(boolean live) throws Exception {
96 boolean explicitAll = false;
97 histoToFile(live, explicitAll);
98 }
99
100 private static void histoToFile(boolean live, boolean explicitAll) throws Exception {
101 if (live == true && explicitAll == true) {
102 fail("Illegal argument setting for jmap -histo");
103 }
104 File file = new File("jmap.histo.file" + System.currentTimeMillis() + ".histo");
105 if (file.exists()) {
106 file.delete();
107 }
108 OutputAnalyzer output;
109 if (live) {
110 output = jmap("-histo:live,file=" + file.getName());
111 } else if (explicitAll == true) {
112 output = jmap("-histo:all,file=" + file.getName());
113 } else {
114 output = jmap("-histo:file=" + file.getName());
115 }
116 output.shouldHaveExitValue(0);
117 output.shouldContain("Heap inspection file created");
118 file.delete();
119 }
120
121 private static void testFinalizerInfo() throws Exception {
122 OutputAnalyzer output = jmap("-finalizerinfo");
123 output.shouldHaveExitValue(0);
124 }
125
126 private static void testClstats() throws Exception {
127 OutputAnalyzer output = jmap("-clstats");
128 output.shouldHaveExitValue(0);
129 }
130
131 private static void testDump() throws Exception {
132 dump(false);
133 }
134
|
62 testDumpAll();
63 }
64
65 private static void testHisto() throws Exception {
66 OutputAnalyzer output = jmap("-histo:");
67 output.shouldHaveExitValue(0);
68 OutputAnalyzer output1 = jmap("-histo");
69 output1.shouldHaveExitValue(0);
70 }
71
72 private static void testHistoLive() throws Exception {
73 OutputAnalyzer output = jmap("-histo:live");
74 output.shouldHaveExitValue(0);
75 }
76
77 private static void testHistoAll() throws Exception {
78 OutputAnalyzer output = jmap("-histo:all");
79 output.shouldHaveExitValue(0);
80 }
81
82 private static void testHistoParallelZero() throws Exception {
83 OutputAnalyzer output = jmap("-histo:parallel=0");
84 output.shouldHaveExitValue(0);
85 }
86
87 private static void testHistoParallel() throws Exception {
88 OutputAnalyzer output = jmap("-histo:parallel=2");
89 output.shouldHaveExitValue(0);
90 }
91
92 private static void testHistoNonParallel() throws Exception {
93 OutputAnalyzer output = jmap("-histo:parallel=1");
94 output.shouldHaveExitValue(0);
95 }
96
97 private static void testHistoToFile() throws Exception {
98 histoToFile(false);
99 }
100
101 private static void testHistoLiveToFile() throws Exception {
102 histoToFile(true);
103 }
104
105 private static void testHistoAllToFile() throws Exception {
106 boolean explicitAll = true;
107 histoToFile(false, explicitAll);
108 }
109
110 private static void testHistoFileParallelZero() throws Exception {
111 histoToFile(false, false, 0);
112 }
113
114 private static void testHistoFileParallel() throws Exception {
115 histoToFile(false, false, 2);
116 }
117
118 private static void testHistoFileNonParallel() throws Exception {
119 histoToFile(false, false, 1);
120 }
121
122 private static void histoToFile(boolean live) throws Exception {
123 boolean explicitAll = false;
124 histoToFile(live, explicitAll);
125 }
126
127 private static void histoToFile(boolean live, boolean explicitAll) throws Exception {
128 if (live == true && explicitAll == true) {
129 fail("Illegal argument setting for jmap -histo");
130 }
131 File file = new File("jmap.histo.file" + System.currentTimeMillis() + ".histo");
132 if (file.exists()) {
133 file.delete();
134 }
135 OutputAnalyzer output;
136 if (live) {
137 output = jmap("-histo:live,file=" + file.getName());
138 } else if (explicitAll == true) {
139 output = jmap("-histo:all,file=" + file.getName());
140 } else {
141 output = jmap("-histo:file=" + file.getName());
142 }
143 output.shouldHaveExitValue(0);
144 output.shouldContain("Heap inspection file created");
145 file.delete();
146 }
147
148 private static void histoToFile(boolean live,
149 boolean explicitAll,
150 int parallelThreadNum) throws Exception {
151 String liveArg = "";
152 String fileArg = "";
153 String parArg = "parallel=" + parallelThreadNum;
154 String allArgs = "-histo:";
155
156 if (live == true && explicitAll == true) {
157 fail("Illegal argument setting for jmap -histo");
158 }
159 if (live == true ) {
160 liveArg = "live,";
161 } else if(explicitAll) {
162 liveArg = "all,";
163 }
164
165 File file = new File("jmap.histo.file" + System.currentTimeMillis() + ".histo");
166 if (file.exists()) {
167 file.delete();
168 }
169 fileArg = "file=" + file.getName();
170
171 OutputAnalyzer output;
172 allArgs = allArgs + liveArg + fileArg + "," + parArg + "";
173 if (live) {
174 output = jmap(allArgs);
175 } else if (explicitAll == true) {
176 output = jmap(allArgs);
177 } else {
178 output = jmap(allArgs);
179 }
180 output.shouldHaveExitValue(0);
181 output.shouldContain("Heap inspection file created");
182 file.delete();
183 }
184
185 private static void testFinalizerInfo() throws Exception {
186 OutputAnalyzer output = jmap("-finalizerinfo");
187 output.shouldHaveExitValue(0);
188 }
189
190 private static void testClstats() throws Exception {
191 OutputAnalyzer output = jmap("-clstats");
192 output.shouldHaveExitValue(0);
193 }
194
195 private static void testDump() throws Exception {
196 dump(false);
197 }
198
|