Skip to content

Commit 966d641

Browse files
committed
initial commit
1 parent 9f12d3a commit 966d641

File tree

12 files changed

+345
-2
lines changed

12 files changed

+345
-2
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ pom.xml.next
66
release.properties
77
dependency-reduced-pom.xml
88
buildNumber.properties
9-
.mvn/timing.properties
9+
.idea
10+
*.iml

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
# Time Tracker Project
1+
# time-tracker
2+
Java (Maven) application for tracking time on the job
23

34
Time tracker

core/pom.xml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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+
<modelVersion>4.0.0</modelVersion>
4+
5+
<parent>
6+
<groupId>clinic.programming.time-tracker</groupId>
7+
<artifactId>time-tracker-parent</artifactId>
8+
<version>0.5.0-SNAPSHOT</version>
9+
</parent>
10+
11+
<artifactId>time-tracker-core</artifactId>
12+
<packaging>jar</packaging>
13+
<name>Time Tracker (Core)</name>
14+
15+
<dependencies>
16+
<dependency>
17+
<groupId>org.springframework</groupId>
18+
<artifactId>spring-context</artifactId>
19+
<version>${spring.version}</version>
20+
</dependency>
21+
22+
<!-- Testing -->
23+
<dependency>
24+
<groupId>junit</groupId>
25+
<artifactId>junit</artifactId>
26+
<version>${junit.version}</version>
27+
<scope>test</scope>
28+
</dependency>
29+
30+
<dependency>
31+
<groupId>org.springframework</groupId>
32+
<artifactId>spring-test</artifactId>
33+
<version>${spring.version}</version>
34+
<scope>test</scope>
35+
</dependency>
36+
<!-- End Testing -->
37+
</dependencies>
38+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package clinic.programming.timetracker.core;
2+
3+
import org.springframework.beans.factory.annotation.Autowired;
4+
import org.springframework.stereotype.Component;
5+
import clinic.programming.timetracker.core.dao.TimeEntry;
6+
7+
import java.util.List;
8+
9+
@Component
10+
public class Tracker {
11+
@Autowired
12+
private List<TimeEntry> entries;
13+
14+
public void add(TimeEntry entry) {
15+
entries.add(entry);
16+
}
17+
18+
public void remove(TimeEntry entry) {
19+
entries.remove(entry);
20+
}
21+
22+
public int size() {
23+
return entries.size();
24+
}
25+
26+
public TimeEntry get(int index) {
27+
return entries.get(index);
28+
}
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package clinic.programming.timetracker.core;
2+
3+
import org.springframework.context.annotation.Bean;
4+
import org.springframework.context.annotation.ComponentScan;
5+
import org.springframework.context.annotation.Configuration;
6+
import clinic.programming.timetracker.core.dao.TimeEntry;
7+
8+
import java.util.ArrayList;
9+
import java.util.List;
10+
11+
/**
12+
* Created by Jason on 6/19/2015.
13+
*/
14+
@Configuration
15+
@ComponentScan("clinic.programming.timetracker.core")
16+
public class TrackerCoreConfig {
17+
18+
@Bean(name = "timesheet")
19+
public List<TimeEntry> timeEntries() {
20+
return new ArrayList<>();
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package clinic.programming.timetracker.core.dao;
2+
3+
import org.springframework.context.annotation.Scope;
4+
import org.springframework.stereotype.Component;
5+
6+
/**
7+
* Created by Jason on 6/19/2015.
8+
*/
9+
@Component
10+
@Scope("prototype")
11+
public class TimeEntry {
12+
private String description;
13+
private float rate;
14+
private int time;
15+
16+
public String getDescription() {
17+
return description;
18+
}
19+
20+
public void setDescription(String value) {
21+
this.description = value;
22+
}
23+
24+
public float getRate() {
25+
return rate;
26+
}
27+
28+
public void setRate(float value) {
29+
this.rate = value;
30+
}
31+
32+
public int getTime() {
33+
return time;
34+
}
35+
36+
public void setTime(int value) {
37+
this.time = value;
38+
}
39+
40+
@Override
41+
public String toString() {
42+
return "TimeEntry{" +
43+
"description='" + description + '\'' +
44+
", rate=" + rate +
45+
", time=" + time +
46+
'}';
47+
}
48+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package clinic.programming.timetracker.core;
2+
3+
import static org.junit.Assert.*;
4+
5+
import org.junit.Test;
6+
import org.junit.runner.RunWith;
7+
import org.springframework.beans.factory.annotation.Autowired;
8+
import org.springframework.test.context.ContextConfiguration;
9+
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
10+
import clinic.programming.timetracker.core.dao.TimeEntry;
11+
12+
import java.util.List;
13+
14+
/**
15+
* Created by Jason on 6/20/2015.
16+
*/
17+
@RunWith(SpringJUnit4ClassRunner.class)
18+
@ContextConfiguration(classes = TrackerCoreConfig.class)
19+
public class TrackerCoreConfigTest {
20+
21+
@Autowired
22+
List<TimeEntry> entries;
23+
24+
@Test
25+
public void testMe() {
26+
assertNotNull(entries);
27+
}
28+
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package clinic.programming.timetracker.core;
2+
3+
import static org.junit.Assert.*;
4+
5+
import org.junit.Test;
6+
import org.junit.runner.RunWith;
7+
import org.springframework.beans.factory.annotation.Autowired;
8+
import org.springframework.test.context.ContextConfiguration;
9+
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
10+
import clinic.programming.timetracker.core.dao.TimeEntry;
11+
12+
/**
13+
* Created by Jason on 6/19/2015.
14+
*/
15+
@RunWith(SpringJUnit4ClassRunner.class)
16+
@ContextConfiguration(classes = TrackerCoreConfig.class)
17+
public class TrackerTest {
18+
@Autowired
19+
private Tracker tracker;
20+
21+
@Test
22+
public void testMe() {
23+
assertNotNull(tracker);
24+
}
25+
26+
@Test
27+
public void testAdd() {
28+
TimeEntry entry = new TimeEntry();
29+
entry.setDescription("Entry Test");
30+
entry.setRate(80.0f);
31+
entry.setTime(3);
32+
tracker.add(entry);
33+
assertTrue(tracker.size() > 0);
34+
}
35+
}

pom.xml

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>clinic.programming.time-tracker</groupId>
5+
<artifactId>time-tracker-parent</artifactId>
6+
<packaging>pom</packaging>
7+
<version>0.5.0-SNAPSHOT</version>
8+
<name>Time Tracker (Parent)</name>
9+
<description>
10+
This is a simple Maven / Java web project.
11+
</description>
12+
<inceptionYear>2015</inceptionYear>
13+
<url>http://maven.training/</url>
14+
15+
<properties>
16+
<spring.version>4.3.8.RELEASE</spring.version>
17+
<java.version>1.8</java.version>
18+
<junit.version>4.12</junit.version>
19+
<findbugs.version>3.0.1</findbugs.version>
20+
<pmd.version>3.4</pmd.version>
21+
<checkstyle.version>2.15</checkstyle.version>
22+
</properties>
23+
24+
<modules>
25+
<module>core</module>
26+
<module>web</module>
27+
</modules>
28+
29+
<build>
30+
<pluginManagement>
31+
<plugins>
32+
<plugin>
33+
<groupId>org.apache.maven.plugins</groupId>
34+
<artifactId>maven-compiler-plugin</artifactId>
35+
<version>3.6.1</version>
36+
<configuration>
37+
<verbose>true</verbose>
38+
<fork>true</fork>
39+
<source>${java.version}</source>
40+
<target>${java.version}</target>
41+
</configuration>
42+
</plugin>
43+
<plugin>
44+
<groupId>org.codehaus.mojo</groupId>
45+
<artifactId>findbugs-maven-plugin</artifactId>
46+
<version>${findbugs.version}</version>
47+
</plugin>
48+
<plugin>
49+
<groupId>org.apache.maven.plugins</groupId>
50+
<artifactId>maven-pmd-plugin</artifactId>
51+
<version>${pmd.version}</version>
52+
</plugin>
53+
<plugin>
54+
<groupId>org.apache.maven.plugins</groupId>
55+
<artifactId>maven-checkstyle-plugin</artifactId>
56+
<version>${checkstyle.version}</version>
57+
</plugin>
58+
</plugins>
59+
</pluginManagement>
60+
</build>
61+
62+
<reporting>
63+
<plugins>
64+
<plugin>
65+
<groupId>org.codehaus.mojo</groupId>
66+
<artifactId>findbugs-maven-plugin</artifactId>
67+
<configuration>
68+
<effort>Max</effort>
69+
<threshold>Low</threshold>
70+
<xmlOutput>true</xmlOutput>
71+
</configuration>
72+
</plugin>
73+
<plugin>
74+
<groupId>org.apache.maven.plugins</groupId>
75+
<artifactId>maven-pmd-plugin</artifactId>
76+
<reportSets>
77+
<reportSet>
78+
<reports>
79+
<report>pmd</report>
80+
<report>cpd</report>
81+
</reports>
82+
</reportSet>
83+
</reportSets>
84+
</plugin>
85+
<plugin>
86+
<groupId>org.apache.maven.plugins</groupId>
87+
<artifactId>maven-checkstyle-plugin</artifactId>
88+
</plugin>
89+
</plugins>
90+
</reporting>
91+
</project>

web/pom.xml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
<modelVersion>4.0.0</modelVersion>
4+
5+
<parent>
6+
<groupId>clinic.programming.time-tracker</groupId>
7+
<artifactId>time-tracker-parent</artifactId>
8+
<version>0.5.0-SNAPSHOT</version>
9+
</parent>
10+
11+
<artifactId>time-tracker-web</artifactId>
12+
<packaging>war</packaging>
13+
<name>Time Tracker (Web)</name>
14+
15+
<dependencies>
16+
<dependency>
17+
<groupId>clinic.programming.time-tracker</groupId>
18+
<artifactId>time-tracker-core</artifactId>
19+
<version>${project.version}</version>
20+
</dependency>
21+
</dependencies>
22+
</project>

web/src/main/webapp/WEB-INF/web.xml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
4+
version="3.1">
5+
<welcome-file-list>
6+
<welcome-file>index.jsp</welcome-file>
7+
</welcome-file-list>
8+
</web-app>

web/src/main/webapp/index.jsp

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<%--
2+
Created by IntelliJ IDEA.
3+
User: Jason
4+
Date: 6/22/2015
5+
Time: 8:47 PM
6+
To change this template use File | Settings | File Templates.
7+
--%>
8+
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
9+
<html>
10+
<head>
11+
<title>Super Simple Example Webpage</title>
12+
</head>
13+
<body>
14+
<h1>Super Simple Example Web Page</h1>
15+
<p>
16+
This is a very simple example web page on a JSP.
17+
</p>
18+
</body>
19+
</html>

0 commit comments

Comments
 (0)