-
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.
Merge pull request #41 from glugg23/release/v0.3.0
Release/v0.3.0
- Loading branch information
Showing
18 changed files
with
1,082 additions
and
83 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM openjdk:11 | ||
COPY ./target/SET08103-G20-0.2.0-jar-with-dependencies.jar /tmp | ||
COPY ./target/SET08103-G20-jar-with-dependencies.jar /tmp | ||
WORKDIR /tmp | ||
ENTRYPOINT ["java", "-jar","SET08103-G20-0.2.0-jar-with-dependencies.jar"] | ||
ENTRYPOINT ["java", "-jar","SET08103-G20-jar-with-dependencies.jar"] |
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 |
---|---|---|
@@ -1,45 +1,28 @@ | ||
package com.napier.group20; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
import java.sql.Connection; | ||
import java.sql.DriverManager; | ||
import java.sql.ResultSet; | ||
import java.sql.Statement; | ||
import com.napier.group20.places.City; | ||
import com.napier.group20.places.Country; | ||
import com.napier.group20.utils.App; | ||
|
||
import java.util.ArrayList; | ||
|
||
public class Main { | ||
public static void main(String[] args) { | ||
Connection connection = null; | ||
int count = 10; | ||
App app = new App(); | ||
app.connect("db:3306", 10); | ||
|
||
if (args.length > 0) { | ||
count = Integer.parseInt(args[0]); | ||
} | ||
app.loadDatabase(); | ||
|
||
for (int i = 0; (i < count) && (connection == null); i++){ | ||
try { | ||
TimeUnit.SECONDS.sleep(5); | ||
connection = DriverManager.getConnection("jdbc:mariadb://db:3306/world", "root", "secret"); | ||
} catch (Exception e) { | ||
System.err.println("Connection to MariaDB container failed, retrying."); | ||
} | ||
} | ||
app.disconnect(); | ||
|
||
if (connection == null) { | ||
System.out.println("Cannot find instance of MariaDB. Closing program."); | ||
System.exit(-1); | ||
ArrayList<Country> countriesInWorld = app.countriesInWorld(); | ||
for(Country country : countriesInWorld) { | ||
System.out.println(country.toString()); | ||
} | ||
|
||
try { | ||
String query = "SELECT * FROM country;"; | ||
Statement statement = connection.createStatement(); | ||
ResultSet resultSet = statement.executeQuery(query); | ||
|
||
while(resultSet.next()) { | ||
System.out.println(resultSet.getString("Name")); | ||
} | ||
connection.close(); | ||
} catch(Exception e) { | ||
e.printStackTrace(); | ||
ArrayList<City> citiesInWorld = app.citiesInWorld(); | ||
for(City city : citiesInWorld) { | ||
System.out.println(city.toString()); | ||
} | ||
} | ||
} |
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.