aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2013-01-10 20:51:38 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2013-01-10 20:51:38 +0100
commit09d297a383b60cfdba6b6388cc54c9c8fa603e75 (patch)
tree38f2d131bcbb352717c6b7e65cb5fd397071239c /src/main/java/io
parent7838a06e5521db39aee8b3b87785fcb5e32cd7ad (diff)
downloadesper-testing-09d297a383b60cfdba6b6388cc54c9c8fa603e75.tar.gz
esper-testing-09d297a383b60cfdba6b6388cc54c9c8fa603e75.tar.bz2
esper-testing-09d297a383b60cfdba6b6388cc54c9c8fa603e75.tar.xz
esper-testing-09d297a383b60cfdba6b6388cc54c9c8fa603e75.zip
o Fixing another bug in the unbreakable poller, stored one build too many in some progress objects too.
o Got the logback.xml + system properties combination to finally work.
Diffstat (limited to 'src/main/java/io')
-rwxr-xr-xsrc/main/java/io/trygvis/esper/testing/Config.java12
-rw-r--r--src/main/java/io/trygvis/esper/testing/core/badge/UnbreakableBadgeProgress.java10
-rwxr-xr-xsrc/main/java/io/trygvis/esper/testing/core/jenkins/JenkinsBuildPoller.java17
3 files changed, 20 insertions, 19 deletions
diff --git a/src/main/java/io/trygvis/esper/testing/Config.java b/src/main/java/io/trygvis/esper/testing/Config.java
index 7da14fa..68c4f1a 100755
--- a/src/main/java/io/trygvis/esper/testing/Config.java
+++ b/src/main/java/io/trygvis/esper/testing/Config.java
@@ -70,9 +70,9 @@ public class Config {
}
public static Config loadFromDisk(String appName) throws IOException {
- initSystemProperties();
+ initSystemProperties(appName);
- initLogging(appName);
+ initLogging();
Properties properties = new Properties();
try (FileInputStream inputStream = new FileInputStream("etc/config.properties")) {
@@ -88,15 +88,15 @@ public class Config {
trimToNull(properties.getProperty("database.password")));
}
- private static void initSystemProperties() {
+ private static void initSystemProperties(String appName) {
// Java 7 is more strict on checking matching host names or something similar.
// http://docs.oracle.com/javase/7/docs/technotes/guides/security/jsse/JSSERefGuide.html#Customization
System.setProperty("jsse.enableSNIExtension", "false");
- }
- private static void initLogging(String appName) {
- System.setProperty("logging.app", appName);
+ System.setProperty("loggingApp", appName);
+ }
+ private static void initLogging() {
File logs = new File("logs");
if(!logs.isDirectory()) {
diff --git a/src/main/java/io/trygvis/esper/testing/core/badge/UnbreakableBadgeProgress.java b/src/main/java/io/trygvis/esper/testing/core/badge/UnbreakableBadgeProgress.java
index f43ec94..209cc81 100644
--- a/src/main/java/io/trygvis/esper/testing/core/badge/UnbreakableBadgeProgress.java
+++ b/src/main/java/io/trygvis/esper/testing/core/badge/UnbreakableBadgeProgress.java
@@ -4,7 +4,6 @@ import static fj.P.*;
import fj.*;
import fj.data.*;
import static fj.data.Option.*;
-import static java.util.Collections.singletonList;
import io.trygvis.esper.testing.*;
import io.trygvis.esper.testing.core.db.*;
@@ -42,17 +41,16 @@ public class UnbreakableBadgeProgress extends BadgeProgress {
List<UUID> builds = new ArrayList<>(this.builds);
builds.add(build.uuid);
- if (progression() == UnbreakableBadge.LEVEL_3_COUNT) {
+ if (builds.size() == UnbreakableBadge.LEVEL_3_COUNT) {
// You have to start from scratch now.
- builds = singletonList(build.uuid);
- return p(new UnbreakableBadgeProgress(person, builds), some(new UnbreakableBadge(person, 3, builds)));
+ return p(new UnbreakableBadgeProgress(person, Collections.<UUID>emptyList()), some(new UnbreakableBadge(person, 3, builds)));
}
- if (progression() == UnbreakableBadge.LEVEL_2_COUNT) {
+ if (builds.size() == UnbreakableBadge.LEVEL_2_COUNT) {
return p(new UnbreakableBadgeProgress(person, builds), some(new UnbreakableBadge(person, 2, builds)));
}
- if (progression() == UnbreakableBadge.LEVEL_1_COUNT) {
+ if (builds.size() == UnbreakableBadge.LEVEL_1_COUNT) {
return p(new UnbreakableBadgeProgress(person, builds), some(new UnbreakableBadge(person, 1, builds)));
}
diff --git a/src/main/java/io/trygvis/esper/testing/core/jenkins/JenkinsBuildPoller.java b/src/main/java/io/trygvis/esper/testing/core/jenkins/JenkinsBuildPoller.java
index 6a7e1b4..f06b4e6 100755
--- a/src/main/java/io/trygvis/esper/testing/core/jenkins/JenkinsBuildPoller.java
+++ b/src/main/java/io/trygvis/esper/testing/core/jenkins/JenkinsBuildPoller.java
@@ -27,14 +27,14 @@ public class JenkinsBuildPoller implements TablePoller.NewRowCallback<JenkinsBui
private final XmlParser xmlParser = new XmlParser();
public static void main(String[] args) throws Exception {
+ Config config = loadFromDisk("jenkins-build-poller");
+
String pollerName = "jenkins_build";
String tableName = "jenkins_build";
String columnNames = JenkinsDao.JENKINS_BUILD;
SqlF<ResultSet, JenkinsBuildDto> f = JenkinsDao.jenkinsBuild;
TablePoller.NewRowCallback<JenkinsBuildDto> callback = new JenkinsBuildPoller();
- Config config = loadFromDisk("jenkins-build-poller");
-
BoneCPDataSource dataSource = config.createBoneCp();
new TablePoller<>(pollerName, tableName, columnNames, some("array_length(users, 1) > 0"), f, callback).work(dataSource);
@@ -44,6 +44,8 @@ public class JenkinsBuildPoller implements TablePoller.NewRowCallback<JenkinsBui
Daos daos = new Daos(c);
final BuildDao buildDao = daos.buildDao;
+ logger.info("Processing Jenkins Build uuid={}", jenkinsBuild.uuid);
+
JenkinsJobDto jobDto = daos.jenkinsDao.selectJob(jenkinsBuild.job).get();
SqlOption<InputStream> jobXmlFileO = daos.fileDao.load(jobDto.file);
@@ -87,6 +89,8 @@ public class JenkinsBuildPoller implements TablePoller.NewRowCallback<JenkinsBui
final JenkinsBuildXml jenkinsBuildXml = o.some();
+ logger.info("Build details: number={}, url={}", jenkinsBuildXml.number, jenkinsBuildXml.url);
+
SqlOption<UUID> uuidBuildO = buildDao.findBuildByReference(jenkinsBuild.toRef());
UUID uuidBuild = uuidBuildO.getOrElse(new SqlP0<UUID>() {
@@ -116,13 +120,12 @@ public class JenkinsBuildPoller implements TablePoller.NewRowCallback<JenkinsBui
Uuid person = personO.get().uuid;
- if (!insertedParticipants.add(person)) {
+ if (insertedParticipants.add(person)) {
+ logger.info("Created build participant, person={}", person);
+ buildDao.insertBuildParticipant(uuidBuild, person);
+ } else {
logger.info("Participant already inserted, person={}", person);
- continue;
}
-
- logger.info("Created build participant, person={}", person);
- buildDao.insertBuildParticipant(uuidBuild, person);
}
logger.info("Created build uuid={}, #participants={}, #knownPersons={}, #unknonwnPersons={}", uuidBuild,