This repository has been archived by the owner on Oct 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- GroovyServ is no longer used. Gradle’s daemon is used instead. Unfortunately performance is about 800ms slower on avg. - Ability to customize which packages get loaded - Spring support - Ability to code blocks into multiple files (all languages) - Multi-file Java support - Improved Java exception output - Java build info is now presented within output
- Loading branch information
Showing
25 changed files
with
866 additions
and
243 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Environment | ||
|
||
Code is executed within a Dockerized Ubuntu 14.04 container. | ||
|
||
## Languages | ||
|
||
- Java 8 (1.8.0_91) | ||
|
||
## Loaded Dependencies | ||
|
||
### The following depencies are always loaded | ||
|
||
- junit 4.12 | ||
- lombok 1.16.18 | ||
- mockito-core 2.7.19 | ||
- assertj-core 3.8.0 | ||
|
||
### The following can be loaded through `@config reference` statements | ||
|
||
- joda-time 2.2 | ||
- guava 20.0 | ||
- commons-lang3 3.6 | ||
- commons-math3 3.6.1 | ||
- jsoup 1.10.3 | ||
- dom4j 2.0.1 | ||
- assertj-guava 3.1.0 | ||
- hibernate-core 5.2.10.Final | ||
- mongo-java-driver 3.4.2 | ||
- sqlite-jdbc 3.19.3 | ||
- postgresql 42.1.1 | ||
- spring-boot-starter-web 1.5.4 | ||
- spring-boot-starter-test 1.5.4 | ||
- spring-boot-starter-data-mongodb 1.5.4 | ||
- spring-boot-starter-data-redis 1.5.4 | ||
- spring-boot-starter-data-jpa 1.5.4 | ||
- spring-boot-starter-data-rest 1.5.4 | ||
- spring-boot-starter-validation 1.5.4 | ||
|
||
|
||
To make these packages available to the application, you must have access to the setup code block. | ||
Within the setup code you can load any of these packages using reference config statements. | ||
|
||
**Setup Example:** | ||
```java | ||
// @config reference guava | ||
// @config reference commons-lang3 | ||
``` | ||
|
||
|
||
If you need to reference a package that is a dependency of one of the above packages, you will need to load those packages | ||
in order to make that dependency available. | ||
|
||
### Spring Boot Packages | ||
|
||
If you require support for the Spring framework, you can include `spring-boot` as the reference name. | ||
This will include both the web and test starter dependencies, as well as any additional requirements. | ||
|
||
When including the Spring framework via `spring-boot`, if other services are configured, such as mongodb, then the required spring data packages will also be auto-included into the build. | ||
|
||
# Build Process | ||
|
||
Gradle is used as the build tool. Each time you run code, a fresh Docker container will be used. Under | ||
typical conditions the Gradle daemon should have already loaded, causing build times to typically fall within | ||
the 3 to 4 second range for trivial sized apps. However if the daemon has not finished loading then the build | ||
process may take over 10 seconds to complete. | ||
|
||
# Timeout | ||
|
||
The sandbox environment will timeout the code within 20 seconds. | ||
|
||
> For more information, view the [docker file](https://github.com/Codewars/codewars-runner-cli/blob/master/docker/jvm.docker) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
plugins { | ||
id 'java' | ||
id 'groovy' | ||
} | ||
|
||
repositories { | ||
jcenter() | ||
} | ||
|
||
dependencies { | ||
compile 'junit:junit:4.12' | ||
compileOnly 'org.projectlombok:lombok:1.16.18' | ||
compile "joda-time:joda-time:2.2" | ||
compile 'org.mockito:mockito-core:2.7.19' | ||
compile 'com.google.guava:guava:20.0' | ||
compile 'org.apache.commons:commons-lang3:3.6' | ||
compile 'org.apache.commons:commons-math3:3.6.1' | ||
compile 'org.jsoup:jsoup:1.10.3' // jsoup HTML parser library @ https://jsoup.org/ | ||
compile 'org.dom4j:dom4j:2.0.1' // Flexible XML framework | ||
compile 'org.assertj:assertj-core:3.8.0' | ||
compile 'org.assertj:assertj-guava:3.1.0' | ||
compile 'com.fasterxml.jackson.core:jackson-annotations:2.8.0' | ||
compile 'org.hibernate:hibernate-core:5.2.10.Final' | ||
compile 'org.mongodb:mongo-java-driver:3.4.2' | ||
compile 'org.xerial:sqlite-jdbc:3.19.3' | ||
compile 'org.postgresql:postgresql:42.1.1' | ||
compile 'org.springframework:spring-orm:4.3.9.RELEASE' | ||
compile 'org.springframework.boot:spring-boot-starter-web:1.5.4.RELEASE' | ||
compile 'org.springframework.boot:spring-boot-starter-test:1.5.4.RELEASE' | ||
compile 'org.springframework.boot:spring-boot-starter-data-mongodb:1.5.4.RELEASE' | ||
compile 'org.springframework.boot:spring-boot-starter-data-redis:1.5.4.RELEASE' | ||
compile 'org.springframework.boot:spring-boot-starter-data-jpa:1.5.4.RELEASE' | ||
compile 'org.springframework.boot:spring-boot-starter-data-rest:1.5.4.RELEASE' | ||
compile 'org.springframework.boot:spring-boot-starter-validation:1.5.4.RELEASE' | ||
} | ||
|
||
test { | ||
reports { | ||
html.enabled = false | ||
junitXml.enabled = false | ||
} | ||
testLogging { | ||
// TODO: Refactor so that we use Gradle to customize output, instead of custom test listener | ||
// SEE: https://stackoverflow.com/questions/3963708/gradle-how-to-display-test-results-in-the-console-in-real-time | ||
// SEE: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.Test.html | ||
// Show standard streams so that we can parse STDOUT/ERR output. | ||
showStandardStreams = true | ||
showExceptions = true | ||
showStackTraces = true | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
echo "loading" > /workspace/prewarm.status | ||
|
||
# prewarm by starting the gradle daemon. Running an initial test build will also speed things up a bit | ||
cd /runner/frameworks/java && gradle --daemon --offline test | ||
|
||
echo "loaded" > /workspace/prewarm.status | ||
|
||
# node run -l java -c "public class Solution {}" -f "import org.junit.Test;public class TestFixture{}" | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import org.junit.Test; | ||
import org.junit.runners.JUnit4; | ||
//import org.hamcrest.Matchers.*; | ||
//import com.google.common.base.Optional; | ||
|
||
public class Example { | ||
public Example() { | ||
} | ||
|
||
public String foo(){ return "foo"; } | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import static org.junit.Assert.assertEquals; | ||
import org.junit.Test; | ||
import org.junit.runners.JUnit4; | ||
public class ExampleTest { | ||
@Test | ||
public void myTestFunction(){ | ||
Example e = new Example(); | ||
assertEquals("Failed Message", "foo", e.foo()); | ||
} | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import org.junit.runner.JUnitCore; | ||
import org.junit.Test; | ||
import org.junit.runners.JUnit4; | ||
|
||
public class Start { | ||
@Test | ||
public void start(){ | ||
JUnitCore runner = new JUnitCore(); | ||
runner.addListener(new CwRunListener()); | ||
runner.run(ExampleTest.class); | ||
} | ||
} | ||
|
||
|
This file contains 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
This file contains 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
Oops, something went wrong.