Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JFG-1047: store all Dates as timestamps in DB; add timezone to date format in report and webUI #819

Open
wants to merge 50 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
7d60964
Merge remote-tracking branch 'upstream/master'
anton-antonenko Nov 11, 2016
604557d
JFG-911: remove more deprecated unused code
anton-antonenko Nov 11, 2016
91338fc
Merge remote-tracking branch 'upstream/master'
anton-antonenko Nov 16, 2016
1895a81
Merge remote-tracking branch 'upstream/master'
anton-antonenko Nov 21, 2016
ebaaa8e
Merge remote-tracking branch 'origin/master'
anton-antonenko Nov 21, 2016
f93eb8f
Merge remote-tracking branch 'origin/master' into new-master
anton-antonenko Nov 21, 2016
71bd283
Merge remote-tracking branch 'upstream/master'
anton-antonenko Nov 23, 2016
b2d7ba2
Merge remote-tracking branch 'upstream/master'
anton-antonenko Nov 24, 2016
7fd9dbc
Merge remote-tracking branch 'upstream/master'
anton-antonenko Nov 24, 2016
e041cb7
Merge remote-tracking branch 'upstream/master'
anton-antonenko Nov 25, 2016
e55cb73
Merge remote-tracking branch 'origin/master'
anton-antonenko Nov 25, 2016
bda09a8
Merge remote-tracking branch 'upstream/master'
anton-antonenko Nov 25, 2016
18be97e
Merge remote-tracking branch 'upstream/master'
anton-antonenko Nov 25, 2016
f25265f
Merge remote-tracking branch 'upstream/master' into master-origin
anton-antonenko Nov 28, 2016
3244bad
Merge remote-tracking branch 'upstream/master' into master-origin
anton-antonenko Nov 29, 2016
a839c62
Merge remote-tracking branch 'upstream/master' into master-origin
anton-antonenko Dec 1, 2016
1420b9a
JFG-977: Remove redundant configurations
anton-antonenko Dec 2, 2016
58967bb
Merge remote-tracking branch 'upstream/master' into master-origin
anton-antonenko Dec 5, 2016
ea0acfd
Merge remote-tracking branch 'upstream/master'
Dec 14, 2016
51edd62
Merge remote-tracking branch 'upstream/master'
anton-antonenko Dec 16, 2016
a2f7199
Merge remote-tracking branch 'upstream/master'
anton-antonenko Dec 19, 2016
14a5656
JFG-1069: make testProjectURL property of TestExecutionEntity nullable
anton-antonenko Dec 19, 2016
52f49c9
Merge remote-tracking branch 'upstream/master'
anton-antonenko Dec 20, 2016
f75258d
Merge remote-tracking branch 'upstream/master'
anton-antonenko Dec 21, 2016
6e9b548
Merge remote-tracking branch 'upstream/master'
anton-antonenko Dec 22, 2016
2813793
Merge remote-tracking branch 'upstream/master'
anton-antonenko Dec 23, 2016
4913dcb
Merge remote-tracking branch 'upstream/master'
anton-antonenko Dec 26, 2016
49fd402
Merge remote-tracking branch 'upstream/master'
anton-antonenko Dec 27, 2016
d52c096
Merge remote-tracking branch 'upstream/master'
anton-antonenko Jan 3, 2017
0cba4bd
Merge remote-tracking branch 'upstream/master'
anton-antonenko Jan 4, 2017
8a472a2
Merge remote-tracking branch 'upstream/master'
anton-antonenko Jan 5, 2017
cd37ea2
Merge remote-tracking branch 'upstream/master'
anton-antonenko Jan 10, 2017
31a65d9
JFG-1087: add default constructor to DecisionPerSessionDto
anton-antonenko Jan 10, 2017
0886eaa
JFG-1087: add default constructors to decision dtos
anton-antonenko Jan 10, 2017
a6d4cfc
JFG-1071: rename property
anton-antonenko Jan 10, 2017
7cc0e42
Merge remote-tracking branch 'upstream/master'
anton-antonenko Jan 11, 2017
fa6ee12
Merge remote-tracking branch 'upstream/master'
anton-antonenko Jan 11, 2017
b99dda5
JFG-962: change default load balancer
anton-antonenko Jan 12, 2017
bcb2e17
JFG-962: change default load balancer
anton-antonenko Jan 12, 2017
1c11f8e
Merge remote-tracking branch 'upstream/master'
anton-antonenko Jan 12, 2017
13aa959
JFG-1049: fix test name with dot issue in DataServiceRestController
anton-antonenko Jan 13, 2017
70a9207
Merge remote-tracking branch 'upstream/master'
anton-antonenko Jan 13, 2017
889cc16
Merge remote-tracking branch 'upstream/master'
anton-antonenko Jan 17, 2017
99482b1
Merge remote-tracking branch 'upstream/master'
anton-antonenko Jan 18, 2017
b36b499
JFG-1047: store all Dates as timestamps in DB;
anton-antonenko Jan 18, 2017
e0cf131
JFG-1047: change default TZ in docker to UTC
anton-antonenko Jan 18, 2017
dc33d0b
JFG-1047: change default load balancers creation
anton-antonenko Jan 19, 2017
10bcd7e
revert JFG-1047: change default load balancers creation
anton-antonenko Jan 19, 2017
f2ade7d
Merge remote-tracking branch 'origin/JFG-1047' into JFG-1047
anton-antonenko Jan 19, 2017
6626189
revert JFG-1047: change default load balancers creation
anton-antonenko Jan 19, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
<field name="sessionId" class="java.lang.String"/>
<field name="sessionName" class="java.lang.String"/>
<field name="comment" class="java.lang.String"/>
<field name="startTime" class="java.util.Date"/>
<field name="endTime" class="java.util.Date"/>
<field name="startTime" class="java.lang.Long"/>
<field name="endTime" class="java.lang.Long"/>
<field name="taskExecuted" class="java.lang.Integer"/>
<field name="taskFailed" class="java.lang.Integer"/>
<field name="activeKernels" class="java.lang.Integer"/>
Expand Down Expand Up @@ -84,21 +84,21 @@
<textElement textAlignment="Left" verticalAlignment="Middle"/>
<text><![CDATA[Session start time]]></text>
</staticText>
<textField pattern="HH:mm:ss.SSS, dd MMMMM yyyy (EEEEE)">
<textField pattern="HH:mm:ss.SSS z, dd MMMMM yyyy (EEEEE)">
<reportElement style="Header_Bold" positionType="Float" x="300" y="20" width="200" height="10"/>
<textElement textAlignment="Left"/>
<textFieldExpression class="java.util.Date"><![CDATA[$F{startTime}]]></textFieldExpression>
<textFieldExpression class="java.util.Date"><![CDATA[new java.util.Date($F{startTime})]]></textFieldExpression>
</textField>
<staticText>
<reportElement style="Header_Bold" positionType="Float" x="0" y="30" width="300" height="10"
forecolor="#AAAAAA"/>
<textElement textAlignment="Left" verticalAlignment="Middle"/>
<text><![CDATA[Session end time]]></text>
</staticText>
<textField pattern="HH:mm:ss.SSS, dd MMMMM yyyy (EEEEE)">
<textField pattern="HH:mm:ss.SSS z, dd MMMMM yyyy (EEEEE)">
<reportElement style="Header_Bold" positionType="Float" x="300" y="30" width="200" height="10"/>
<textElement textAlignment="Left"/>
<textFieldExpression class="java.util.Date"><![CDATA[$F{endTime}]]></textFieldExpression>
<textFieldExpression class="java.util.Date"><![CDATA[new java.util.Date($F{endTime})]]></textFieldExpression>
</textField>
<staticText>
<reportElement style="Header_Bold" positionType="Float" x="0" y="40" width="300" height="10"
Expand All @@ -110,7 +110,7 @@
<reportElement style="Header_Bold" positionType="Float" x="300" y="40" width="200" height="10"/>
<textElement textAlignment="Left"/>
<textFieldExpression>
<![CDATA[com.griddynamics.jagger.util.TimeUtils.formatDuration( $F{endTime}.getTime() - $F{startTime}.getTime() )]]></textFieldExpression>
<![CDATA[com.griddynamics.jagger.util.TimeUtils.formatDuration( $F{endTime} - $F{startTime} )]]></textFieldExpression>
</textField>
<staticText>
<reportElement style="Header_Bold" positionType="Float" x="0" y="50" width="300" height="10"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,7 @@

package com.griddynamics.jagger.engine.e1.aggregator.session;

import static com.griddynamics.jagger.engine.e1.collector.CollectorConstants.END_TIME;
import static com.griddynamics.jagger.engine.e1.collector.CollectorConstants.ERROR_MESSAGE;
import static com.griddynamics.jagger.engine.e1.collector.CollectorConstants.FAILED;
import static com.griddynamics.jagger.engine.e1.collector.CollectorConstants.KERNELS_COUNT;
import static com.griddynamics.jagger.engine.e1.collector.CollectorConstants.SESSION;
import static com.griddynamics.jagger.engine.e1.collector.CollectorConstants.START_TIME;
import static com.griddynamics.jagger.engine.e1.collector.CollectorConstants.TASK_EXECUTED;

import com.google.common.collect.Multimap;
import com.griddynamics.jagger.coordinator.NodeId;
import com.griddynamics.jagger.coordinator.NodeType;
import com.griddynamics.jagger.dbapi.entity.SessionData;
Expand All @@ -48,15 +41,20 @@
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.google.common.collect.Multimap;

import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import static com.griddynamics.jagger.engine.e1.collector.CollectorConstants.END_TIME;
import static com.griddynamics.jagger.engine.e1.collector.CollectorConstants.ERROR_MESSAGE;
import static com.griddynamics.jagger.engine.e1.collector.CollectorConstants.FAILED;
import static com.griddynamics.jagger.engine.e1.collector.CollectorConstants.KERNELS_COUNT;
import static com.griddynamics.jagger.engine.e1.collector.CollectorConstants.SESSION;
import static com.griddynamics.jagger.engine.e1.collector.CollectorConstants.START_TIME;
import static com.griddynamics.jagger.engine.e1.collector.CollectorConstants.TASK_EXECUTED;

/**
* Aggregates generic session/task data from key-value storage and stores to
* relation structure. See {@link com.griddynamics.jagger.dbapi.entity.SessionData},
Expand Down Expand Up @@ -99,10 +97,10 @@ public void onSessionExecuted(String sessionId, String sessionComment, SessionEx
sessionData.setComment(sessionComment);

Long startTime = (Long) getFirst(all, START_TIME);
sessionData.setStartTime(new Date(startTime));
sessionData.setStartTime(startTime);

Long endTime = (Long) getFirst(all, END_TIME);
sessionData.setEndTime(new Date(endTime));
sessionData.setEndTime(endTime);

Integer taskExecuted = (Integer) getFirst(all, TASK_EXECUTED);
sessionData.setTaskExecuted(taskExecuted);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import org.springframework.beans.factory.annotation.Required;

import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -144,8 +143,8 @@ private void persistValues(String sessionId, String taskId, WorkloadTask workloa
testData.setParentId(parentId);
testData.setNumber(workloadTask.getNumber());
testData.setScenario(workloadDetails);
testData.setStartTime(new Date(startTime));
testData.setEndTime(new Date(endTime));
testData.setStartTime(startTime);
testData.setEndTime(endTime);

getHibernateTemplate().persist(testData);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

public class FormatCalculator {

public static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
public static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss z";

public static String getNumberFormat(double value) {
value = Math.abs(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@

package com.griddynamics.jagger.dbapi.entity;

import java.util.Date;
import java.util.Set;
import java.util.Collections;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
Expand All @@ -33,6 +29,8 @@
import javax.persistence.Id;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import java.util.Collections;
import java.util.Set;

@Entity
public class SessionData {
Expand All @@ -41,8 +39,8 @@ public class SessionData {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String sessionId;
private Date startTime;
private Date endTime;
private Long startTime;
private Long endTime;
private Integer taskExecuted;
private Integer taskFailed;
private Integer activeKernels;
Expand Down Expand Up @@ -73,19 +71,19 @@ public void setSessionId(String sessionId) {
this.sessionId = sessionId;
}

public Date getStartTime() {
public Long getStartTime() {
return startTime;
}

public void setStartTime(Date startTime) {
public void setStartTime(Long startTime) {
this.startTime = startTime;
}

public Date getEndTime() {
public Long getEndTime() {
return endTime;
}

public void setEndTime(Date endTime) {
public void setEndTime(Long endTime) {
this.endTime = endTime;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import java.util.Date;

@Entity
public class WorkloadData {
Expand All @@ -35,8 +34,8 @@ public class WorkloadData {
private String parentId;
private Integer number;
private WorkloadDetails scenario;
private Date startTime;
private Date endTime;
private Long startTime;
private Long endTime;

@Id
// Identity strategy is not supported by Oracle DB from the box
Expand Down Expand Up @@ -82,19 +81,19 @@ public void setScenario(WorkloadDetails scenario) {
this.scenario = scenario;
}

public Date getStartTime() {
public Long getStartTime() {
return startTime;
}

public void setStartTime(Date startTime) {
public void setStartTime(Long startTime) {
this.startTime = startTime;
}

public Date getEndTime() {
public Long getEndTime() {
return endTime;
}

public void setEndTime(Date endTime) {
public void setEndTime(Long endTime) {
this.endTime = endTime;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ public Long getTotalSize() {

public Long getTotalSizeByDate(Date from, Date to) {
return (Long) entityManager.createQuery("select count(sd.id) from SessionData as sd where sd.startTime between :from and :to")
.setParameter("from", from)
.setParameter("to", to)
.setParameter("from", from.getTime())
.setParameter("to", to.getTime())
.getSingleResult();
}

Expand All @@ -131,7 +131,7 @@ public Long getFirstPosition(Set<String> selectedIds) throws RuntimeException {
return 0L;
}

List<Date> startTimeList = (List<Date>) entityManager.createQuery("select ses.startTime from SessionData ses where ses.sessionId in " +
List<Long> startTimeList = (List<Long>) entityManager.createQuery("select ses.startTime from SessionData ses where ses.sessionId in " +
"(:sessionIds) order by ses.startTime asc")
.setMaxResults(1)
.setParameter("sessionIds", selectedIds).getResultList();
Expand All @@ -140,7 +140,7 @@ public Long getFirstPosition(Set<String> selectedIds) throws RuntimeException {
return 0L;
}

Date startTime = startTimeList.iterator().next();
Date startTime = new Date(startTimeList.iterator().next());

Long lastPosition = (Long) entityManager.createQuery("select count(ses.id) from SessionData ses where startTime<=:startTime")
.setParameter("startTime", startTime).getSingleResult();
Expand Down Expand Up @@ -239,8 +239,8 @@ public List<SessionDataDto> getByDatePeriod(int start, int length, Date from, Da
try {
List<SessionData> sessionDataList = (List<SessionData>)
entityManager.createQuery("select sd from SessionData as sd where sd.startTime between :from and :to order by sd.startTime asc")
.setParameter("from", from)
.setParameter("to", to)
.setParameter("from", from.getTime())
.setParameter("to", to.getTime())
.setFirstResult(start)
.setMaxResults(length)
.getResultList();
Expand Down Expand Up @@ -467,8 +467,8 @@ private SessionDataDto createSessionDataDto(SessionData sessionData, String user
return new SessionDataDto(
sessionData.getId(),
sessionData.getSessionId(),
sessionData.getStartTime(),
sessionData.getEndTime(),
new Date(sessionData.getStartTime()),
new Date(sessionData.getEndTime()),
sessionData.getActiveKernels(),
sessionData.getTaskExecuted(),
sessionData.getTaskFailed(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ public Map<Long, Map<String, TestInfoDto>> getTestInfoByTaskIds(Set<Long> taskId
String termination = (String) objects[3];
String sessionId = (String) objects[0];

Date startTime = (Date) objects[5];
Date endTime = (Date) objects[6];
Date startTime = new Date(((BigInteger) objects[5]).longValue());
Date endTime = new Date(((BigInteger) objects[6]).longValue());


Integer number = (Integer) objects[7];
Expand Down
2 changes: 1 addition & 1 deletion docker/compose/src/main/files/my.cnf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[mysqld]

#default_time_zone = "Europe/Moscow"
#default_time_zone = "UTC"
sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY"
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services:
ports:
- 8087:80
environment:
TZ: Europe/Moscow
TZ: UTC
JWC_HTTP_PORT: 80
JWC_JDBC_DRIVER: com.mysql.jdbc.Driver
# Specify here the existing results database
Expand Down
2 changes: 1 addition & 1 deletion docker/compose/src/main/resources/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ services:
depends_on:
- jagger-mysql
environment:
TZ: Europe/Moscow
TZ: UTC
JWC_HTTP_PORT: 80
JWC_JDBC_DRIVER: com.mysql.jdbc.Driver
JWC_JDBC_URL: jdbc:mysql://jagger-mysql:3306/jaggerdb
Expand Down
2 changes: 1 addition & 1 deletion docker/jagger/webclient/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ENV MYSQL_HOST mysql
ENV MYSQL_PORT 3306

# Set default timezone
ENV TZ=Europe/Moscow
ENV TZ=UTC

# Get latest jagger-webclient
ADD ["http://nexus.vm.griddynamics.net:8081/nexus/service/local/artifact/maven/content?r=jagger-snapshots&g=com.griddynamics.jagger&a=webclient&c=war-exec&v=${project.version}", "/com/griddynamics/jagger/jagger-webclient.jar"]
Expand Down