From 09d297a383b60cfdba6b6388cc54c9c8fa603e75 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Thu, 10 Jan 2013 20:51:38 +0100 Subject: 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. --- src/main/java/io/trygvis/esper/testing/Config.java | 12 ++++++------ .../testing/core/badge/UnbreakableBadgeProgress.java | 10 ++++------ .../esper/testing/core/jenkins/JenkinsBuildPoller.java | 17 ++++++++++------- 3 files changed, 20 insertions(+), 19 deletions(-) (limited to 'src/main/java') 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 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.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 f = JenkinsDao.jenkinsBuild; TablePoller.NewRowCallback 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 jobXmlFileO = daos.fileDao.load(jobDto.file); @@ -87,6 +89,8 @@ public class JenkinsBuildPoller implements TablePoller.NewRowCallback uuidBuildO = buildDao.findBuildByReference(jenkinsBuild.toRef()); UUID uuidBuild = uuidBuildO.getOrElse(new SqlP0() { @@ -116,13 +120,12 @@ public class JenkinsBuildPoller implements TablePoller.NewRowCallback