Fortunately, there's the MongoDB brew tap!
To use this, just:
- Make sure you have Homebrew installed.
- Install the tap: brew tap mongodb/brew
- Install the MongoDB command line: brew install mongodb-community-shell
Computer Calesthenics and Orthodontia
package org.example.test.app
...imports blah...
@SpringBootApplication()
@Import(SomeConfig::class)
class TestGraphQLClientApp {
/**
* Defines the main resolvers: Query and Mutation.
*/
@Bean
fun resolvers(query: GraphQLQueryResolver) = listOf(query)
}
package org.example.test
... imports blah ...
@RunWith(SpringJUnit4ClassRunner::class)
@SpringBootTest(classes = [TestGraphQLClientApp::class, HttpClientConfiguration::class],
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class GraphQLClientTest {
companion object : KLogging()
@LocalServerPort
private val port: Int = 0
@Autowired
private lateinit var factory: RestTemplateFactory
// These have to be 'by lazy' because Spring will inject the fields they rely on after init.
private val template by lazy { factory.createRestTemplate() }
private val baseUrl by lazy { "http://localhost:$port/graphql" }
private val client by lazy { GraphQLClient(baseUrl, template) }
@Test
fun basicClientTest() {
client.query("query { foo }").also { value ->
logger.info { prettyPrint(value) }
assertEquals("foo", assertHasField(value, "data", "foo").asText())
}
client.query("query { getThing(id: \"12345-ABC\") { one two } }").also {
logger.info { prettyPrint(it) }
}
}
}
@SpringBootApplication(exclude = [
LiquibaseAutoConfiguration::class,
DataSourceAutoConfiguration::class,
DataSourceTransactionManagerAutoConfiguration::class,
HibernateJpaAutoConfiguration::class])
buildscript {
ext {
kotlinVersion = '1.1.2-4'
}
repositories {
jcenter()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies { // Gradle Plugin classpath.
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
}
}
kotlinVersion information over and over.
apply plugin: 'kotlin'
apply plugin: 'kotlin-spring'
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
dependencies {
// Kotlin/JVM libraries
compile("org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}")
compile("org.jetbrains.kotlin:kotlin-stdlib-jre8:${kotlinVersion}")
compile("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
// Kotlin SLF4J utility
compile 'io.github.microutils:kotlin-logging:1.4.4'
}
docker build -t test-image --force-rm .
FROM openjdk:8-jre-alpine
EXPOSE 9324
ARG ELASTICMQ_VERSION=0.13.2
CMD ["java", "-jar", "-Dconfig.file=/elasticmq/custom.conf", "/elasticmq/server.jar"]
COPY custom.conf /elasticmq/custom.conf
ADD "https://s3-eu-west-1.amazonaws.com/softwaremill-public/elasticmq-server-${ELASTICMQ_VERSION}.jar" /elasticmq/server.jar
docker build -t=my-elasticmq:${VER} --force-rm --build-arg ELASTICMQ_VERSION=${VER}
Where:docker run -it --rm --entrypoint /bin/bash test-image
RUN apk add --update bash libstdc++ curl zip && \
rm -rf /var/cache/apk/*
# Workaround https://issues.apache.org/jira/browse/GROOVY-7906 and other 'busybox' related issues. RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# Install groovy
# Use curl -L to follow redirects
# Also, use sed to make a workaround for https://issues.apache.org/jira/browse/GROOVY-7906
RUN curl -L https://bintray.com/artifact/download/groovy/maven/apache-groovy-binary-2.4.8.zip -o /tmp/groovy.zip && \
cd /usr/local && \
unzip /tmp/groovy.zip && \
rm /tmp/groovy.zip && \
ln -s /usr/local/groovy-2.4.8 groovy && \
/usr/local/groovy/bin/groovy -v && \
cd /usr/local/bin && \
ln -s /usr/local/groovy/bin/groovy groovy