-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1e7ccfb
commit b52ed5a
Showing
16 changed files
with
276 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
NEO4J_ADDR=localhost |
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,29 @@ | ||
name: app-test | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
- master | ||
pull_request: | ||
|
||
defaults: | ||
run: | ||
working-directory: . | ||
|
||
jobs: | ||
apptests: | ||
name: Tests | ||
runs-on: self-hosted | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 16 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 16 | ||
- name: Clean db before tests | ||
run: delete_all_nodes | ||
- name: Run mvn test | ||
run: mvn test | ||
- name: Clean db after tests | ||
run: delete_all_nodes |
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,6 @@ | ||
/target/ | ||
.settings | ||
.classpath | ||
.factorypath | ||
.project | ||
.idea |
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,8 @@ | ||
FROM maven:3.6.3-openjdk-16 | ||
|
||
WORKDIR /root/.m2/repository | ||
COPY . ./ | ||
RUN mvn verify clean --fail-never | ||
RUN mvn compile; sleep 15 | ||
ENTRYPOINT [ "mvn","exec:java" ] | ||
EXPOSE 8000 |
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,24 @@ | ||
version: "3.7" | ||
services: | ||
assignment: | ||
container_name: a1 | ||
build: | ||
context: ./ | ||
dockerfile: Dockerfile | ||
depends_on: | ||
- neo4j | ||
ports: | ||
- '8080:8080' | ||
environment: | ||
- NEO4J_ADDR=neo4j | ||
- HTTP_PROXY="http://cms-proxy.utsc.utoronto.ca:8118/" | ||
- HTTPS_PROXY="http://cms-proxy.utsc.utoronto.ca:8118/" | ||
- NO_PROXY=".utsc.utoronto.ca,.utoronto.ca,127.0.0.0/8" | ||
neo4j: | ||
container_name: neo4j | ||
#platform: linux/amd64 | ||
image: neo4j:latest | ||
environment: | ||
- NEO4J_AUTH=neo4j/123456 | ||
ports: | ||
- '7687:7687' |
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,90 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>ca.utoronto.utm.mcs</groupId> | ||
<artifactId>a1</artifactId> | ||
<packaging>jar</packaging> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>a1</name> | ||
<url>http://maven.apache.org</url> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter</artifactId> | ||
<version>5.7.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.dagger</groupId> | ||
<artifactId>dagger</artifactId> | ||
<version>2.35.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.neo4j.driver</groupId> | ||
<artifactId>neo4j-java-driver</artifactId> | ||
<version>4.3.4</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.json</groupId> | ||
<artifactId>json</artifactId> | ||
<version>20090211</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.github.cdimascio</groupId> | ||
<artifactId>dotenv-java</artifactId> | ||
<version>2.2.0</version> | ||
</dependency> | ||
</dependencies> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.release>16</maven.compiler.release> | ||
</properties> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>3.0.0-M4</version> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.8.0</version> | ||
<configuration> | ||
<release>16</release> | ||
<annotationProcessorPaths> | ||
<path> | ||
<groupId>com.google.dagger</groupId> | ||
<artifactId>dagger-compiler</artifactId> | ||
<version>2.35.1</version> | ||
</path> | ||
</annotationProcessorPaths> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>exec-maven-plugin</artifactId> | ||
<version>3.0.0</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>java</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<mainClass>ca.utoronto.utm.mcs.App</mainClass> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>2.22.0</version> | ||
<configuration> | ||
<argLine>--enable-preview</argLine> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
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,20 @@ | ||
package ca.utoronto.utm.mcs; | ||
|
||
import io.github.cdimascio.dotenv.Dotenv; | ||
import java.io.IOException; | ||
|
||
public class App | ||
{ | ||
static int port = 8080; | ||
|
||
public static void main(String[] args) throws IOException | ||
{ | ||
// TODO Create Your Server Context Here, There Should Only Be One Context | ||
System.out.printf("Server started on port %d\n", port); | ||
|
||
// This code is used to get the neo4j address, you must use this so that we can mark :) | ||
Dotenv dotenv = Dotenv.load(); | ||
String addr = dotenv.get("NEO4J_ADDR"); | ||
System.out.println(addr); | ||
} | ||
} |
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,7 @@ | ||
package ca.utoronto.utm.mcs; | ||
|
||
// All your database transactions or queries should | ||
// go in this class | ||
public class Neo4jDAO { | ||
// TODO Complete This 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package ca.utoronto.utm.mcs; | ||
|
||
import java.io.IOException; | ||
import com.sun.net.httpserver.HttpExchange; | ||
import com.sun.net.httpserver.HttpHandler; | ||
|
||
public class ReqHandler implements HttpHandler { | ||
|
||
// TODO Complete This Class | ||
|
||
@Override | ||
public void handle(HttpExchange exchange) throws IOException { | ||
|
||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/ca/utoronto/utm/mcs/ReqHandlerComponent.java
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,12 @@ | ||
package ca.utoronto.utm.mcs; | ||
|
||
import dagger.Component; | ||
import javax.inject.Singleton; | ||
|
||
@Singleton | ||
// TODO Uncomment The Line Below When You Have Implemented ReqHandlerModule | ||
// @Component(modules = ReqHandlerModule.class) | ||
public interface ReqHandlerComponent { | ||
|
||
public ReqHandler buildHandler(); | ||
} |
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,8 @@ | ||
package ca.utoronto.utm.mcs; | ||
|
||
import dagger.Module; | ||
|
||
@Module | ||
public class ReqHandlerModule { | ||
// TODO Complete This Module | ||
} |
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,5 @@ | ||
package ca.utoronto.utm.mcs; | ||
|
||
public class Server { | ||
// TODO Complete This 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package ca.utoronto.utm.mcs; | ||
|
||
import dagger.Component; | ||
import javax.inject.Singleton; | ||
|
||
@Singleton | ||
// TODO Uncomment The Line Below When You Have Implemented ServerModule | ||
// @Component(modules = ServerModule.class) | ||
public interface ServerComponent { | ||
|
||
public Server buildServer(); | ||
} |
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,8 @@ | ||
package ca.utoronto.utm.mcs; | ||
|
||
import dagger.Module; | ||
|
||
@Module | ||
public class ServerModule { | ||
// TODO Complete This Module | ||
} |
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,16 @@ | ||
package ca.utoronto.utm.mcs; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.InputStreamReader; | ||
import java.util.stream.Collectors; | ||
|
||
public class Utils { | ||
public static String convert(InputStream inputStream) throws IOException { | ||
|
||
try (BufferedReader br = new BufferedReader(new InputStreamReader(inputStream))) { | ||
return br.lines().collect(Collectors.joining(System.lineSeparator())); | ||
} | ||
} | ||
} |
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,15 @@ | ||
package ca.utoronto.utm.mcs; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import org.junit.jupiter.api.Test; | ||
|
||
// TODO Please Write Your Tests For CI/CD In This Class. You will see | ||
// these tests pass/fail on github under github actions. | ||
public class AppTest { | ||
|
||
@Test | ||
public void exampleTest() { | ||
assertTrue(true); | ||
} | ||
|
||
} |