This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class CacheInfoEndpoint extends AbstractEndpoint<ObjectNode> { | |
| public static final boolean DO_NOT_CREATE_IF_MISSING = false; | |
| private final SpringEmbeddedCacheManager springEmbeddedCacheManager; | |
| public CacheInfoEndpoint(final SpringEmbeddedCacheManager springEmbeddedCacheManager) { | |
| super("cache", false, true); | |
| this.springEmbeddedCacheManager = springEmbeddedCacheManager; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void start(final Environment environment, final int port) { | |
| Environment.set(environment); | |
| v | |
| final Tomcat tomcat = new Tomcat(); | |
| tomcat.setPort(port); | |
| final File workDir = Files.createTempDir(); | |
| final Context context = tomcat.addContext("", workDir.getAbsolutePath()); | |
| context.addServletContainerInitializer(new SpringServletContainerInitializer(), | |
| ImmutableSet.<Class<?>>of(Application.class)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private final static Set<ILoggingEvent> loggingEvents = [] as Set | |
| private void reset() { | |
| loggingEvents.clear() | |
| initializeMockLogAppender(); | |
| } | |
| public void assertOneErrorLogEvent(String expectedMessage) { | |
| assert loggingEvents.size() == 1 | |
| assert loggingEvents.first().getThrowableProxy().message == expectedMessage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| die() { | |
| echo $1 | |
| echo "Usage: $0 application environment date" | |
| echo "environment is TEST/BETA/DEMO/PROD" | |
| echo "date pattern is yyyy-MM-dd" | |
| exit 1 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static int availablePort() { | |
| final ServerSocket serverSocket = new ServerSocket(0) | |
| serverSocket.withCloseable { | |
| return serverSocket.getLocalPort(); | |
| } | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static int availablePort() { | |
| int port = 0; | |
| try (ServerSocket serverSocket = new ServerSocket(port)) { | |
| port = serverSocket.getLocalPort(); | |
| } catch (IOException e) { | |
| throw new IllegalStateException("Unable to get available port"); | |
| } | |
| return port; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| withPooledSAXParser { SAXParser saxParser -> | |
| def slurped = new XmlSlurper(saxParser).parseText(documentString); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export PS1="\u@\h:\W\[$(tput sgr0)\]$ " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| URL_TO_VERIFY=$1 | |
| EXPECTED_HTTP_CODE="200" | |
| echo "Verifying '${URL_TO_VERIFY}' on $(hostname)" | |
| RESULT=$(wget -O/dev/null --retry-connrefused -S "${URL_TO_VERIFY}" 2>&1 | grep "HTTP/" | cut -d' ' -f4) | |
| if [ "$?" -ne "0" ]; then | |
| echo "Unable to connect to '${URL_TO_VERIFY}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class EmbeddedMQBroker { | |
| public static final String ACTIVEMQ_URL = "vm://localhost"; | |
| private static Logger logger = LoggerFactory.getLogger(EmbeddedMQBroker.class); | |
| Connection connection; | |
| BrokerService broker; | |
| private EmbeddedMQBroker(final String url) { | |
| //Keep alive mq connection to stop ActiveMq from shutting down automatically. |
OlderNewer