Skip to content

Commit

Permalink
Merge pull request #11 from UTSCCSCC01/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
BillyZ1435 authored Oct 28, 2022
2 parents 1e7ccfb + b649b09 commit 5a6e2a1
Show file tree
Hide file tree
Showing 16 changed files with 1,269 additions and 0 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NEO4J_ADDR=localhost
29 changes: 29 additions & 0 deletions .github/workflows/app-test.yml
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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/target/
.settings
.classpath
.factorypath
.project
.idea
8 changes: 8 additions & 0 deletions Dockerfile
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
24 changes: 24 additions & 0 deletions docker-compose.yml
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'
90 changes: 90 additions & 0 deletions pom.xml
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>
26 changes: 26 additions & 0 deletions src/main/java/ca/utoronto/utm/mcs/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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
{
ReqHandlerComponent handlerComponent = DaggerReqHandlerComponent.create();
ServerComponent serverComponent = DaggerServerComponent.create();
Server server = serverComponent.buildServer();
server.createContext("/api/v1/", handlerComponent.buildHandler());
server.startServer();

// 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);
}
}
Loading

0 comments on commit 5a6e2a1

Please sign in to comment.