-
Notifications
You must be signed in to change notification settings - Fork 444
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
Showing
123 changed files
with
23,693 additions
and
31 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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
.idea/ | ||
*.swp | ||
test/spec/fixtures/repos/* | ||
target | ||
*.iml | ||
.DS_Store |
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,19 +1,3 @@ | ||
--- | ||
- - test/spec/fixtures/repos/db/java-apache-dbcp-sample | ||
- bc8ef681cf36bf3d78dd94ea514e6d26c649bbb1 | ||
- - test/spec/fixtures/repos/github/java-getting-started | ||
- main | ||
- - test/spec/fixtures/repos/java/java-servlets-sample | ||
- 1cc2843067197d939a1218f1bbe63f5ed28c6111 | ||
- - test/spec/fixtures/repos/java/korvan | ||
- 1a99202ecc10f9a27ad3fedb30403b3f4bcb4750 | ||
- - test/spec/fixtures/repos/java/libpng-test | ||
- 2afd98d3a953fd49f9a2f77380a639ae3091ec98 | ||
- - test/spec/fixtures/repos/java/maven-polyglot | ||
- ecab985c6fa8678b69cc6764f939fd76a9de70ee | ||
- - test/spec/fixtures/repos/java/webapp-runner-sample | ||
- 02b128a87db6df7776baafdcb9a69504e4a41a58 | ||
- - test/spec/fixtures/repos/spring/spring-boot-executable | ||
- e10d57ce128ad43225b2e0c6c3a0c0d0aa71ff9e | ||
- - test/spec/fixtures/repos/spring/spring-boot-webapp-runner | ||
- dd3ec06e76b562bd3734ad5dc576b416ff1559ea |
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 @@ | ||
target |
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,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2014 Joe Kutner | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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 @@ | ||
web: java $JAVA_OPTS -cp target/classes:target/dependency/* Main |
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,47 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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>com.example</groupId> | ||
<version>1.0-SNAPSHOT</version> | ||
<artifactId>helloworld</artifactId> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.eclipse.jetty</groupId> | ||
<artifactId>jetty-servlet</artifactId> | ||
<version>7.6.0.v20120127</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.servlet</groupId> | ||
<artifactId>servlet-api</artifactId> | ||
<version>2.5</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.postgresql</groupId> | ||
<artifactId>postgresql</artifactId> | ||
<version>9.3-1102-jdbc41</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-dbcp2</artifactId> | ||
<version>2.0.1</version> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<version>2.4</version> | ||
<executions> | ||
<execution> | ||
<id>copy-dependencies</id> | ||
<phase>package</phase> | ||
<goals><goal>copy-dependencies</goal></goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
76 changes: 76 additions & 0 deletions
76
test/spec/fixtures/repos/java-apache-dbcp-sample/src/main/java/Main.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,76 @@ | ||
import java.io.IOException; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.http.*; | ||
import org.eclipse.jetty.server.Server; | ||
import org.eclipse.jetty.servlet.*; | ||
import java.net.URI; | ||
import java.net.URISyntaxException; | ||
import java.sql.*; | ||
import java.sql.*; | ||
import org.apache.commons.dbcp2.*; | ||
|
||
public class Main extends HttpServlet { | ||
|
||
private BasicDataSource connectionPool; | ||
|
||
public Main() throws URISyntaxException, SQLException { | ||
URI dbUri = new URI(System.getenv("DATABASE_URL")); | ||
String dbUrl = "jdbc:postgresql://" + dbUri.getHost() + dbUri.getPath(); | ||
connectionPool = new BasicDataSource(); | ||
|
||
if (dbUri.getUserInfo() != null) { | ||
connectionPool.setUsername(dbUri.getUserInfo().split(":")[0]); | ||
connectionPool.setPassword(dbUri.getUserInfo().split(":")[1]); | ||
} | ||
connectionPool.setDriverClassName("org.postgresql.Driver"); | ||
connectionPool.setUrl(dbUrl); | ||
connectionPool.setInitialSize(1); | ||
} | ||
|
||
@Override | ||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) | ||
throws ServletException, IOException { | ||
|
||
if (req.getRequestURI().endsWith("/db")) { | ||
showDatabase(req,resp); | ||
} else { | ||
showHome(req,resp); | ||
} | ||
} | ||
|
||
private void showHome(HttpServletRequest req, HttpServletResponse resp) | ||
throws ServletException, IOException { | ||
resp.getWriter().print("Hello from Java!"); | ||
} | ||
|
||
private void showDatabase(HttpServletRequest req, HttpServletResponse resp) | ||
throws ServletException, IOException { | ||
try { | ||
Connection connection = connectionPool.getConnection(); | ||
|
||
Statement stmt = connection.createStatement(); | ||
stmt.executeUpdate("CREATE TABLE IF NOT EXISTS ticks (tick timestamp)"); | ||
stmt.executeUpdate("INSERT INTO ticks VALUES (now())"); | ||
ResultSet rs = stmt.executeQuery("SELECT tick FROM ticks"); | ||
|
||
String out = "Hello!\n"; | ||
while (rs.next()) { | ||
out += "Read from DB: " + rs.getTimestamp("tick") + "\n"; | ||
} | ||
|
||
resp.getWriter().print(out); | ||
} catch (Exception e) { | ||
resp.getWriter().print("There was an error: " + e.getMessage()); | ||
} | ||
} | ||
|
||
public static void main(String[] args) throws Exception{ | ||
Server server = new Server(Integer.valueOf(System.getenv("PORT"))); | ||
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); | ||
context.setContextPath("/"); | ||
server.setHandler(context); | ||
context.addServlet(new ServletHolder(new Main()),"/*"); | ||
server.start(); | ||
server.join(); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
test/spec/fixtures/repos/java-apache-dbcp-sample/system.properties
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,2 @@ | ||
java.runtime.version=1.7 | ||
|
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,3 @@ | ||
target | ||
*.iml | ||
.idea |
Binary file added
BIN
+48.4 KB
test/spec/fixtures/repos/java-servlets-sample/.mvn/wrapper/maven-wrapper.jar
Binary file not shown.
1 change: 1 addition & 0 deletions
1
test/spec/fixtures/repos/java-servlets-sample/.mvn/wrapper/maven-wrapper.properties
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 @@ | ||
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.3/apache-maven-3.3.3-bin.zip |
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,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2014 Joe Kutner | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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 @@ | ||
web: java $JAVA_OPTS -cp target/classes:target/dependency/* Main |
Oops, something went wrong.