[jboss-svn-commits] JBL Code SVN: r35593 - in labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src: main/java/org/jboss/community/sbs/plugin/reports/monthly/config and 3 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Oct 20 07:57:48 EDT 2010


Author: velias
Date: 2010-10-20 07:57:47 -0400 (Wed, 20 Oct 2010)
New Revision: 35593

Added:
   labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/java/org/jboss/community/sbs/plugin/reports/monthly/config/FishEyeRepositoryConfigTest.java
   labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/java/org/jboss/community/sbs/plugin/reports/monthly/config/SystemDataConfigFISHEYETest.java
   labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/java/org/jboss/community/sbs/plugin/reports/monthly/config/SystemDataConfigJIRATest.java
   labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/java/org/jboss/community/sbs/plugin/reports/monthly/config/SystemDataConfigSBSTest.java
Modified:
   labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/main/java/org/jboss/community/sbs/plugin/reports/monthly/aggregator/SBSAggregator.java
   labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/main/java/org/jboss/community/sbs/plugin/reports/monthly/config/FishEyeRepositoryConfig.java
   labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/main/java/org/jboss/community/sbs/plugin/reports/monthly/config/SystemDataConfigFISHEYE.java
   labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/main/java/org/jboss/community/sbs/plugin/reports/monthly/config/SystemDataConfigSBS.java
   labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/java/org/jboss/community/sbs/plugin/reports/monthly/aggregator/SBSAggregatorTest.java
   labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/java/org/jboss/community/sbs/plugin/reports/monthly/config/ReportConfigParserTest.java
   labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/resources/monthly_report_config.xml
Log:
SBS space id is now converted to Long during configuration reading

Modified: labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/main/java/org/jboss/community/sbs/plugin/reports/monthly/aggregator/SBSAggregator.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/main/java/org/jboss/community/sbs/plugin/reports/monthly/aggregator/SBSAggregator.java	2010-10-20 11:52:35 UTC (rev 35592)
+++ labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/main/java/org/jboss/community/sbs/plugin/reports/monthly/aggregator/SBSAggregator.java	2010-10-20 11:57:47 UTC (rev 35593)
@@ -40,8 +40,8 @@
 
   @Override
   public String[] getReportValues(SystemDataConfigSBS config) {
-    List<String> devSpacesList = (config != null ? config.getDevSpaces() : null);
-    List<String> userSpacesList = (config != null ? config.getUserSpaces() : null);
+    List<Long> devSpacesList = (config != null ? config.getDevSpaces() : null);
+    List<Long> userSpacesList = (config != null ? config.getUserSpaces() : null);
 
     String[] ret = AggregatorUtils.createFilledArray(ARRAY_LEN, VALUE_NOT_AVAILABLE);
 
@@ -77,7 +77,7 @@
    * @return summed value. Return {@link Aggregator#VALUE_NOT_AVAILABLE} if input spaces list is empty.
    * 
    */
-  protected String getReportValue(SBSValueType valueType, List<String> spaces) {
+  protected String getReportValue(SBSValueType valueType, List<Long> spaces) {
     return getReportValue(valueType, spaces, null);
   }
 
@@ -90,7 +90,7 @@
    * @return summed value. Return {@link Aggregator#VALUE_NOT_AVAILABLE} if both input spaces lists are empty.
    * 
    */
-  protected String getReportValue(SBSValueType valueType, List<String> spaces1, List<String> spaces2) {
+  protected String getReportValue(SBSValueType valueType, List<Long> spaces1, List<Long> spaces2) {
 
     if (AggregatorUtils.isEmptyList(spaces1) && AggregatorUtils.isEmptyList(spaces2)) {
       return VALUE_NOT_AVAILABLE;
@@ -99,16 +99,14 @@
     long ret = 0;
     SBSValueKey key = new SBSValueKey(valueType);
     if (!AggregatorUtils.isEmptyList(spaces1)) {
-      for (String s : spaces1) {
-        // TODO move this conversion to configuration parsing
-        key.setSpaceId(Long.parseLong(s));
+      for (Long s : spaces1) {
+        key.setSpaceId(s);
         ret += AggregatorUtils.getLongValueFromFirstItem(valueSource.getValues(key));
       }
     }
     if (!AggregatorUtils.isEmptyList(spaces2)) {
-      for (String s : spaces2) {
-        // TODO move this conversion to configuration parsing
-        key.setSpaceId(Long.parseLong(s));
+      for (Long s : spaces2) {
+        key.setSpaceId(s);
         ret += AggregatorUtils.getLongValueFromFirstItem(valueSource.getValues(key));
       }
     }

Modified: labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/main/java/org/jboss/community/sbs/plugin/reports/monthly/config/FishEyeRepositoryConfig.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/main/java/org/jboss/community/sbs/plugin/reports/monthly/config/FishEyeRepositoryConfig.java	2010-10-20 11:52:35 UTC (rev 35592)
+++ labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/main/java/org/jboss/community/sbs/plugin/reports/monthly/config/FishEyeRepositoryConfig.java	2010-10-20 11:57:47 UTC (rev 35593)
@@ -31,7 +31,7 @@
    * @param name repository name
    */
   public FishEyeRepositoryConfig(String name) {
-    this.name = name;
+    setName(name);
   }
 
   /**
@@ -49,7 +49,11 @@
    * @param name the new name of FE repository
    */
   public void setName(String name) {
-    this.name = StringUtils.trimToNull(name);
+    name = StringUtils.trimToNull(name);
+    if (name == null) {
+      throw new IllegalArgumentException("FISHEYE repository name can't be empty");
+    }
+    this.name = name;
   }
 
   /**

Modified: labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/main/java/org/jboss/community/sbs/plugin/reports/monthly/config/SystemDataConfigFISHEYE.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/main/java/org/jboss/community/sbs/plugin/reports/monthly/config/SystemDataConfigFISHEYE.java	2010-10-20 11:52:35 UTC (rev 35592)
+++ labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/main/java/org/jboss/community/sbs/plugin/reports/monthly/config/SystemDataConfigFISHEYE.java	2010-10-20 11:57:47 UTC (rev 35593)
@@ -37,6 +37,11 @@
    * @param repo the repository configuration to add
    */
   public void addRepository(FishEyeRepositoryConfig repo) {
+    if (repo == null)
+      return;
+    if (repo.getName() == null) {
+      throw new IllegalArgumentException("FISHEYE repository name can't be empty");
+    }
     if (repositories == null) {
       repositories = new ArrayList<FishEyeRepositoryConfig>();
     }

Modified: labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/main/java/org/jboss/community/sbs/plugin/reports/monthly/config/SystemDataConfigSBS.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/main/java/org/jboss/community/sbs/plugin/reports/monthly/config/SystemDataConfigSBS.java	2010-10-20 11:52:35 UTC (rev 35592)
+++ labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/main/java/org/jboss/community/sbs/plugin/reports/monthly/config/SystemDataConfigSBS.java	2010-10-20 11:57:47 UTC (rev 35593)
@@ -15,12 +15,12 @@
   /**
    * List of identifiers of USER spaces to obtain data from. SBS Space identifier is number.
    */
-  private List<String> userSpaces;
+  private List<Long> userSpaces;
 
   /**
    * List of identifiers of DEV spaces to obtain data from. SBS Space identifier is number.
    */
-  private List<String> devSpaces;
+  private List<Long> devSpaces;
 
   /**
    * Constructor.
@@ -34,7 +34,7 @@
    * 
    * @return the list of identifiers of USER spaces to obtain data from
    */
-  public List<String> getUserSpaces() {
+  public List<Long> getUserSpaces() {
     return userSpaces;
   }
 
@@ -43,7 +43,7 @@
    * 
    * @return the list of identifiers of DEV spaces to obtain data from
    */
-  public List<String> getDevSpaces() {
+  public List<Long> getDevSpaces() {
     return devSpaces;
   }
 
@@ -58,9 +58,13 @@
       return;
 
     if (userSpaces == null) {
-      userSpaces = new ArrayList<String>();
+      userSpaces = new ArrayList<Long>();
     }
-    userSpaces.add(spaceId);
+    try {
+      userSpaces.add(Long.parseLong(spaceId));
+    } catch (NumberFormatException e) {
+      throw new IllegalArgumentException("SBS USER space identifier must be number");
+    }
   }
 
   /**
@@ -74,9 +78,13 @@
       return;
 
     if (devSpaces == null) {
-      devSpaces = new ArrayList<String>();
+      devSpaces = new ArrayList<Long>();
     }
-    devSpaces.add(spaceId);
+    try {
+      devSpaces.add(Long.parseLong(spaceId));
+    } catch (NumberFormatException e) {
+      throw new IllegalArgumentException("SBS DEV space identifier must be number");
+    }
   }
 
 }

Modified: labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/java/org/jboss/community/sbs/plugin/reports/monthly/aggregator/SBSAggregatorTest.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/java/org/jboss/community/sbs/plugin/reports/monthly/aggregator/SBSAggregatorTest.java	2010-10-20 11:52:35 UTC (rev 35592)
+++ labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/java/org/jboss/community/sbs/plugin/reports/monthly/aggregator/SBSAggregatorTest.java	2010-10-20 11:57:47 UTC (rev 35593)
@@ -94,16 +94,16 @@
     String val = tested.getReportValue(testedType, null);
     Assert.assertEquals(Aggregator.VALUE_NOT_AVAILABLE, val);
 
-    List<String> spaces = new ArrayList<String>();
+    List<Long> spaces = new ArrayList<Long>();
     val = tested.getReportValue(testedType, spaces);
     Assert.assertEquals(Aggregator.VALUE_NOT_AVAILABLE, val);
 
-    spaces.add("1111");
+    spaces.add(1111l);
     val = tested.getReportValue(testedType, spaces);
     Assert.assertEquals(expectedValue(testedType, spaces), val);
 
-    spaces.add("1112");
-    spaces.add("1113");
+    spaces.add(1112l);
+    spaces.add(1113l);
     val = tested.getReportValue(testedType, spaces);
     Assert.assertEquals(expectedValue(testedType, spaces), val);
 
@@ -119,17 +119,17 @@
     String val = tested.getReportValue(testedType, null, null);
     Assert.assertEquals(Aggregator.VALUE_NOT_AVAILABLE, val);
 
-    List<String> spaces1 = new ArrayList<String>();
+    List<Long> spaces1 = new ArrayList<Long>();
     val = tested.getReportValue(testedType, spaces1, null);
     Assert.assertEquals(Aggregator.VALUE_NOT_AVAILABLE, val);
     val = tested.getReportValue(testedType, null, spaces1);
     Assert.assertEquals(Aggregator.VALUE_NOT_AVAILABLE, val);
 
-    List<String> spaces2 = new ArrayList<String>();
+    List<Long> spaces2 = new ArrayList<Long>();
     val = tested.getReportValue(testedType, spaces1, spaces2);
     Assert.assertEquals(Aggregator.VALUE_NOT_AVAILABLE, val);
 
-    spaces1.add("1111");
+    spaces1.add(1111l);
     val = tested.getReportValue(testedType, spaces1, null);
     Assert.assertEquals(expectedValue(testedType, spaces1), val);
     val = tested.getReportValue(testedType, null, spaces1);
@@ -139,8 +139,8 @@
     val = tested.getReportValue(testedType, spaces2, spaces1);
     Assert.assertEquals(expectedValue(testedType, spaces1), val);
 
-    spaces1.add("1112");
-    spaces1.add("1113");
+    spaces1.add(1112l);
+    spaces1.add(1113l);
     val = tested.getReportValue(testedType, spaces1, null);
     Assert.assertEquals(expectedValue(testedType, spaces1), val);
     val = tested.getReportValue(testedType, null, spaces1);
@@ -150,10 +150,10 @@
     val = tested.getReportValue(testedType, spaces2, spaces1);
     Assert.assertEquals(expectedValue(testedType, spaces1), val);
 
-    spaces2.add("2112");
-    spaces2.add("2113");
+    spaces2.add(2112l);
+    spaces2.add(2113l);
     val = tested.getReportValue(testedType, spaces1, spaces2);
-    List<String> ret = new ArrayList<String>();
+    List<Long> ret = new ArrayList<Long>();
     ret.addAll(spaces1);
     ret.addAll(spaces2);
     Assert.assertEquals(expectedValue(testedType, ret), val);
@@ -188,15 +188,15 @@
    * @param spaces
    * @return expected value
    */
-  protected String expectedValue(SBSValueType testedType, List<String> spaces) {
+  protected String expectedValue(SBSValueType testedType, List<Long> spaces) {
     SBSValueKey key = new SBSValueKey(testedType);
     if (AggregatorUtils.isEmptyList(spaces)) {
       return Aggregator.VALUE_NOT_AVAILABLE;
     }
 
     long ret = 0;
-    for (String s : spaces) {
-      key.setSpaceId(Long.parseLong(s));
+    for (Long s : spaces) {
+      key.setSpaceId(s);
       ret += getMockValueForKey(key);
     }
     return ret + "";
@@ -209,9 +209,9 @@
    * @param devSpaces list of identifiers of developer Spaces used to generate report
    * @param userSpaces list of identifiers of user Spaces used to generate report
    */
-  protected void assertReportValues(String[] values, List<String> devSpaces, List<String> userSpaces) {
+  protected void assertReportValues(String[] values, List<Long> devSpaces, List<Long> userSpaces) {
 
-    List<String> allSpaces = new ArrayList<String>();
+    List<Long> allSpaces = new ArrayList<Long>();
     if (devSpaces != null)
       allSpaces.addAll(devSpaces);
     if (userSpaces != null)

Added: labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/java/org/jboss/community/sbs/plugin/reports/monthly/config/FishEyeRepositoryConfigTest.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/java/org/jboss/community/sbs/plugin/reports/monthly/config/FishEyeRepositoryConfigTest.java	                        (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/java/org/jboss/community/sbs/plugin/reports/monthly/config/FishEyeRepositoryConfigTest.java	2010-10-20 11:57:47 UTC (rev 35593)
@@ -0,0 +1,101 @@
+package org.jboss.community.sbs.plugin.reports.monthly.config;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Unit test for {@link FishEyeRepositoryConfig}.
+ * 
+ * @author Vlastimil Elias (velias at redhat dot com)
+ */
+public class FishEyeRepositoryConfigTest {
+
+  @Test
+  public void setName() {
+    FishEyeRepositoryConfig tested = new FishEyeRepositoryConfig();
+
+    try {
+      tested.setName(null);
+      Assert.fail("IllegalArgumentException not thrown");
+    } catch (IllegalArgumentException e) {
+      Assert.assertNull(tested.getName());
+    }
+
+    try {
+      tested.setName("");
+      Assert.fail("IllegalArgumentException not thrown");
+    } catch (IllegalArgumentException e) {
+      Assert.assertNull(tested.getName());
+    }
+
+    try {
+      tested.setName(" ");
+      Assert.fail("IllegalArgumentException not thrown");
+    } catch (IllegalArgumentException e) {
+      Assert.assertNull(tested.getName());
+    }
+
+    tested.setName("REPO");
+    Assert.assertEquals("REPO", tested.getName());
+
+    // trim test
+    tested.setName("REPO ");
+    Assert.assertEquals("REPO", tested.getName());
+  }
+
+  @Test
+  public void setPath() {
+    FishEyeRepositoryConfig tested = new FishEyeRepositoryConfig();
+
+    tested.setPath(null);
+    Assert.assertNull(tested.getPath());
+
+    tested.setPath("");
+    Assert.assertNull(tested.getPath());
+
+    tested.setPath(" ");
+    Assert.assertNull(tested.getPath());
+
+    tested.setPath("/dir/e");
+    Assert.assertEquals("/dir/e", tested.getPath());
+
+    // trim test
+    tested.setPath("/dir/e ");
+    Assert.assertEquals("/dir/e", tested.getPath());
+
+  }
+
+  @Test
+  public void constructor_1() {
+    FishEyeRepositoryConfig tested = null;
+
+    try {
+      tested = new FishEyeRepositoryConfig(null);
+      Assert.fail("IllegalArgumentException not thrown");
+    } catch (IllegalArgumentException e) {
+
+    }
+
+    try {
+      tested = new FishEyeRepositoryConfig("");
+      Assert.fail("IllegalArgumentException not thrown");
+    } catch (IllegalArgumentException e) {
+
+    }
+
+    try {
+      tested = new FishEyeRepositoryConfig(" ");
+      Assert.fail("IllegalArgumentException not thrown");
+    } catch (IllegalArgumentException e) {
+
+    }
+
+    tested = new FishEyeRepositoryConfig("REPO");
+    Assert.assertEquals("REPO", tested.getName());
+
+    // trim test
+    tested = new FishEyeRepositoryConfig("REPO ");
+    Assert.assertEquals("REPO", tested.getName());
+  }
+
+}

Modified: labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/java/org/jboss/community/sbs/plugin/reports/monthly/config/ReportConfigParserTest.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/java/org/jboss/community/sbs/plugin/reports/monthly/config/ReportConfigParserTest.java	2010-10-20 11:52:35 UTC (rev 35592)
+++ labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/java/org/jboss/community/sbs/plugin/reports/monthly/config/ReportConfigParserTest.java	2010-10-20 11:57:47 UTC (rev 35593)
@@ -3,12 +3,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 
-import org.jboss.community.sbs.plugin.reports.monthly.config.ReportConfig;
-import org.jboss.community.sbs.plugin.reports.monthly.config.ReportConfigParser;
-import org.jboss.community.sbs.plugin.reports.monthly.config.SystemDataConfigFISHEYE;
-import org.jboss.community.sbs.plugin.reports.monthly.config.SystemDataConfigJIRA;
-import org.jboss.community.sbs.plugin.reports.monthly.config.SystemDataConfigSBS;
-import org.jboss.community.sbs.plugin.reports.monthly.config.SystemId;
 import org.junit.Assert;
 import org.junit.Test;
 import org.xml.sax.SAXException;
@@ -71,22 +65,22 @@
     SystemDataConfigSBS jc = (SystemDataConfigSBS) c.getProjects().get(0).getSystemDataConfigFor(SystemId.SBS);
     Assert.assertNotNull(jc);
     Assert.assertEquals(2, jc.getUserSpaces().size());
-    Assert.assertEquals("SP_USR_1_1", jc.getUserSpaces().get(0));
-    Assert.assertEquals("SP_USR_1_2", jc.getUserSpaces().get(1));
+    Assert.assertEquals(new Long(11), jc.getUserSpaces().get(0));
+    Assert.assertEquals(new Long(12), jc.getUserSpaces().get(1));
 
     Assert.assertEquals(2, jc.getDevSpaces().size());
-    Assert.assertEquals("SP_DEV_1_1", jc.getDevSpaces().get(0));
-    Assert.assertEquals("SP_DEV_1_2", jc.getDevSpaces().get(1));
+    Assert.assertEquals(new Long(111), jc.getDevSpaces().get(0));
+    Assert.assertEquals(new Long(112), jc.getDevSpaces().get(1));
 
     jc = (SystemDataConfigSBS) c.getProjects().get(1).getSystemDataConfigFor(SystemId.SBS);
     Assert.assertNotNull(jc);
     Assert.assertEquals(2, jc.getUserSpaces().size());
-    Assert.assertEquals("SP_USR_2_1", jc.getUserSpaces().get(0));
-    Assert.assertEquals("SP_USR_2_2", jc.getUserSpaces().get(1));
+    Assert.assertEquals(new Long(21), jc.getUserSpaces().get(0));
+    Assert.assertEquals(new Long(22), jc.getUserSpaces().get(1));
 
     Assert.assertEquals(2, jc.getDevSpaces().size());
-    Assert.assertEquals("SP_DEV_2_1", jc.getDevSpaces().get(0));
-    Assert.assertEquals("SP_DEV_2_2", jc.getDevSpaces().get(1));
+    Assert.assertEquals(new Long(121), jc.getDevSpaces().get(0));
+    Assert.assertEquals(new Long(122), jc.getDevSpaces().get(1));
 
   }
 

Added: labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/java/org/jboss/community/sbs/plugin/reports/monthly/config/SystemDataConfigFISHEYETest.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/java/org/jboss/community/sbs/plugin/reports/monthly/config/SystemDataConfigFISHEYETest.java	                        (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/java/org/jboss/community/sbs/plugin/reports/monthly/config/SystemDataConfigFISHEYETest.java	2010-10-20 11:57:47 UTC (rev 35593)
@@ -0,0 +1,36 @@
+package org.jboss.community.sbs.plugin.reports.monthly.config;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Unit test for {@link SystemDataConfigFISHEYE}.
+ * 
+ * @author Vlastimil Elias (velias at redhat dot com)
+ */
+public class SystemDataConfigFISHEYETest {
+
+  @Test
+  public void getSystem() {
+    SystemDataConfigFISHEYE tested = new SystemDataConfigFISHEYE();
+    Assert.assertEquals(SystemId.FISHEYE, tested.getSystem());
+  }
+
+  @Test
+  public void addProjectKey() {
+    SystemDataConfigFISHEYE tested = new SystemDataConfigFISHEYE();
+
+    tested.addRepository(null);
+    Assert.assertNull(tested.getRepositories());
+
+    try {
+      tested.addRepository(new FishEyeRepositoryConfig());
+    } catch (IllegalArgumentException e) {
+      Assert.assertNull(tested.getRepositories());
+    }
+
+    tested.addRepository(new FishEyeRepositoryConfig("ORG"));
+    Assert.assertEquals("ORG", tested.getRepositories().get(0).getName());
+  }
+
+}

Added: labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/java/org/jboss/community/sbs/plugin/reports/monthly/config/SystemDataConfigJIRATest.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/java/org/jboss/community/sbs/plugin/reports/monthly/config/SystemDataConfigJIRATest.java	                        (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/java/org/jboss/community/sbs/plugin/reports/monthly/config/SystemDataConfigJIRATest.java	2010-10-20 11:57:47 UTC (rev 35593)
@@ -0,0 +1,34 @@
+package org.jboss.community.sbs.plugin.reports.monthly.config;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Unit test for {@link SystemDataConfigJIRA}.
+ * 
+ * @author Vlastimil Elias (velias at redhat dot com)
+ */
+public class SystemDataConfigJIRATest {
+
+  @Test
+  public void getSystem() {
+    SystemDataConfigJIRA tested = new SystemDataConfigJIRA();
+    Assert.assertEquals(SystemId.JIRA, tested.getSystem());
+  }
+
+  @Test
+  public void addProjectKey() {
+    SystemDataConfigJIRA tested = new SystemDataConfigJIRA();
+
+    tested.addProjectKey(null);
+    tested.addProjectKey("");
+    tested.addProjectKey(" ");
+
+    tested.addProjectKey("ORG");
+    tested.addProjectKey("JBAS ");
+
+    Assert.assertEquals("ORG", tested.getProjectKeys().get(0));
+    Assert.assertEquals("JBAS", tested.getProjectKeys().get(1));
+  }
+
+}

Added: labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/java/org/jboss/community/sbs/plugin/reports/monthly/config/SystemDataConfigSBSTest.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/java/org/jboss/community/sbs/plugin/reports/monthly/config/SystemDataConfigSBSTest.java	                        (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/java/org/jboss/community/sbs/plugin/reports/monthly/config/SystemDataConfigSBSTest.java	2010-10-20 11:57:47 UTC (rev 35593)
@@ -0,0 +1,66 @@
+package org.jboss.community.sbs.plugin.reports.monthly.config;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Unit test for {@link SystemDataConfigSBS}.
+ * 
+ * @author Vlastimil Elias (velias at redhat dot com)
+ */
+public class SystemDataConfigSBSTest {
+
+  @Test
+  public void addDevSpace() {
+    SystemDataConfigSBS tested = new SystemDataConfigSBS();
+
+    tested.addDevSpace(null);
+    tested.addDevSpace("");
+    tested.addDevSpace(" ");
+
+    tested.addDevSpace("11");
+    tested.addDevSpace("33");
+
+    Assert.assertEquals(new Long(11), tested.getDevSpaces().get(0));
+    Assert.assertEquals(new Long(33), tested.getDevSpaces().get(1));
+
+    try {
+      tested.addDevSpace("a");
+      Assert.fail("IllegalArgumentException not thrown");
+    } catch (IllegalArgumentException e) {
+      // nothing to do
+    }
+
+  }
+
+  @Test
+  public void addUserSpace() {
+    SystemDataConfigSBS tested = new SystemDataConfigSBS();
+
+    tested.addUserSpace(null);
+    tested.addUserSpace("");
+    tested.addUserSpace(" ");
+
+    tested.addUserSpace("11");
+    tested.addUserSpace("33 ");
+
+    Assert.assertEquals(new Long(11), tested.getUserSpaces().get(0));
+    Assert.assertEquals(new Long(33), tested.getUserSpaces().get(1));
+
+    try {
+      tested.addUserSpace("a");
+      Assert.fail("IllegalArgumentException not thrown");
+    } catch (IllegalArgumentException e) {
+      // nothing to do
+    }
+
+  }
+
+  @Test
+  public void getSystem() {
+    SystemDataConfigSBS tested = new SystemDataConfigSBS();
+    Assert.assertEquals(SystemId.SBS, tested.getSystem());
+
+  }
+
+}

Modified: labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/resources/monthly_report_config.xml
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/resources/monthly_report_config.xml	2010-10-20 11:52:35 UTC (rev 35592)
+++ labs/jbosslabs/labs-3.0-build/integration/sbs/reports/trunk/src/test/resources/monthly_report_config.xml	2010-10-20 11:57:47 UTC (rev 35593)
@@ -7,12 +7,12 @@
         </jira>
         <sbs>
             <user>
-              <space>SP_USR_1_1</space>
-              <space>SP_USR_1_2</space>
+              <space>11</space>
+              <space>12</space>
             </user>
             <dev>
-              <space>SP_DEV_1_1</space>
-              <space>SP_DEV_1_2</space>
+              <space>111</space>
+              <space>112</space>
               <space></space>
             </dev>
         </sbs>
@@ -28,14 +28,14 @@
         </jira>
         <sbs>
             <user>
-              <space>SP_USR_2_1</space>
-              <space>SP_USR_2_2</space>
+              <space>21</space>
+              <space>22</space>
               <space></space>
               <space></space>
             </user>
             <dev>
-              <space>SP_DEV_2_1</space>
-              <space>SP_DEV_2_2</space>
+              <space>121</space>
+              <space>122</space>
             </dev>
         </sbs>
         <fisheye>



More information about the jboss-svn-commits mailing list