Return-Path: X-Original-To: apmail-brooklyn-commits-archive@minotaur.apache.org Delivered-To: apmail-brooklyn-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9468A105FA for ; Wed, 25 Jun 2014 15:06:14 +0000 (UTC) Received: (qmail 95946 invoked by uid 500); 25 Jun 2014 15:06:14 -0000 Delivered-To: apmail-brooklyn-commits-archive@brooklyn.apache.org Received: (qmail 95922 invoked by uid 500); 25 Jun 2014 15:06:14 -0000 Mailing-List: contact commits-help@brooklyn.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.incubator.apache.org Delivered-To: mailing list commits@brooklyn.incubator.apache.org Received: (qmail 95913 invoked by uid 99); 25 Jun 2014 15:06:14 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Jun 2014 15:06:14 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 25 Jun 2014 15:06:14 +0000 Received: (qmail 93445 invoked by uid 99); 25 Jun 2014 15:05:49 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Jun 2014 15:05:49 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id E89D393A950; Wed, 25 Jun 2014 15:05:48 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aledsage@apache.org To: commits@brooklyn.incubator.apache.org Date: Wed, 25 Jun 2014 15:05:50 -0000 Message-Id: In-Reply-To: <502c86d92dcf400f9118024e9b730867@git.apache.org> References: <502c86d92dcf400f9118024e9b730867@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [3/6] git commit: Convert GeoscalingScriptGeneratorTest from groovy to java X-Virus-Checked: Checked by ClamAV on apache.org Convert GeoscalingScriptGeneratorTest from groovy to java Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/c309976f Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/c309976f Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/c309976f Branch: refs/heads/master Commit: c309976f82a4de27a1424d3dc0e52c5d14e90f51 Parents: ace1124 Author: Aled Sage Authored: Tue Jun 17 23:02:05 2014 +0100 Committer: Aled Sage Committed: Wed Jun 18 10:25:46 2014 +0100 ---------------------------------------------------------------------- .../GeoscalingScriptGeneratorTest.groovy | 38 ------------------- .../GeoscalingScriptGeneratorTest.java | 40 ++++++++++++++++++++ 2 files changed, 40 insertions(+), 38 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c309976f/software/webapp/src/test/java/brooklyn/entity/dns/geoscaling/GeoscalingScriptGeneratorTest.groovy ---------------------------------------------------------------------- diff --git a/software/webapp/src/test/java/brooklyn/entity/dns/geoscaling/GeoscalingScriptGeneratorTest.groovy b/software/webapp/src/test/java/brooklyn/entity/dns/geoscaling/GeoscalingScriptGeneratorTest.groovy deleted file mode 100644 index d296ce8..0000000 --- a/software/webapp/src/test/java/brooklyn/entity/dns/geoscaling/GeoscalingScriptGeneratorTest.groovy +++ /dev/null @@ -1,38 +0,0 @@ -package brooklyn.entity.dns.geoscaling - -import static org.testng.AssertJUnit.* - -import java.util.LinkedHashSet -import java.util.Set - -import org.testng.annotations.Test - -import brooklyn.location.geo.HostGeoInfo -import brooklyn.util.ResourceUtils - - -/** - * {@link GeoscalingScriptGenerator} unit tests. - */ -class GeoscalingScriptGeneratorTest { - - private final static Set HOSTS = new LinkedHashSet(); - static { - HOSTS.add(new HostGeoInfo("1.2.3.100", "Server 1", 40.0, -80.0)); - HOSTS.add(new HostGeoInfo("1.2.3.101", "Server 2", 30.0, 20.0)); - } - - - @Test - public void testScriptGeneration() { - Date generationTime = new Date(0); - String generatedScript = GeoscalingScriptGenerator.generateScriptString(generationTime, HOSTS); - assertTrue(generatedScript.contains("1.2.3")); - String expectedScript = ResourceUtils.create(this).getResourceAsString("brooklyn/entity/dns/geoscaling/expectedScript.php"); - assertEquals(expectedScript, generatedScript); - //also make sure leading slash is allowed - String expectedScript2 = ResourceUtils.create(this).getResourceAsString("/brooklyn/entity/dns/geoscaling/expectedScript.php"); - assertEquals(expectedScript, generatedScript); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c309976f/software/webapp/src/test/java/brooklyn/entity/dns/geoscaling/GeoscalingScriptGeneratorTest.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/test/java/brooklyn/entity/dns/geoscaling/GeoscalingScriptGeneratorTest.java b/software/webapp/src/test/java/brooklyn/entity/dns/geoscaling/GeoscalingScriptGeneratorTest.java new file mode 100644 index 0000000..1d45152 --- /dev/null +++ b/software/webapp/src/test/java/brooklyn/entity/dns/geoscaling/GeoscalingScriptGeneratorTest.java @@ -0,0 +1,40 @@ +package brooklyn.entity.dns.geoscaling; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; + +import java.util.Date; +import java.util.LinkedHashSet; +import java.util.Set; + +import org.testng.annotations.Test; + +import brooklyn.location.geo.HostGeoInfo; +import brooklyn.util.ResourceUtils; + + +/** + * {@link GeoscalingScriptGenerator} unit tests. + */ +public class GeoscalingScriptGeneratorTest { + + private final static Set HOSTS = new LinkedHashSet(); + static { + HOSTS.add(new HostGeoInfo("1.2.3.100", "Server 1", 40.0, -80.0)); + HOSTS.add(new HostGeoInfo("1.2.3.101", "Server 2", 30.0, 20.0)); + } + + + @Test + public void testScriptGeneration() { + Date generationTime = new Date(0); + String generatedScript = GeoscalingScriptGenerator.generateScriptString(generationTime, HOSTS); + assertTrue(generatedScript.contains("1.2.3")); + String expectedScript = ResourceUtils.create(this).getResourceAsString("brooklyn/entity/dns/geoscaling/expectedScript.php"); + assertEquals(generatedScript, expectedScript); + //also make sure leading slash is allowed + String expectedScript2 = ResourceUtils.create(this).getResourceAsString("/brooklyn/entity/dns/geoscaling/expectedScript.php"); + assertEquals(generatedScript, expectedScript); + } + +}