Skip to content

Commit e437f70

Browse files
committed
add concurrent programming course and project0
1 parent 2f0099e commit e437f70

File tree

60 files changed

+238
-55
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+238
-55
lines changed
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>edu.coursera.concurrent</groupId>
6+
<artifactId>miniproject_0</artifactId>
7+
<packaging>jar</packaging>
8+
<version>0.0</version>
9+
<name>miniproject_0</name>
10+
11+
<properties>
12+
<pcdp.version>0.0.4-SNAPSHOT</pcdp.version>
13+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
14+
</properties>
15+
16+
<repositories>
17+
<repository>
18+
<id>pcdp-repo</id>
19+
<url>https://raw.github.com/habanero-maven/hjlib-maven-repo/mvn-repo-pcdp-${pcdp.version}/</url>
20+
<snapshots>
21+
<enabled>true</enabled>
22+
<updatePolicy>always</updatePolicy>
23+
</snapshots>
24+
</repository>
25+
</repositories>
26+
27+
<dependencies>
28+
<dependency>
29+
<groupId>org.apache.maven.plugins</groupId>
30+
<artifactId>maven-resources-plugin</artifactId>
31+
<version>2.4.3</version>
32+
</dependency>
33+
<dependency>
34+
<groupId>edu.rice.pcdp</groupId>
35+
<artifactId>pcdp-core</artifactId>
36+
<version>${pcdp.version}</version>
37+
</dependency>
38+
<dependency>
39+
<groupId>junit</groupId>
40+
<artifactId>junit</artifactId>
41+
<version>3.8.2</version>
42+
<scope>test</scope>
43+
</dependency>
44+
</dependencies>
45+
46+
<build>
47+
<pluginManagement>
48+
<plugins>
49+
<plugin>
50+
<!-- specify the java version to use during compilation -->
51+
<groupId>org.apache.maven.plugins</groupId>
52+
<artifactId>maven-compiler-plugin</artifactId>
53+
<version>3.1</version>
54+
<configuration>
55+
<source>1.8</source>
56+
<target>1.8</target>
57+
</configuration>
58+
</plugin>
59+
<plugin>
60+
<!-- populates the properties for dependency jar paths -->
61+
<groupId>org.apache.maven.plugins</groupId>
62+
<artifactId>maven-dependency-plugin</artifactId>
63+
<version>2.9</version>
64+
<executions>
65+
<execution>
66+
<goals>
67+
<goal>properties</goal>
68+
</goals>
69+
</execution>
70+
</executions>
71+
</plugin>
72+
<plugin>
73+
<!-- executes test with -Xmx option -->
74+
<groupId>org.apache.maven.plugins</groupId>
75+
<artifactId>maven-surefire-plugin</artifactId>
76+
<version>2.17</version>
77+
<configuration>
78+
<forkMode>pertest</forkMode>
79+
<argLine>-Xmx4g</argLine>
80+
<useSystemClassLoader>true</useSystemClassLoader>
81+
<testFailureIgnore>true</testFailureIgnore>
82+
</configuration>
83+
</plugin>
84+
<plugin>
85+
<groupId>org.apache.maven.plugins</groupId>
86+
<artifactId>maven-checkstyle-plugin</artifactId>
87+
<version>2.17</version>
88+
<executions>
89+
<execution>
90+
<id>checkstyle</id>
91+
<phase>validate</phase>
92+
<configuration>
93+
<configLocation>${basedir}/src/main/resources/checkstyle.xml</configLocation>
94+
<encoding>UTF-8</encoding>
95+
<consoleOutput>true</consoleOutput>
96+
<failsOnError>true</failsOnError>
97+
<failOnViolation>true</failOnViolation>
98+
</configuration>
99+
<goals>
100+
<goal>check</goal>
101+
</goals>
102+
</execution>
103+
</executions>
104+
</plugin>
105+
</plugins>
106+
</pluginManagement>
107+
</build>
108+
</project>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package edu.coursera.concurrent;
2+
3+
import static edu.rice.pcdp.PCDP.finish;
4+
import static edu.rice.pcdp.PCDP.async;
5+
6+
/**
7+
* A simple class for testing compilation of an PCDP project.
8+
*/
9+
public final class Setup {
10+
11+
/**
12+
* Default constructor.
13+
*/
14+
private Setup() {
15+
}
16+
17+
/**
18+
* A simple method for testing compilation of an PCDP project.
19+
* @param val Input value
20+
* @return Dummy value
21+
*/
22+
public static int setup(final int val) {
23+
final int[] result = new int[1];
24+
finish(() -> {
25+
async(() -> {
26+
result[0] = val;
27+
});
28+
});
29+
return result[0];
30+
}
31+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**
2+
* Source code from the Java Concurrent Programming Coursera course.
3+
*/
4+
package edu.coursera.concurrent;

miniproject_0/src/main/resources/checkstyle.xml renamed to ConcurrentProg/miniproject_0/src/main/resources/checkstyle.xml

File renamed without changes.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package edu.coursera.concurrent;
2+
3+
import java.util.Random;
4+
5+
import junit.framework.TestCase;
6+
7+
public class SetupTest extends TestCase {
8+
9+
/*
10+
* A simple test case.
11+
*/
12+
public void testSetup() {
13+
final int result = Setup.setup(42);
14+
assertEquals(42, result);
15+
}
16+
}
File renamed without changes.

0 commit comments

Comments
 (0)