/* * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions.
*/
publicstaticvoid assertNotAbleToWriteToFile(OutputAnalyzer output) {
output.shouldContain("Could not start recording, not able to write to file");
}
publicstaticvoid assertFileNotFoundException(OutputAnalyzer output, String name) {
output.shouldMatch("Could not write recording \"" + name + "\" to file.*");
}
// public static void assertNotAbleToSetFilename(OutputAnalyzer output) { // output.shouldContain( // "Filename can only be set for a recording with a duration, " + // "or if dumponexit=true"); // }
publicstaticvoid assertNotAbleToFindSettingsFile(OutputAnalyzer output) {
output.shouldContain("Could not find file");
}
publicstaticvoid assertNoRecordingsAvailable(OutputAnalyzer output) {
output.shouldContain("No available recordings");
}
publicstaticvoid assertCouldNotStartDefaultRecordingWithName(OutputAnalyzer output) {
output.shouldContain( "It's not possible to set custom name for the defaultrecording");
}
publicstaticvoid assertCouldNotStartDefaultRecording(OutputAnalyzer output) {
output.shouldContain( "The only option that can be combined with defaultrecording is settings");
}
privatestatic Recording findRecording(String name) { for(Recording r : FlightRecorder.getFlightRecorder().getRecordings()) { if (r.getName().equals(name)) { return r;
}
} thrownew AssertionError("Could not find recording named " + name);
}
publicstaticvoid assertMaxAgeEqualsMBeanValue(String name, long maxAge) throws Exception {
Recording recording = findRecording(name);
Asserts.assertNotNull(recording, "No recording found");
Asserts.assertEquals(maxAge, recording.getMaxAge().toMillis());
}
publicstaticvoid assertDurationEqualsMBeanValue(String name, long duration) throws Exception {
Recording recording = findRecording(name);
Asserts.assertNotNull(recording, "No recording found");
Asserts.assertEquals(duration, recording.getDuration().toMillis());
}
publicstaticvoid assertDurationAtLeast1s(OutputAnalyzer output) {
output.shouldContain("Could not start recording, duration must be at least 1 second.");
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.