public boolean isOffline(String method) { if (offline) { LOGGER.warn(getBoilerPlate("Working offline cannot run test: " + method, '=', 80)); } return offline; }
private void printTestHeader() { if (verbose) { System.out.println(getBoilerPlate(getTestHeader(), '=', 80)); } }
/** * It delegates to the original {@link ClassLoaderFilter} if it is not exported it will check againts the list of exported * classes. * * @param name class name to check. Non empty. * @return true if the resource is exported, false otherwise */ @Override public boolean exportsClass(final String name) { checkArgument(!isEmpty(name), "Class name cannot be empty"); boolean exported = classLoaderFilter.exportsClass(name); if (!exported) { exported = exportedClasses.get(name) != null; if (exported) { logger.warn(StringMessageUtils .getBoilerPlate(newArrayList("WARNING:", " ", "Class: '" + name + "' is NOT exposed by the plugin but it will be visible " + "due to it was manually forced to be exported for testing purposes.", " ", "Check if this is really necessary, this class won't be visible in standalone mode."), '*', DEFAULT_MESSAGE_WIDTH)); } } return exported; }
private void doCallback(byte[] startData, long startDataSize, byte[] endData, long endDataSize, long endRingPointer, long streamLength, CoreEvent event) throws Exception { // make a nice summary of the data StringBuilder result = new StringBuilder("Received stream"); result.append("; length: "); result.append(streamLength); result.append("; '"); for (long i = 0; i < startDataSize; ++i) { result.append((char) startData[(int) i]); } long endSize = Math.min(endDataSize, STREAM_SAMPLE_SIZE); if (endSize > 0) { result.append("..."); for (long i = 0; i < endSize; ++i) { result.append((char) endData[(int) ((endRingPointer + i) % STREAM_SAMPLE_SIZE)]); } } result.append("'"); summary = result.toString(); String msg = getBoilerPlate("Message Received in service: " + this.getLocation().getRootContainerName() + ". " + summary + "\n callback: " + eventCallback, '*', 80); logger.info(msg); if (eventCallback != null) { eventCallback.eventReceived(event, this, muleContext); } }
messages.addAll(filePathByArtifactId.entrySet().stream().map(entry -> entry.getKey() + " -> (" + (entry.getValue()) + ")") .collect(toList())); logger.debug(getBoilerPlate(newArrayList(messages), '*', 150));
/** * Will shut down the server displaying the cause and time of the shutdown * * @param e the exception that caused the shutdown */ public void shutdown(Throwable e) throws MuleException { I18nMessage msg = fatalErrorWhileRunning(); MuleException muleException = getRootMuleException(e); if (muleException != null) { logger.error(muleException.getDetailedMessage()); } else { logger.error(msg.toString() + " " + e.getMessage(), e); } List<String> msgs = new ArrayList<>(); msgs.add(msg.getMessage()); Throwable root = getRootException(e); msgs.add(root.getMessage() + " (" + root.getClass().getName() + ")"); msgs.add(" "); msgs.add(fatalErrorInShutdown().getMessage()); String shutdownMessage = getBoilerPlate(msgs, '*', 80); logger.error(shutdownMessage); doShutdown(); System.exit(1); }
@Test public void testBoilerPlate() throws Exception { List<String> msgs = new ArrayList<String>(); msgs.add("This"); msgs.add("is a"); msgs.add("Boiler Plate"); String plate = StringMessageUtils.getBoilerPlate(msgs, '*', 12); assertEquals(lineSeparator() + "************" + lineSeparator() + "* This *" + lineSeparator() + "* is a *" + lineSeparator() + "* Boiler *" + lineSeparator() + "* Plate *" + lineSeparator() + "************", plate); }
@Test public void testBoilerPlate2() throws Exception { List<String> msgs = new ArrayList<String>(); msgs.add("This"); msgs.add("is a"); msgs.add("Boiler Plate Message that should get wrapped to the next line if it is working properly"); String plate = StringMessageUtils.getBoilerPlate(msgs, '*', 12); assertEquals(lineSeparator() + "************" + lineSeparator() + "* This *" + lineSeparator() + "* is a *" + lineSeparator() + "* Boiler *" + lineSeparator() + "* Plate *" + lineSeparator() + "* Message *" + lineSeparator() + "* that *" + lineSeparator() + "* should *" + lineSeparator() + "* get *" + lineSeparator() + "* wrapped *" + lineSeparator() + "* to the *" + lineSeparator() + "* next *" + lineSeparator() + "* line if *" + lineSeparator() + "* it is *" + lineSeparator() + "* working *" + lineSeparator() + "* properly *" + lineSeparator() + "************", plate); }
@Test public void testBoilerPlateSingleLine() { String plate = StringMessageUtils.getBoilerPlate("Single message.", '*', 12); assertEquals(lineSeparator() + "************" + lineSeparator() + "* Single *" + lineSeparator() + "* message. *" + lineSeparator() + "************", plate); }
String msg = getBoilerPlate("Message Received in flow: " + getLocation().getRootContainerName() + ". Content is: " + truncate(message.getPayload().getValue().toString(), 100, true), '*', 80);
public static String miniSplash(final String message) { // middle dot char return StringMessageUtils.getBoilerPlate(message, '+', 60); }
public static String getBoilerPlate(String message) { return getBoilerPlate(message, '*', DEFAULT_MESSAGE_WIDTH); }
public boolean isOffline(String method) { if (offline) { LOGGER.warn(getBoilerPlate("Working offline cannot run test: " + method, '=', 80)); } return offline; }
public static String getBoilerPlate(String message, char c, int maxlength) { List<String> messages = Arrays.asList(new String[] {message}); messages = new ArrayList<>(messages); return getBoilerPlate(messages, c, maxlength); }
public String toString() { List<String> boilerPlate = new ArrayList<String>(header); boilerPlate.addAll(body); boilerPlate.addAll(footer); return StringMessageUtils.getBoilerPlate(boilerPlate, '*', 70); }
private void printTestHeader() { if (verbose) { System.out.println(getBoilerPlate(getTestHeader(), '=', 80)); } }
/** * Will shut down the server displaying the cause and time of the shutdown * * @param e the exception that caused the shutdown */ public void shutdown(Throwable e) throws MuleException { I18nMessage msg = fatalErrorWhileRunning(); MuleException muleException = getRootMuleException(e); if (muleException != null) { logger.error(muleException.getDetailedMessage()); } else { logger.error(msg.toString() + " " + e.getMessage(), e); } List<String> msgs = new ArrayList<>(); msgs.add(msg.getMessage()); Throwable root = getRootException(e); msgs.add(root.getMessage() + " (" + root.getClass().getName() + ")"); msgs.add(" "); msgs.add(fatalErrorInShutdown().getMessage()); String shutdownMessage = getBoilerPlate(msgs, '*', 80); logger.error(shutdownMessage); doShutdown(); System.exit(1); }
@Test public void testBoilerPlate() throws Exception { List<String> msgs = new ArrayList<String>(); msgs.add("This"); msgs.add("is a"); msgs.add("Boiler Plate"); String plate = StringMessageUtils.getBoilerPlate(msgs, '*', 12); assertEquals(lineSeparator() + "************" + lineSeparator() + "* This *" + lineSeparator() + "* is a *" + lineSeparator() + "* Boiler *" + lineSeparator() + "* Plate *" + lineSeparator() + "************", plate); }
@Test public void testBoilerPlate2() throws Exception { List<String> msgs = new ArrayList<String>(); msgs.add("This"); msgs.add("is a"); msgs.add("Boiler Plate Message that should get wrapped to the next line if it is working properly"); String plate = StringMessageUtils.getBoilerPlate(msgs, '*', 12); assertEquals(lineSeparator() + "************" + lineSeparator() + "* This *" + lineSeparator() + "* is a *" + lineSeparator() + "* Boiler *" + lineSeparator() + "* Plate *" + lineSeparator() + "* Message *" + lineSeparator() + "* that *" + lineSeparator() + "* should *" + lineSeparator() + "* get *" + lineSeparator() + "* wrapped *" + lineSeparator() + "* to the *" + lineSeparator() + "* next *" + lineSeparator() + "* line if *" + lineSeparator() + "* it is *" + lineSeparator() + "* working *" + lineSeparator() + "* properly *" + lineSeparator() + "************", plate); }
@Test public void testBoilerPlateSingleLine() { String plate = StringMessageUtils.getBoilerPlate("Single message.", '*', 12); assertEquals(lineSeparator() + "************" + lineSeparator() + "* Single *" + lineSeparator() + "* message. *" + lineSeparator() + "************", plate); }