Author: dlanglais Date: 2010-03-18 19:07:59 +0100 (Thu, 18 Mar 2010) New Revision: 264 Log: Modification : - Utilisation de JUnit 4.8.1 (cr?\195?\169ation d'une variable sur le pom parent utilis?\195?\169e par tous les modules). - Transformation de tous les tests en tests JUnit 4. - Pour les m?\195?\169thodes de test utilisant l'affichage, on contr?\195?\180le la valeur de isHeadless(), si celle-ci est ?\195?\160 true, la machine ne peut les ex?\195?\169cuter. Modified: trunk/msm-bighashmap/pom.xml trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/BigHashMapTest.java trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/CellTest.java trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/ColumnTest.java trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/RowTest.java trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/StructureTest.java trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/TableTest.java trunk/msm-bighashmapV2/pom.xml trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/BigHashMapV2Test.java trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/CellTest.java trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/ColumnTest.java trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/RowTest.java trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/StructureTest.java trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/TableTest.java trunk/msm-fromtoXML/pom.xml trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLTest.java trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/importer/FromXMLTest.java trunk/msm-fromtoXPP3/pom.xml trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLXPP3Test.java trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/importer/FromXMLXPP3Test.java trunk/msm-hbase/pom.xml trunk/msm-monitoring-plugins/pom.xml trunk/msm-pluginmanager/pom.xml trunk/msm-pluginmanager/src/test/java/org/nuiton/mapstoragemanager/plugins/pluginmanager/PluginManagerTest.java trunk/msm-pluginmanager/src/test/java/org/nuiton/mapstoragemanager/plugins/pluginmanager/PluginViewTest.java trunk/msm/pom.xml trunk/pom.xml Modified: trunk/msm/pom.xml =================================================================== --- trunk/msm/pom.xml 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/msm/pom.xml 2010-03-18 18:07:59 UTC (rev 264) @@ -45,7 +45,7 @@ <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>4.7</version> + <version>${junit.version}</version> <scope>test</scope> </dependency> </dependencies> Modified: trunk/msm-bighashmap/pom.xml =================================================================== --- trunk/msm-bighashmap/pom.xml 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/msm-bighashmap/pom.xml 2010-03-18 18:07:59 UTC (rev 264) @@ -50,7 +50,7 @@ <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>4.7</version> + <version>${junit.version}</version> <scope>test</scope> </dependency> </dependencies> Modified: trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/BigHashMapTest.java =================================================================== --- trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/BigHashMapTest.java 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/BigHashMapTest.java 2010-03-18 18:07:59 UTC (rev 264) @@ -10,9 +10,14 @@ import java.util.Set; import javax.swing.JMenu; import javax.swing.JMenuItem; -import junit.framework.TestCase; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertNotNull; +import org.junit.Assume; +import org.junit.BeforeClass; +import org.junit.Test; import org.nuiton.mapstoragemanager.plugins.BigTable; import org.nuiton.mapstoragemanager.plugins.Plugin; import org.nuiton.mapstoragemanager.ui.MainUI; @@ -21,13 +26,31 @@ * * @author Dorian Langlais */ -public class BigHashMapTest extends TestCase { +public class BigHashMapTest { /** * Logger. */ private static final Log LOG = LogFactory.getLog(BigHashMapTest.class); + /** + * isHeadless is <b>true</b> if this environment cannot support + * a display, keyboard, and mouse, <b>false</b> otherwise. + */ + private static boolean isHeadless; + + /** + * Control if X11 Display is set. + */ + @BeforeClass + public static void isX11DisplaySet() { + isHeadless = java.awt.GraphicsEnvironment.isHeadless(); + } + + /** + * Test getPluginName. + */ + @Test public void testGetPluginName() { Plugin bigHashMap = new BigHashMap(); String expectedPluginName = bigHashMap.getClass().getSimpleName(); @@ -41,6 +64,7 @@ * We put tables, get tablesNames and control the result. * We delete tables, get tablesNames and control the result. */ + @Test public void testCreateAndDeleteTable() { /** We create a new BigTable */ BigTable bigHashMapV2 = new BigHashMap(); @@ -81,6 +105,7 @@ * We put columns, get columnsNames and control the result. * We delete columns, get columnsNames and control the result. */ + @Test public void testCreateAndDeleteColumns() { /** We create a new BigTable */ BigTable bigHashMapV2 = new BigHashMap(); @@ -117,6 +142,7 @@ * We create a table with a column. * We put and try to get String in the BigHashMap. */ + @Test public void testPutAndGet() { /** We create a new BigTable */ BigTable bigHashMapV2 = new BigHashMap(); @@ -158,6 +184,7 @@ * We create a table with a column. * We put and try to get String in the BigHashMap. */ + @Test public void testGetKeys() { /** We create a new BigTable */ BigTable bigHashMapV2 = new BigHashMap(); @@ -203,7 +230,10 @@ /** * Test load and unload plugin. */ + @Test public void testLoadUnload() { + Assume.assumeTrue(!isHeadless); + Plugin bigHashMap = new BigHashMap(); MainUI mainUI = MainUI.getInstance(); JMenu menuConnect = mainUI.getMenuConnect(); Modified: trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/CellTest.java =================================================================== --- trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/CellTest.java 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/CellTest.java 2010-03-18 18:07:59 UTC (rev 264) @@ -2,19 +2,20 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; - import java.util.NoSuchElementException; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertNotSame; +import org.junit.Assert; +import org.junit.Test; -import junit.framework.Assert; -import junit.framework.TestCase; - /** * Classe de test pour la classe Cell. * Teste les fonctions de base d'une cellule, put et get. * @author Dorian Langlais * */ -public final class CellTest extends TestCase { +public final class CellTest { /** * Logger. @@ -30,6 +31,7 @@ /** * On teste le comportement de get avec une cellule vide. */ + @Test public void testGetVoid() { cellActual = new CellImpl<Object>(); try { @@ -44,6 +46,7 @@ * Test de la fonction put sur une cellule. * On ajoute un objet obj1, on tente de le récupérer. */ + @Test public void testPut() { cellActual = new CellImpl<Object>(); @@ -67,6 +70,7 @@ * On ajoute un objet obj2, on tente de le récupérer. * On ajoute un objet obj3, on tente de le récupérer. */ + @Test public void testPutReput() { cellActual = new CellImpl<Object>(); @@ -100,6 +104,7 @@ * We make two cells with the same objects, and we verify that they are * equals. */ + @Test public void testEquals() { /** @@ -128,6 +133,7 @@ * We make two cells with the same objects, and we verify that thay have * the same hashCode. */ + @Test public void testHashCode() { /** @@ -155,6 +161,7 @@ /** * we test that toString do what we want. */ + @Test public void testToString() { /** Modified: trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/ColumnTest.java =================================================================== --- trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/ColumnTest.java 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/ColumnTest.java 2010-03-18 18:07:59 UTC (rev 264) @@ -5,15 +5,15 @@ import java.util.Map; import java.util.NoSuchElementException; import java.util.Set; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotSame; +import org.junit.Assert; +import org.junit.Test; -import junit.framework.Assert; -import junit.framework.TestCase; +public final class ColumnTest { -public final class ColumnTest extends TestCase { - /** * Logger. */ @@ -27,6 +27,7 @@ /** * We test column when empty. */ + @Test public void testGetVoid() { columnActual = new ColumnImpl<Object>(); try { @@ -40,6 +41,7 @@ /** * We put one object and we try to get it. */ + @Test public void testPutAndGet() { columnActual = new ColumnImpl<Object>(); @@ -62,6 +64,7 @@ * We put two object, we verify that they are in the column. * Then, we try to remove them. */ + @Test public void testDelete() { columnActual = new ColumnImpl<Integer>(); @@ -101,6 +104,7 @@ /** * testhashCode(). */ + @Test public void testHashCode() { int hashCodeSum = 0; @@ -129,6 +133,7 @@ /** * testEquals(). */ + @Test public void testEquals() { /** @@ -163,6 +168,7 @@ /** * We test the method toString() on Column. */ + @Test public void testToString() { Object toStore, toStore2; @@ -208,6 +214,7 @@ * We put objects in the columns and we get the keys. * We compare with the key set attempt. */ + @Test public void testGetKeys(){ columnActual = new ColumnImpl<Object>(); Modified: trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/RowTest.java =================================================================== --- trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/RowTest.java 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/RowTest.java 2010-03-18 18:07:59 UTC (rev 264) @@ -2,11 +2,12 @@ import java.util.HashMap; import java.util.Map; -import junit.framework.TestCase; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import static org.junit.Assert.assertEquals; +import org.junit.Test; -public class RowTest extends TestCase { +public class RowTest { /** * Logger. @@ -17,6 +18,7 @@ private Map<String, Object> contentExpected; private Row rowActual; + @Test public void testToString() { { structureExpected = new StructureImpl(); @@ -51,6 +53,7 @@ } } + @Test public void testGetRowContent() { { structureExpected = new StructureImpl(); @@ -85,6 +88,7 @@ } } + @Test public void testGetRowStructure() { { structureExpected = new StructureImpl(); @@ -119,6 +123,7 @@ } } + @Test public void testGetContent() { { structureExpected = new StructureImpl(); Modified: trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/StructureTest.java =================================================================== --- trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/StructureTest.java 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/StructureTest.java 2010-03-18 18:07:59 UTC (rev 264) @@ -5,12 +5,12 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; - -import junit.framework.TestCase; import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.Log; +import static org.junit.Assert.assertEquals; +import org.junit.Test; -public class StructureTest extends TestCase { +public class StructureTest { /** * Logger. @@ -25,6 +25,7 @@ private Set<String> columnsNamesActual; private Set<String> columnsNamesExpected; + @Test public void testGetColumnsNamesVoid() { structureActual = new StructureImpl(); Set<String> columnNames = structureActual.getColumnsNames(); @@ -36,6 +37,7 @@ * We use reflexivity to verify that the map of the structure is like we * want. */ + @Test public void testAddColumn() { structureContentExpected = new HashMap<String, Class<?>>(); @@ -79,6 +81,7 @@ * We remove column, and we continue to verify that the map of the structure * is always good. */ + @Test public void testRemoveColumn() { structureContentExpected = new HashMap<String, Class<?>>(); @@ -145,6 +148,7 @@ * We remove column, and we continue to verify that the columsNames is * always good. */ + @Test public void testGetColumnsNames() { structureActual = new StructureImpl(); @@ -200,6 +204,7 @@ * We remove column, and we continue to verify that the columsNames is * always good. */ + @Test public void testGetColumnClass() { structureActual = new StructureImpl(); @@ -306,6 +311,7 @@ * we create and delete columns. * we calculate hashcode and compare to hashCode(). */ + @Test public void testHashCode() { structureActual = new StructureImpl(); Modified: trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/TableTest.java =================================================================== --- trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/TableTest.java 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/TableTest.java 2010-03-18 18:07:59 UTC (rev 264) @@ -10,16 +10,17 @@ import java.util.Map; import java.util.NoSuchElementException; import java.util.Set; -import junit.framework.Assert; -import junit.framework.TestCase; import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.Log; +import static org.junit.Assert.assertEquals; +import org.junit.Assert; +import org.junit.Test; /** * * @author Dorian Langlais */ -public class TableTest extends TestCase { +public class TableTest { /** * Logger. @@ -36,6 +37,7 @@ * We create a new table and we verify that the fields are correctly * initialized. */ + @Test public void testNewTable() { tableActual = new TableImpl(); @@ -72,6 +74,7 @@ * We create columns and we verify that they are actually in the table and * in the structure of the table. */ + @Test public void testCreateColumn() { tableActual = new TableImpl(); @@ -136,6 +139,7 @@ * The we remove them one by one, and we verify that they are really removed * of the table and of the structure. */ + @Test public void testRemoveColumn() { tableActual = new TableImpl(); @@ -204,6 +208,7 @@ * We put objects in this columns and we use reflexivity to verify that * objects are really stored in the table. */ + @Test public void testPut() { /** @@ -255,6 +260,7 @@ * We create a new Table, with two columns. * We put objects in this columns and we try to get them. */ + @Test public void testGet() { /** @@ -297,6 +303,7 @@ * We create a new Table, with two columns. * We put objects in this columns and we try to get it. */ + @Test public void testPutAndGetWithVersion() { /** @@ -383,6 +390,7 @@ /** * We pu object in the table and we verify that the ketset return is good. */ + @Test public void testGetKeys() { Set<String> keySet = new HashSet<String>(); @@ -426,6 +434,7 @@ * We create a new Table, with two columns. * We put objects in this columns and we try to remove them. */ + @Test public void testDelete() { /** @@ -506,6 +515,7 @@ * We put objects in this columns. * We get the rows and verify that the content is good. */ + @Test public void testGetRow() { /** @@ -588,6 +598,7 @@ * We put objects in this columns. * We get the rows and verify that the content is good. */ + @Test public void testGestColumnsNames() { /** Modified: trunk/msm-bighashmapV2/pom.xml =================================================================== --- trunk/msm-bighashmapV2/pom.xml 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/msm-bighashmapV2/pom.xml 2010-03-18 18:07:59 UTC (rev 264) @@ -50,7 +50,7 @@ <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>4.7</version> + <version>${junit.version}</version> <scope>test</scope> </dependency> </dependencies> Modified: trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/BigHashMapV2Test.java =================================================================== --- trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/BigHashMapV2Test.java 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/BigHashMapV2Test.java 2010-03-18 18:07:59 UTC (rev 264) @@ -10,9 +10,14 @@ import java.util.Set; import javax.swing.JMenu; import javax.swing.JMenuItem; -import junit.framework.TestCase; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertNotNull; +import org.junit.Assume; +import org.junit.BeforeClass; +import org.junit.Test; import org.nuiton.mapstoragemanager.plugins.BigTable; import org.nuiton.mapstoragemanager.plugins.Plugin; import org.nuiton.mapstoragemanager.ui.MainUI; @@ -21,13 +26,31 @@ * * @author Dorian Langlais */ -public class BigHashMapV2Test extends TestCase { +public class BigHashMapV2Test { /** * Logger. */ private static final Log LOG = LogFactory.getLog(TableTest.class); + /** + * isHeadless is <b>true</b> if this environment cannot support + * a display, keyboard, and mouse, <b>false</b> otherwise. + */ + private static boolean isHeadless; + + /** + * Control if X11 Display is set. + */ + @BeforeClass + public static void isX11DisplaySet() { + isHeadless = java.awt.GraphicsEnvironment.isHeadless(); + } + + /** + * Test getPluginName. + */ + @Test public void testGetPluginName() { Plugin bigHashMapV2 = new BigHashMapV2(); String expectedPluginName = bigHashMapV2.getClass().getSimpleName(); @@ -41,6 +64,7 @@ * We put tables, get tablesNames and control the result. * We delete tables, get tablesNames and control the result. */ + @Test public void testCreateAndDeleteTable() { /** We create a new BigTable */ BigTable bigHashMapV2 = new BigHashMapV2(); @@ -81,6 +105,7 @@ * We put columns, get columnsNames and control the result. * We delete columns, get columnsNames and control the result. */ + @Test public void testCreateAndDeleteColumns() { /** We create a new BigTable */ BigTable bigHashMapV2 = new BigHashMapV2(); @@ -117,6 +142,7 @@ * We create a table with a column. * We put and try to get String in the BigHashMap. */ + @Test public void testPutAndGet() { /** We create a new BigTable */ BigTable bigHashMapV2 = new BigHashMapV2(); @@ -158,6 +184,7 @@ * We create a table with a column. * We put and try to get String in the BigHashMap. */ + @Test public void testGetKeys() { /** We create a new BigTable */ BigTable bigHashMapV2 = new BigHashMapV2(); @@ -203,7 +230,10 @@ /** * Test load and unload plugin. */ + @Test public void testLoadUnload() { + Assume.assumeTrue(!isHeadless); + Plugin bigHashMap = new BigHashMapV2(); MainUI mainUI = MainUI.getInstance(); JMenu menuConnect = mainUI.getMenuConnect(); Modified: trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/CellTest.java =================================================================== --- trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/CellTest.java 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/CellTest.java 2010-03-18 18:07:59 UTC (rev 264) @@ -4,17 +4,19 @@ import org.apache.commons.logging.LogFactory; import java.util.NoSuchElementException; - import junit.framework.Assert; -import junit.framework.TestCase; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import org.junit.Test; + /** * Classe de test pour la classe Cell. * Teste les fonctions de base d'une cellule, put et get. * @author Dorian Langlais * */ -public final class CellTest extends TestCase { +public final class CellTest { /** * Logger. @@ -30,6 +32,7 @@ /** * On teste le comportement de get avec une cellule vide. */ + @Test public void testGetVoid() { cellActual = new CellImpl(); try { @@ -44,6 +47,7 @@ * Test de la fonction put sur une cellule. * On ajoute un objet obj1, on tente de le récupérer. */ + @Test public void testPut() { cellActual = new CellImpl(); @@ -67,6 +71,7 @@ * On ajoute un objet obj2, on tente de le récupérer. * On ajoute un objet obj3, on tente de le récupérer. */ + @Test public void testPutReput() { cellActual = new CellImpl(); @@ -96,65 +101,10 @@ assertEquals(cellActual.get(), objectExpected3); } -// /** -// * We make two cells with the same objects, and we verify that they are -// * equals. -// */ -// public void testEquals() { -// -// /** -// * We create two cells. -// */ -// cellActual = new CellImpl(); -// cell2Actual = new CellImpl(); -// assertEquals(cellActual, cell2Actual); -// -// objectExpected1 = new String("objectExpected1"); -// -// /** -// * We put one item in the first Cell, and not in the second. -// */ -// cellActual.put(objectExpected1); -// assertNotSame(cellActual, cell2Actual); -// -// /** -// * We put the same object in the second cell. -// */ -// cell2Actual.put(objectExpected1); -// assertEquals(cellActual, cell2Actual); -// } -// -// /** -// * We make two cells with the same objects, and we verify that thay have -// * the same hashCode. -// */ -// public void testHashCode() { -// -// /** -// * We create two cells. -// */ -// cellActual = new CellImpl(); -// cell2Actual = new CellImpl(); -// assertEquals(cellActual.hashCode(), cell2Actual.hashCode()); -// -// objectExpected1 = new String("objectExpected1"); -// -// /** -// * We put one item in the first Cell, and not in the second. -// */ -// cellActual.put(objectExpected1); -// assertNotSame(cellActual.hashCode(), cell2Actual.hashCode()); -// -// /** -// * We put the same object in the second cell. -// */ -// cell2Actual.put(objectExpected1); -// assertEquals(cellActual.hashCode(), cell2Actual.hashCode()); -// } - /** * we test that toString do what we want. */ + @Test public void testToString() { /** Modified: trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/ColumnTest.java =================================================================== --- trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/ColumnTest.java 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/ColumnTest.java 2010-03-18 18:07:59 UTC (rev 264) @@ -5,15 +5,14 @@ import java.util.Map; import java.util.NoSuchElementException; import java.util.Set; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import static org.junit.Assert.assertEquals; +import org.junit.Assert; +import org.junit.Test; -import junit.framework.Assert; -import junit.framework.TestCase; +public final class ColumnTest { -public final class ColumnTest extends TestCase { - /** * Logger. */ @@ -27,6 +26,7 @@ /** * We test column when empty. */ + @Test public void testGetVoid() { columnActual1 = new ColumnImpl(); try { @@ -40,6 +40,7 @@ /** * We put one object and we try to get it. */ + @Test public void testPutAndGet() { columnActual1 = new ColumnImpl(); @@ -62,6 +63,7 @@ * We put two object, we verify that they are in the column. * Then, we try to remove them. */ + @Test public void testDelete() { columnActual1 = new ColumnImpl(); @@ -98,71 +100,10 @@ } } -// /** -// * testhashCode(). -// */ -// public void testHashCode() { -// -// int hashCodeSum = 0; -// String toStore; -// -// /** -// * We create a new column and verify that hashCode is 0. -// */ -// columnActual1 = new ColumnImpl(); -// assertEquals(columnActual1.hashCode(), 0); -// -// /** -// * We put a Integer(10) and control that hashCode is already ok. -// */ -// toStore = new String("10"); -// columnActual1.put("key1", toStore); -// hashCodeSum += toStore.hashCode(); -// assertEquals(columnActual1.hashCode(), hashCodeSum); -// -// toStore = new String("peanuts"); -// columnActual1.put("key2", toStore); -// hashCodeSum += toStore.hashCode(); -// assertEquals(columnActual1.hashCode(), hashCodeSum); -// } -// -// /** -// * testEquals(). -// */ -// public void testEquals() { -// -// /** -// * We create two columns. -// */ -// columnActual1 = new ColumnImpl(); -// columnActual2 = new ColumnImpl(); -// assertEquals(columnActual1, columnActual2); -// -// /** -// * We put one object in the first column, and not in the second. -// */ -// expected1 = new String("10"); -// columnActual1.put("key1",expected1); -// assertNotSame(columnActual1, columnActual2); -// -// /** -// * We put the same object in the second column at the same key. -// */ -// columnActual2.put("key1",expected1); -// assertEquals(columnActual1, columnActual2); -// -// /** -// * We put the same object in the two column but at a different key. -// */ -// expected2 = new String("Tomatoes"); -// columnActual1.put("key2",expected2); -// columnActual2.put("key3",expected2); -// assertNotSame(columnActual1, columnActual2); -// } - /** * We test the method toString() on Column. */ + @Test public void testToString() { String toStore, toStore2; @@ -208,6 +149,7 @@ * We put objects in the columns and we get the keys. * We compare with the key set attempt. */ + @Test public void testGetKeys(){ columnActual1 = new ColumnImpl(); Modified: trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/RowTest.java =================================================================== --- trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/RowTest.java 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/RowTest.java 2010-03-18 18:07:59 UTC (rev 264) @@ -2,11 +2,12 @@ import java.util.HashMap; import java.util.Map; -import junit.framework.TestCase; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import static org.junit.Assert.assertEquals; +import org.junit.Test; -public class RowTest extends TestCase { +public class RowTest { /** * Logger. @@ -17,6 +18,7 @@ private Map<String, String> contentExpected; private Row rowActual; + @Test public void testToString() { { structureExpected = new StructureImpl(); @@ -51,6 +53,7 @@ } } + @Test public void testGetRowContent() { { structureExpected = new StructureImpl(); @@ -85,6 +88,7 @@ } } + @Test public void testGetRowStructure() { { structureExpected = new StructureImpl(); @@ -119,6 +123,7 @@ } } + @Test public void testGetContent() { { structureExpected = new StructureImpl(); Modified: trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/StructureTest.java =================================================================== --- trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/StructureTest.java 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/StructureTest.java 2010-03-18 18:07:59 UTC (rev 264) @@ -3,12 +3,12 @@ import java.lang.reflect.Field; import java.util.HashSet; import java.util.Set; - -import junit.framework.TestCase; import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.Log; +import static org.junit.Assert.assertEquals; +import org.junit.Test; -public class StructureTest extends TestCase { +public class StructureTest { /** * Logger. @@ -23,6 +23,7 @@ private Set<String> columnsNamesActual; private Set<String> columnsNamesExpected; + @Test public void testGetColumnsNamesVoid() { structureActual = new StructureImpl(); Set<String> columnNames = structureActual.getColumnsNames(); @@ -34,6 +35,7 @@ * We use reflexivity to verify that the map of the structure is like we * want. */ + @Test public void testAddColumn() { structureContentExpected = new HashSet<String>(); @@ -77,6 +79,7 @@ * We remove column, and we continue to verify that the map of the structure * is always good. */ + @Test public void testRemoveColumn() { structureContentExpected = new HashSet<String>(); @@ -143,6 +146,7 @@ * We remove column, and we continue to verify that the columsNames is * always good. */ + @Test public void testGetColumnsNames() { structureActual = new StructureImpl(); @@ -191,37 +195,4 @@ assertEquals(columnsNamesExpected, columnsNamesActual); } - -// /** -// * we create and delete columns. -// * we calculate hashcode and compare to hashCode(). -// */ -// public void testHashCode() { -// -// structureActual = new StructureImpl(); -// int hashCodeExpected = 0; -// assertEquals(structureActual.hashCode(), hashCodeExpected); -// -// /** -// * We create column "Test1" -// */ -// structureActual.createColumn("Test1"); -// hashCodeExpected += "Test1".hashCode(); -// assertEquals(structureActual.hashCode(), hashCodeExpected); -// -// /** -// * We create column "Test2" -// */ -// structureActual.createColumn("Test2"); -// hashCodeExpected += "Test2".hashCode(); -// assertEquals(structureActual.hashCode(), hashCodeExpected); -// -// /** -// * We delete column "Test1" -// */ -// structureActual.deleteColumn("Test1"); -// hashCodeExpected -= "Test1".hashCode(); -// assertEquals(structureActual.hashCode(), hashCodeExpected); -// -// } } Modified: trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/TableTest.java =================================================================== --- trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/TableTest.java 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/TableTest.java 2010-03-18 18:07:59 UTC (rev 264) @@ -6,16 +6,17 @@ import java.util.Map; import java.util.NoSuchElementException; import java.util.Set; -import junit.framework.Assert; -import junit.framework.TestCase; import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.Log; +import static org.junit.Assert.assertEquals; +import org.junit.Assert; +import org.junit.Test; /** * * @author Dorian Langlais */ -public class TableTest extends TestCase { +public class TableTest { /** * Logger. @@ -32,6 +33,7 @@ * We create a new table and we verify that the fields are correctly * initialized. */ + @Test public void testNewTable() { tableActual = new TableImpl(); @@ -70,6 +72,7 @@ * We create columns and we verify that they are actually in the table and * in the structure of the table. */ + @Test public void testCreateColumn() { tableActual = new TableImpl(); @@ -140,6 +143,7 @@ * The we remove them one by one, and we verify that they are really removed * of the table and of the structure. */ + @Test public void testRemoveColumn() { tableActual = new TableImpl(); @@ -214,6 +218,7 @@ * We put objects in this columns and we use reflexivity to verify that * objects are really stored in the table. */ + @Test public void testPut() { /** @@ -265,6 +270,7 @@ * We create a new Table, with two columns. * We put objects in this columns and we try to get them. */ + @Test public void testGet() { /** @@ -307,6 +313,7 @@ * We create a new Table, with two columns. * We put objects in this columns and we try to get it. */ + @Test public void testPutAndGetWithVersion() { /** @@ -393,6 +400,7 @@ /** * We pu object in the table and we verify that the ketset return is good. */ + @Test public void testGetKeys() { Set<String> keySet = new HashSet<String>(); @@ -436,6 +444,7 @@ * We create a new Table, with two columns. * We put objects in this columns and we try to remove them. */ + @Test public void testDelete() { /** @@ -516,6 +525,7 @@ * We put objects in this columns. * We get the rows and verify that the content is good. */ + @Test public void testGetRow() { /** @@ -598,6 +608,7 @@ * We put objects in this columns. * We get the rows and verify that the content is good. */ + @Test public void testGestColumnsNames() { /** Modified: trunk/msm-fromtoXML/pom.xml =================================================================== --- trunk/msm-fromtoXML/pom.xml 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/msm-fromtoXML/pom.xml 2010-03-18 18:07:59 UTC (rev 264) @@ -57,7 +57,7 @@ <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>4.7</version> + <version>${junit.version}</version> <scope>test</scope> </dependency> <dependency> Modified: trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLTest.java =================================================================== --- trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLTest.java 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLTest.java 2010-03-18 18:07:59 UTC (rev 264) @@ -12,12 +12,17 @@ import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.filechooser.FileNameExtensionFilter; -import junit.framework.TestCase; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jdom.Attribute; import org.jdom.Document; import org.jdom.Element; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertNotNull; +import org.junit.Assume; +import org.junit.BeforeClass; +import org.junit.Test; import org.nuiton.mapstoragemanager.plugins.Exporter; import org.nuiton.mapstoragemanager.plugins.BigTable; import org.nuiton.mapstoragemanager.plugins.AssertJdomElement; @@ -30,21 +35,34 @@ * * @author Dorian Langlais */ -public class ToXMLTest extends TestCase { +public class ToXMLTest { /** * Logger. */ private static final Log LOG = LogFactory.getLog(ToXMLTest.class); - - private static Document actual; private static Document expected; /** + * isHeadless is <b>true</b> if this environment cannot support + * a display, keyboard, and mouse, <b>false</b> otherwise. + */ + private static boolean isHeadless; + + /** + * Control if X11 Display is set. + */ + @BeforeClass + public static void isX11DisplaySet() { + isHeadless = java.awt.GraphicsEnvironment.isHeadless(); + } + + /** * Test to export a bigTable database in a xml format. */ + @Test public void testExportTo() { createXMLDocument(); @@ -58,6 +76,7 @@ /** * Create a bigTable database and a XMLDocument representing the database. */ + @Test public void createXMLDocument() { actual = null; @@ -271,6 +290,7 @@ /** * Test of getPluginName(). */ + @Test public void testGetPluginName() { Plugin toXML = new ToXML(); String expectedPluginName = toXML.getClass().getSimpleName(); @@ -283,6 +303,7 @@ /** * Test of getFileFilter. */ + @Test public void testGetFileFilter(){ Exporter toXML = new ToXML(); @@ -311,7 +332,10 @@ /** * Test load and unload plugin. */ + @Test public void testLoadUnload() { + Assume.assumeTrue(!isHeadless); + Plugin bigHashMap = new ToXML(); MainUI mainUI = MainUI.getInstance(); JMenu menuExport = mainUI.getMenuExport(); Modified: trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/importer/FromXMLTest.java =================================================================== --- trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/importer/FromXMLTest.java 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/importer/FromXMLTest.java 2010-03-18 18:07:59 UTC (rev 264) @@ -14,10 +14,15 @@ import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.filechooser.FileNameExtensionFilter; -import junit.framework.Assert; -import junit.framework.TestCase; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertNotNull; +import org.junit.Assert; +import org.junit.Assume; +import org.junit.BeforeClass; +import org.junit.Test; import org.nuiton.mapstoragemanager.plugins.Importer; import org.nuiton.mapstoragemanager.plugins.BigTable; import org.nuiton.mapstoragemanager.plugins.Plugin; @@ -29,21 +34,32 @@ * * @author Dorian Langlais */ -public class FromXMLTest extends TestCase { +public class FromXMLTest { /** * Logger. */ private static final Log LOG = LogFactory.getLog(FromXMLTest.class); -// public void testImportFrom() { -// Assert.fail(); -// } + /** + * isHeadless is <b>true</b> if this environment cannot support + * a display, keyboard, and mouse, <b>false</b> otherwise. + */ + private static boolean isHeadless; /** + * Control if X11 Display is set. + */ + @BeforeClass + public static void isX11DisplaySet() { + isHeadless = java.awt.GraphicsEnvironment.isHeadless(); + } + + /** * Import the database from the file fiveTables. * Verify the content. */ + @Test public void testImportFromFiveTables() { File fiveTables = @@ -85,6 +101,7 @@ * Import the database from the file fiveColumns. * Verify the content. */ + @Test public void testImportFromFiveColumns() { File twoTablesFiveColumns = @@ -142,6 +159,7 @@ * Import the database from the file tenCells. * Verify the content. */ + @Test public void testImportFromThreeTenCells() { File twoTablesFiveColumns = @@ -273,6 +291,7 @@ /** * Test of getPluginName(). */ + @Test public void testGetPluginName() { Plugin fromXML = new FromXML(); String expectedPluginName = fromXML.getClass().getSimpleName(); @@ -285,6 +304,7 @@ /** * Test of getFileFilter. */ + @Test public void testGetFileFilter(){ Importer fromXML = new FromXML(); @@ -313,7 +333,10 @@ /** * Test load and unload plugin. */ + @Test public void testLoadUnload() { + Assume.assumeTrue(!isHeadless); + Plugin bigHashMap = new FromXML(); MainUI mainUI = MainUI.getInstance(); JMenu menuImport = mainUI.getMenuImport(); Modified: trunk/msm-fromtoXPP3/pom.xml =================================================================== --- trunk/msm-fromtoXPP3/pom.xml 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/msm-fromtoXPP3/pom.xml 2010-03-18 18:07:59 UTC (rev 264) @@ -57,7 +57,7 @@ <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>4.7</version> + <version>${junit.version}</version> <scope>test</scope> </dependency> <dependency> Modified: trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLXPP3Test.java =================================================================== --- trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLXPP3Test.java 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLXPP3Test.java 2010-03-18 18:07:59 UTC (rev 264) @@ -12,9 +12,14 @@ import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.filechooser.FileNameExtensionFilter; -import junit.framework.TestCase; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertNotNull; +import org.junit.Assume; +import org.junit.BeforeClass; +import org.junit.Test; import org.nuiton.mapstoragemanager.plugins.BigTable; import org.nuiton.mapstoragemanager.plugins.Exporter; import org.nuiton.mapstoragemanager.plugins.Importer; @@ -28,7 +33,7 @@ * * @author E054030D */ -public class ToXMLXPP3Test extends TestCase { +public class ToXMLXPP3Test { /** * Logger. @@ -36,6 +41,20 @@ private static final Log LOG = LogFactory.getLog(ToXMLXPP3Test.class); /** + * isHeadless is <b>true</b> if this environment cannot support + * a display, keyboard, and mouse, <b>false</b> otherwise. + */ + private static boolean isHeadless; + + /** + * Control if X11 Display is set. + */ + @BeforeClass + public static void isX11DisplaySet() { + isHeadless = java.awt.GraphicsEnvironment.isHeadless(); + } + + /** * BigTable actual. */ BigTable actual; @@ -48,6 +67,7 @@ /** * Test to export a bigTable database with empty Tables. */ + @Test public void testEmptyTables() { Exporter exporter = new ToXMLXPP3(); @@ -79,6 +99,7 @@ /** * Test to export a bigTable database with empty columns. */ + @Test public void testEmptyColumns() { Exporter exporter = new ToXMLXPP3(); @@ -123,6 +144,7 @@ /** * Test to export a bigTable database with empty columns. */ + @Test public void testWithElements() { Exporter exporter = new ToXMLXPP3(); @@ -203,6 +225,7 @@ /** * Test of getPluginName(). */ + @Test public void testGetPluginName() { Plugin fromXML = new FromXMLXPP3(); String expectedPluginName = fromXML.getClass().getSimpleName(); @@ -215,6 +238,7 @@ /** * Test of getFileFilter. */ + @Test public void testGetFileFilter(){ Importer fromXML = new FromXMLXPP3(); @@ -280,7 +304,10 @@ /** * Test load and unload plugin. */ + @Test public void testLoadUnload() { + Assume.assumeTrue(!isHeadless); + Plugin bigHashMap = new ToXMLXPP3(); MainUI mainUI = MainUI.getInstance(); JMenu menuExport = mainUI.getMenuExport(); Modified: trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/importer/FromXMLXPP3Test.java =================================================================== --- trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/importer/FromXMLXPP3Test.java 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/importer/FromXMLXPP3Test.java 2010-03-18 18:07:59 UTC (rev 264) @@ -14,10 +14,15 @@ import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.filechooser.FileNameExtensionFilter; -import junit.framework.Assert; -import junit.framework.TestCase; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertNotNull; +import org.junit.Assert; +import org.junit.Assume; +import org.junit.BeforeClass; +import org.junit.Test; import org.nuiton.mapstoragemanager.plugins.Importer; import org.nuiton.mapstoragemanager.plugins.BigTable; import org.nuiton.mapstoragemanager.plugins.Plugin; @@ -29,21 +34,32 @@ * * @author Dorian Langlais */ -public class FromXMLXPP3Test extends TestCase { +public class FromXMLXPP3Test { /** * Logger. */ private static final Log LOG = LogFactory.getLog(FromXMLXPP3Test.class); -// public void testImportFrom() { -// Assert.fail(); -// } + /** + * isHeadless is <b>true</b> if this environment cannot support + * a display, keyboard, and mouse, <b>false</b> otherwise. + */ + private static boolean isHeadless; /** + * Control if X11 Display is set. + */ + @BeforeClass + public static void isX11DisplaySet() { + isHeadless = java.awt.GraphicsEnvironment.isHeadless(); + } + + /** * Import the database from the file fiveTables. * Verify the content. */ + @Test public void testImportFromFiveTables() { File fiveTables = @@ -85,6 +101,7 @@ * Import the database from the file fiveColumns. * Verify the content. */ + @Test public void testImportFromFiveColumns() { File twoTablesFiveColumns = @@ -142,6 +159,7 @@ * Import the database from the file tenCells. * Verify the content. */ + @Test public void testImportFromThreeTenCells() { File twoTablesFiveColumns = @@ -273,6 +291,7 @@ /** * Test of getPluginName(). */ + @Test public void testGetPluginName() { Plugin fromXML = new FromXMLXPP3(); String expectedPluginName = fromXML.getClass().getSimpleName(); @@ -285,6 +304,7 @@ /** * Test of getFileFilter. */ + @Test public void testGetFileFilter(){ Importer fromXML = new FromXMLXPP3(); @@ -313,7 +333,10 @@ /** * Test load and unload plugin. */ + @Test public void testLoadUnload() { + Assume.assumeTrue(!isHeadless); + Plugin bigHashMap = new FromXMLXPP3(); MainUI mainUI = MainUI.getInstance(); JMenu menuImport = mainUI.getMenuImport(); Modified: trunk/msm-hbase/pom.xml =================================================================== --- trunk/msm-hbase/pom.xml 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/msm-hbase/pom.xml 2010-03-18 18:07:59 UTC (rev 264) @@ -63,7 +63,7 @@ <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>4.7</version> + <version>${junit.version}</version> <scope>test</scope> </dependency> Modified: trunk/msm-monitoring-plugins/pom.xml =================================================================== --- trunk/msm-monitoring-plugins/pom.xml 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/msm-monitoring-plugins/pom.xml 2010-03-18 18:07:59 UTC (rev 264) @@ -50,7 +50,7 @@ <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>4.7</version> + <version>${junit.version}</version> <scope>test</scope> </dependency> </dependencies> Modified: trunk/msm-pluginmanager/pom.xml =================================================================== --- trunk/msm-pluginmanager/pom.xml 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/msm-pluginmanager/pom.xml 2010-03-18 18:07:59 UTC (rev 264) @@ -50,7 +50,7 @@ <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>4.7</version> + <version>${junit.version}</version> <scope>test</scope> </dependency> </dependencies> Modified: trunk/msm-pluginmanager/src/test/java/org/nuiton/mapstoragemanager/plugins/pluginmanager/PluginManagerTest.java =================================================================== --- trunk/msm-pluginmanager/src/test/java/org/nuiton/mapstoragemanager/plugins/pluginmanager/PluginManagerTest.java 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/msm-pluginmanager/src/test/java/org/nuiton/mapstoragemanager/plugins/pluginmanager/PluginManagerTest.java 2010-03-18 18:07:59 UTC (rev 264) @@ -8,9 +8,15 @@ import java.lang.reflect.Field; import javax.swing.JMenu; import javax.swing.JMenuItem; -import junit.framework.TestCase; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertNotNull; +import org.junit.Assert; +import org.junit.Assume; +import org.junit.BeforeClass; +import org.junit.Test; import org.nuiton.mapstoragemanager.plugins.Plugin; import org.nuiton.mapstoragemanager.ui.MainUI; @@ -18,14 +24,34 @@ * * @author Dorian Langlais */ -public class PluginManagerTest extends TestCase { +public class PluginManagerTest { /** * Logger. */ private static final Log LOG = LogFactory.getLog(PluginManagerTest.class); + /** + * isHeadless is <b>true</b> if this environment cannot support + * a display, keyboard, and mouse, <b>false</b> otherwise. + */ + private static boolean isHeadless; + + /** + * Control if X11 Display is set. + */ + @BeforeClass + public static void isX11DisplaySet() { + isHeadless = java.awt.GraphicsEnvironment.isHeadless(); + } + + /** + * Test getPluginName. + */ + @Test public void testGetPluginName() { + Assume.assumeTrue(!isHeadless); + Plugin pluginManager = new PluginManager(); String expectedPluginName = pluginManager.getClass().getSimpleName(); String actualPluginName = pluginManager.getPluginName(); @@ -37,7 +63,10 @@ /** * Test load and unload plugin. */ + @Test public void testLoadUnload() { + Assume.assumeTrue(!isHeadless); + Plugin pluginManager = new PluginManager(); MainUI mainUI = MainUI.getInstance(); JMenu menuPlugin = mainUI.getMenuPlugin(); Modified: trunk/msm-pluginmanager/src/test/java/org/nuiton/mapstoragemanager/plugins/pluginmanager/PluginViewTest.java =================================================================== --- trunk/msm-pluginmanager/src/test/java/org/nuiton/mapstoragemanager/plugins/pluginmanager/PluginViewTest.java 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/msm-pluginmanager/src/test/java/org/nuiton/mapstoragemanager/plugins/pluginmanager/PluginViewTest.java 2010-03-18 18:07:59 UTC (rev 264) @@ -1,7 +1,8 @@ package org.nuiton.mapstoragemanager.plugins.pluginmanager; import javax.swing.JPanel; -import junit.framework.TestCase; +import static org.junit.Assert.assertEquals; +import org.junit.Test; /* * To change this template, choose Tools | Templates @@ -12,11 +13,12 @@ * * @author Dorian Langlais */ -public class PluginViewTest extends TestCase { +public class PluginViewTest { /** * Test to put and get a JPanel in the PluginView map. */ + @Test public void testPutAndGet() { String pluginName = "test"; JPanel pluginView = new JPanel(); Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2010-03-18 16:58:47 UTC (rev 263) +++ trunk/pom.xml 2010-03-18 18:07:59 UTC (rev 264) @@ -110,6 +110,7 @@ <jaxx.version>2.0</jaxx.version> <nuitonutils.version>1.2</nuitonutils.version> <i18n.version>1.1</i18n.version> + <junit.version>4.8.1</junit.version> <maven.jar.main.class>org.nuiton.mapstoragemanager.Main</maven.jar.main.class>