Skip to content

Commit

Permalink
preparing pull request related for migration to java8
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimir.bukhtoyarov committed Aug 17, 2016
1 parent 0986025 commit 403ec09
Show file tree
Hide file tree
Showing 45 changed files with 149 additions and 82 deletions.
41 changes: 41 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
### Eclipse template
*.pydevproject
.metadata
.gradle
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath

# Eclipse Core
.project

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# CDT-specific
.cproject

# JDT-specific (Eclipse Java Development Tools)
.classpath

# Java annotation processor (APT)
.factorypath

# PDT-specific
.buildpath

# sbteclipse plugin
.target

# TeXlipse plugin
.texlipse

/*.iml
/*.ipr
/*.iws
Expand Down
2 changes: 1 addition & 1 deletion archetype-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>com.griddynamics.jagger</groupId>
<artifactId>parent</artifactId>
<version>1.2.6-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
</parent>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
Expand Down
2 changes: 1 addition & 1 deletion archetype/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>com.griddynamics.jagger</groupId>
<artifactId>parent</artifactId>
<version>1.2.6-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
</parent>

<build>
Expand Down
4 changes: 2 additions & 2 deletions archetype/src/main/resources/archetype-resources/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd">
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.2.xsd">

<bean class="com.griddynamics.jagger.util.PropertiesResolver">
<property name="registry" ref="propertiesResolverRegistry"/>
Expand Down Expand Up @@ -86,7 +86,7 @@
<property name="extensions">
<map merge="true">
<entry key="sessionComparison">
<ref local="defaultOverallSessionComparisonReporter"/>
<ref bean="defaultOverallSessionComparisonReporter"/>
</entry>

<entry key="sessionSummary">
Expand Down
4 changes: 2 additions & 2 deletions chassis/configuration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<parent>
<groupId>com.griddynamics.jagger</groupId>
<artifactId>chassis.parent</artifactId>
<version>1.2.6-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -124,7 +124,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<version>3.3</version>
<configuration>
<target>${jagger.targetJdkVersion}</target>
<source>${jagger.targetJdkVersion}</source>
Expand Down
2 changes: 1 addition & 1 deletion chassis/coordinator.http/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<parent>
<groupId>com.griddynamics.jagger</groupId>
<artifactId>chassis.parent</artifactId>
<version>1.2.6-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion chassis/coordinator.zookeeper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<parent>
<groupId>com.griddynamics.jagger</groupId>
<artifactId>chassis.parent</artifactId>
<version>1.2.6-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion chassis/coordinator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<parent>
<groupId>com.griddynamics.jagger</groupId>
<artifactId>chassis.parent</artifactId>
<version>1.2.6-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
14 changes: 7 additions & 7 deletions chassis/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<parent>
<groupId>com.griddynamics.jagger</groupId>
<artifactId>chassis.parent</artifactId>
<version>1.2.6-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -135,6 +135,12 @@
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<exclusions>
<exclusion>
<groupId>asm</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down Expand Up @@ -188,12 +194,6 @@
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ private Map<String, List<SysUnderTestDTO>> loadData() {

//todo JFG-722 We should delete all queries from reporting-part jagger
@SuppressWarnings("unchecked")
List<ProfilingSuT> profilingSuTListFull =
getHibernateTemplate().find("from ProfilingSuT where sessionId=? and taskData_id is not null order by taskData, sysUnderTestUrl", sessionId);
List<ProfilingSuT> profilingSuTListFull = (List<ProfilingSuT>) getHibernateTemplate()
.find("from ProfilingSuT where sessionId=? and taskData_id is not null order by taskData, sysUnderTestUrl", sessionId);

for (ProfilingSuT profilingSuT : profilingSuTListFull) {
String taskId = profilingSuT.getTaskData().getTaskId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.hibernate.HibernateException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import java.util.Collection;
Expand Down Expand Up @@ -154,26 +155,26 @@ private void persistData(String sessionId, String taskId, Task task) {
}

public void persistTags(String sessionId, SessionMetaDataStorage metaDataStorage) {

HibernateTemplate hibernateTemplate = getHibernateTemplate();
for (TagEntity tagEntity : metaDataStorage.getTagsForSaveOrUpdate()) {
try {
getHibernateTemplate().saveOrUpdate(tagEntity);
hibernateTemplate.saveOrUpdate(tagEntity);
} catch (HibernateException e) {
log.error("Cannot add new tag", e);
}
}

if (!metaDataStorage.getSessionTags().isEmpty()) {
Set<TagEntity> sessionTagList = new HashSet<TagEntity>();
sessionTagList.addAll(getHibernateTemplate().findByNamedParam("select tags from TagEntity as tags " +
sessionTagList.addAll((Collection<? extends TagEntity>) hibernateTemplate.findByNamedParam("select tags from TagEntity as tags " +
"where tags.name in (:sTagsName)", "sTagsName", metaDataStorage.getSessionTags()));

if (!sessionTagList.isEmpty()) {
List<SessionData> sessionsById = getHibernateTemplate().find("from SessionData s where s.sessionId=?", sessionId);
List<SessionData> sessionsById = (List<SessionData>) hibernateTemplate.find("from SessionData s where s.sessionId=?", sessionId);
if (sessionsById.size()==1)
for (SessionData sessionData : sessionsById) {
sessionData.setTags(sessionTagList);
getHibernateTemplate().saveOrUpdate(sessionData);
hibernateTemplate.saveOrUpdate(sessionData);
}
else
log.error("Must be one session's id which is equals {}, but got {} ids",sessionId,sessionsById.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public void setKeyValueStorage(KeyValueStorage keyValueStorage) {
}

private WorkloadDetails getScenarioData(WorkloadTask workloadTask) {
List<WorkloadDetails> all = getHibernateTemplate().find(
List<WorkloadDetails> all = (List<WorkloadDetails>) getHibernateTemplate().find(
"from WorkloadDetails s where s.name=? and s.version=? and s.description=?", workloadTask.getName(), workloadTask.getVersion(), workloadTask.getDescription());

if (all.size() > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public JRDataSource getDataSource() {
// Errors during session execution
Decision sessionExecutionStatus = Decision.OK;
String errorMessage = "";
List<SessionData> sessionData = getHibernateTemplate().find("from SessionData d where d.sessionId=?",
List<SessionData> sessionData = (List<SessionData>) getHibernateTemplate().find("from SessionData d where d.sessionId=?",
getSessionIdProvider().getSessionId());
if (sessionData.size() == 1) {
errorMessage = sessionData.get(0).getErrorMessage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ public class SessionSummaryReporter extends AbstractReportProvider {
public JRDataSource getDataSource() {
String sessionId = getSessionIdProvider().getSessionId();
@SuppressWarnings("unchecked")
List<SessionData> all = getHibernateTemplate().find("from SessionData sd where sd.sessionId=?",
sessionId);
List<SessionData> all = (List<SessionData>) getHibernateTemplate().find("from SessionData sd where sd.sessionId=?", sessionId);

if (all.size() > 1) {
throw new IllegalStateException("To much session data was stored for the session " + sessionId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public MonitoringSummary load(String sessionId, String taskId) {
@SuppressWarnings("unchecked")
private List<MonitoringStatistics> loadMonitoringStatistics(String sessionId, String taskId) {
// todo [mairbek] review this query
return getHibernateTemplate().find(
return (List<MonitoringStatistics>) getHibernateTemplate().find(
"select ms from MonitoringStatistics ms where ms.sessionId =? and ms.taskData.taskId = ?", sessionId, taskId
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private boolean areComparable(PerformedMonitoring current, PerformedMonitoring b

@SuppressWarnings("unchecked")
private List<PerformedMonitoring> loadPerformedMonitoring(String sessionId) {
return getHibernateTemplate().find("from PerformedMonitoring where sessionId = ?", sessionId);
return (List<PerformedMonitoring>) getHibernateTemplate().find("from PerformedMonitoring where sessionId = ?", sessionId);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public FlushingWorker(Worker worker) {
new Function<CommandExecutor<?, ?>, CommandExecutor<?, ?>>() {
@Override
public CommandExecutor<?, ?> apply(CommandExecutor<?, ?> input) {
return FlushingCommandExecutor.create(input);
Object flushingCommandExecutor = FlushingCommandExecutor.create(input);
return (CommandExecutor<?, ?>) flushingCommandExecutor;
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import java.util.List;

import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.griddynamics.jagger.exception.TechnicalException;
Expand Down Expand Up @@ -65,7 +66,8 @@ public void setSessionComment(String sessionComment) {

@SuppressWarnings("unchecked")
private Session loadLastSession() {
List<Session> sessions = getHibernateTemplate().find("from Session s order by s.id desc");
HibernateTemplate hibernateTemplate = getHibernateTemplate();
List<Session> sessions = (List<Session>) hibernateTemplate.find("from Session s order by s.id desc");

if (sessions.isEmpty()) {
throw new TechnicalException("No session detected");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private void checkMetricDetailsIndex(){

//try to get the last MetricDetails entity
try{
maxMetricId = getHibernateTemplate().findByCriteria(DetachedCriteria.forClass(MetricDetails.class)
maxMetricId = (List<Long>) getHibernateTemplate().findByCriteria(DetachedCriteria.forClass(MetricDetails.class)
.setProjection(Projections.max("id")));
}catch (Exception ex){
log.debug("Database is new, use annotation @TableGenerator to create IdGenerator table");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected void loadMonitoringMap() {
}

String sessionId = getSessionIdProvider().getSessionId();
List<PerformedMonitoring> list = getHibernateTemplate().find("select pf from PerformedMonitoring pf where pf.sessionId =? and pf.parentId is not null", sessionId);
List<PerformedMonitoring> list = (List<PerformedMonitoring>) getHibernateTemplate().find("select pf from PerformedMonitoring pf where pf.sessionId =? and pf.parentId is not null", sessionId);
Map<String, String> result = Maps.newHashMap();

for (PerformedMonitoring performedMonitoring : list) {
Expand All @@ -65,7 +65,7 @@ protected String relatedMonitoringTask(String taskId) {

protected String parentOf(String workloadTaskId) {
String sessionId = getSessionIdProvider().getSessionId();
List<WorkloadData> list = getHibernateTemplate().find("select wd from WorkloadData wd where wd.sessionId =? and wd.taskId =? and wd.parentId is not null", sessionId, workloadTaskId);
List<WorkloadData> list = (List<WorkloadData>) getHibernateTemplate().find("select wd from WorkloadData wd where wd.sessionId =? and wd.taskId =? and wd.parentId is not null", sessionId, workloadTaskId);

if (list.size() == 1) {
return list.get(0).getParentId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ public void deleteAll() {
@SuppressWarnings("unchecked")
@Override
public Object fetch(Namespace namespace, String key) {
List<KeyValue> values = getHibernateTemplate().find("from KeyValue kv where kv.namespace = ? and kv.key = ?",
namespace.toString(), key);
List<KeyValue> values = (List<KeyValue>) getHibernateTemplate()
.find("from KeyValue kv where kv.namespace = ? and kv.key = ?", namespace.toString(), key);
if (values.isEmpty()) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import org.apache.commons.dbcp.BasicDataSource;

import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.logging.Logger;

/**
* @author Artem Zhdanov <[email protected]>
Expand Down Expand Up @@ -32,4 +34,9 @@ public <T> T unwrap(final Class<T> iface) throws SQLException {
public boolean isWrapperFor(final Class<?> iface) throws SQLException {
throw new UnsupportedOperationException("Is not implemented by org.apache.commons.dbcp.BasicDataSource so we will not implement it either");
}

@Override
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
throw new SQLFeatureNotSupportedException();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import javax.xml.validation.Validator;
import java.io.File;
import java.io.IOException;
import java.net.URL;


public class ReportingServiceTest {
Expand Down Expand Up @@ -87,7 +88,9 @@ public void checkXML() throws SAXException, IOException {
Source xmlFile = new StreamSource(new File("result.xml"));
SchemaFactory schemaFactory = SchemaFactory
.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = schemaFactory.newSchema(new File("src/test/resources/reporting/test-xml-report.xsd"));

URL reportUrl = getClass().getResource("/reporting/test-xml-report.xsd");
Schema schema = schemaFactory.newSchema(reportUrl);
Validator validator = schema.newValidator();
validator.validate(xmlFile);
assertTrue(new File("result.xml").delete());
Expand Down
3 changes: 2 additions & 1 deletion chassis/core/src/test/resources/spring/test-reporting.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop>
Expand Down
Loading

0 comments on commit 403ec09

Please sign in to comment.