Mapstoragemanager-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- 329 discussions
r270 - in trunk/msm/src/main: java/org/nuiton/mapstoragemanager/ui/engine resources/i18n
by fgilet@users.nuiton.org 24 Mar '10
by fgilet@users.nuiton.org 24 Mar '10
24 Mar '10
Author: fgilet
Date: 2010-03-24 22:46:40 +0100 (Wed, 24 Mar 2010)
New Revision: 270
Log:
Changement de Listener sur l'arbre de navigation
Modified:
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/engine/ApplicationEngine.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/engine/MSMNavigationListener.java
trunk/msm/src/main/resources/i18n/msm-en_GB.properties
trunk/msm/src/main/resources/i18n/msm-fr_FR.properties
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/engine/ApplicationEngine.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/engine/ApplicationEngine.java 2010-03-24 17:27:14 UTC (rev 269)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/engine/ApplicationEngine.java 2010-03-24 21:46:40 UTC (rev 270)
@@ -194,7 +194,8 @@
for (final String nomPlugin : nomPlugins) {
JCheckBox pluginButton = new JCheckBox(nomPlugin);
pluginButton.setSize(buttonWidth, buttonHeight);
-
+ //boolean isSelected = isSelected(nomPlugin);
+ //pluginButton.setEnabled(isSelected);
buttonDisplay.add(pluginButton);
}
@@ -229,6 +230,38 @@
frameTemp.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
}
+
+ /**
+ * To know if plugins are active in .properties.
+ */
+// public boolean isSelected(String nomPluginToControl) {
+// final Properties properties = new Properties();
+// final File propertiesFile = new File(MSM_PLUGINS_DIR, ".properties");
+// try {
+// FileInputStream fis = new FileInputStream(propertiesFile);
+// properties.load(fis);
+// Set<Object> props = properties.keySet();
+// for (Object property : props) {
+// String nomPlugin = property.toString();
+// nomPlugin = nomPlugin.substring(nomPlugin.lastIndexOf('/')+1);
+// String isSelected = nomPlugin.substring(nomPlugin.lastIndexOf('"')+1);
+// LOG.info("isSelected : " + isSelected);
+// if(nomPluginToControl.equals(nomPlugin)){
+// if(isSelected.equals("false")){
+// return false;
+// }else{
+// return true;
+// }
+// }
+// }
+//
+// } catch(FileNotFoundException e){
+// LOG.fatal(e, e);
+// } catch (IOException ioe){
+// LOG.fatal(ioe, ioe);
+// }
+// return true;
+// }
/**
@@ -418,7 +451,7 @@
*/
private void uptableNavigationTree(JTree tree, String nameBase) {
tree.setModel(new MSMModel(nameBase));
- tree.addTreeSelectionListener(new MSMNavigationListener());
+ tree.addMouseListener(new MSMNavigationListener());
TreeModel model = tree.getModel();
DefaultMutableTreeNode root;
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/engine/MSMNavigationListener.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/engine/MSMNavigationListener.java 2010-03-24 17:27:14 UTC (rev 269)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/engine/MSMNavigationListener.java 2010-03-24 21:46:40 UTC (rev 270)
@@ -1,13 +1,17 @@
package org.nuiton.mapstoragemanager.ui.engine;
import java.awt.BorderLayout;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
import javax.swing.JLabel;
+import javax.swing.JMenuItem;
+import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JTable;
-import javax.swing.event.TreeSelectionEvent;
-import javax.swing.event.TreeSelectionListener;
+import javax.swing.SwingUtilities;
import javax.swing.tree.DefaultMutableTreeNode;
import org.nuiton.mapstoragemanager.ui.MainUI;
+import static org.nuiton.i18n.I18n._;
/**
* Listener on tree navigation in order to display table content.
@@ -15,13 +19,23 @@
* @author Copyright CodeLutin
* @since 0.1-SNAPSHOT
*/
-public class MSMNavigationListener implements TreeSelectionListener {
+public class MSMNavigationListener implements MouseListener {
- /**
- * {@inheritDoc}
+
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ if(SwingUtilities.isLeftMouseButton(e)){
+ leftButton(e);
+ } else if(SwingUtilities.isRightMouseButton(e)){
+ rightButton(e);
+ }
+ }
+
+ /**
+ * LEFT Button action.
+ * @param e event
*/
- @Override
- public final void valueChanged(final TreeSelectionEvent e) {
+ private void leftButton(MouseEvent e){
MainUI ui = MainUI.getInstance();
DefaultMutableTreeNode node;
@@ -61,6 +75,50 @@
ui.getTableName().revalidate();
}
+ /**
+ * RIGHT Button action.
+ * @param e event
+ */
+ private void rightButton(MouseEvent e){
+ JPopupMenu menu = new JPopupMenu();
+ JMenuItem anItem;
+ MainUI ui = MainUI.getInstance();
+ DefaultMutableTreeNode node;
+ node = (DefaultMutableTreeNode) ui.getNavigation().
+ getLastSelectedPathComponent();
+ if (node == null || node.isRoot()) {
+ anItem = new JMenuItem (_("add.table"));
+ //anItem.addActionListener(new AddtableListener());
+ } else if (node.isLeaf()) {
+ return;
+ } else {
+ anItem = new JMenuItem (_("add.column"));
+ //anItem.addActionListener(new AddcolumnListener());
+ }
+
+ menu.add(anItem);
+ menu.show(e.getComponent(), e.getX(), e.getY());
+ }
+
+ @Override
+ public void mousePressed(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseEntered(MouseEvent e) {
+
+ }
+
+ @Override
+ public void mouseExited(MouseEvent e) {
+
+ }
+
+
}
Modified: trunk/msm/src/main/resources/i18n/msm-en_GB.properties
===================================================================
--- trunk/msm/src/main/resources/i18n/msm-en_GB.properties 2010-03-24 17:27:14 UTC (rev 269)
+++ trunk/msm/src/main/resources/i18n/msm-en_GB.properties 2010-03-24 21:46:40 UTC (rev 270)
@@ -1,3 +1,5 @@
+add.table=Add a table
+add.column=Add a column
Empty=Empty
Export\ Database=
Exporter\ \:=
Modified: trunk/msm/src/main/resources/i18n/msm-fr_FR.properties
===================================================================
--- trunk/msm/src/main/resources/i18n/msm-fr_FR.properties 2010-03-24 17:27:14 UTC (rev 269)
+++ trunk/msm/src/main/resources/i18n/msm-fr_FR.properties 2010-03-24 21:46:40 UTC (rev 270)
@@ -1,3 +1,5 @@
+add.table=Ajouter une table
+add.column=Ajouter une colonne
Empty=Vide
Export\ Database=
Exporter\ \:=
1
0
r269 - trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase
by afages@users.nuiton.org 24 Mar '10
by afages@users.nuiton.org 24 Mar '10
24 Mar '10
Author: afages
Date: 2010-03-24 18:27:14 +0100 (Wed, 24 Mar 2010)
New Revision: 269
Log:
Modif HBase
Modified:
trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/HBase.java
trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/Main.java
Modified: trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/HBase.java
===================================================================
--- trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/HBase.java 2010-03-24 15:22:19 UTC (rev 268)
+++ trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/HBase.java 2010-03-24 17:27:14 UTC (rev 269)
@@ -13,14 +13,16 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.MasterNotRunningException;
-//import org.nuiton.mapstoragemanager.plugins.BigTable;
+import org.nuiton.mapstoragemanager.plugins.BigTable;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableExistsException;
+import org.apache.hadoop.hbase.TableNotDisabledException;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.HBaseAdmin;
+import org.apache.hadoop.hbase.client.HConnection;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
@@ -33,7 +35,7 @@
* @author Copyright CodeLutin
* @since 0.1-SNAPSHOT
*/
-public class HBase /*implements BigTable*/ {
+public class HBase implements BigTable {
/**
* Logger.
@@ -58,46 +60,42 @@
* The selected Table.
*/
private HTable selectedTable;
-// private HTable table;
-// private String familyName = "mylittlecolumnfamily";
-// private String rowName = "myLittleRow";
-// private String tableName = "mylittletable";
/**
* HBase plugin Constructor.
* @throws MasterNotRunningException
*/
public HBase() throws MasterNotRunningException {
- // You need a configuration object to tell the client where to connect.
- // When you create a HBaseConfiguration, it reads in whatever you've set
- // into your hbase-site.xml and in hbase-default.xml, as long as these can
- // be found on the CLASSPATH
- org.apache.hadoop.conf.Configuration conf =
- new org.apache.hadoop.conf.Configuration();
- config = new HBaseConfiguration(conf);
+ config = new HBaseConfiguration();
hBaseAdmin = new HBaseAdmin(config);
}
/**
* {@inheritDoc}
*/
-// @Override
+ @Override
public boolean connect(Properties properties) {
- throw new UnsupportedOperationException("Not supported yet.");
+ config = new HBaseConfiguration();
+ try {
+ hBaseAdmin = new HBaseAdmin(config);
+ return true;
+ } catch (MasterNotRunningException ex) {
+ LOG.error(ex, ex);
+ return false;
+ }
}
/**
* {@inheritDoc}
*/
-// @Override
+ @Override
public void createTable(String table) {
HTableDescriptor hTableDescriptor = new HTableDescriptor(table);
try {
- hBaseAdmin.createTable(hTableDescriptor);
- hBaseAdmin.enableTable(table);
+ HConnection hc = hBaseAdmin.getConnection();
+ hc.getMaster().createTable(hTableDescriptor);
LOG.trace("table " + table + " created.");
-
} catch (TableExistsException e) {
LOG.trace("table " + table + " already created.");
} catch (IOException ex) {
@@ -109,13 +107,16 @@
/**
* {@inheritDoc}
*/
-// @Override
+ @Override
public void deleteTable(String table) {
try {
- // to delete a table, we have to disable it.
- hBaseAdmin.disableTable(table);
- hBaseAdmin.deleteTable(table);
+ HConnection hc = hBaseAdmin.getConnection();
+ hc.getMaster().disableTable(table.getBytes());
+ hc.getMaster().deleteTable(table.getBytes());
LOG.trace("table " + table + " deleted.");
+
+ } catch (TableNotDisabledException e) {
+ LOG.trace("table " + table + " not disable.");
} catch (IOException ex) {
LOG.error(ex, ex);
}
@@ -124,7 +125,7 @@
/**
* {@inheritDoc}
*/
-// @Override
+ @Override
public Set<String> getTablesNames() {
Set<String> tablesNames = new HashSet<String>();
try {
@@ -144,17 +145,16 @@
/**
* {@inheritDoc}
*/
-// @Override
+ @Override
public void createColumn(String table, String column) {
- HColumnDescriptor hColumnDescriptor = new HColumnDescriptor(column);
+ try {
+ HColumnDescriptor hcolumnDescriptor = new HColumnDescriptor(column);
+ HConnection hc = hBaseAdmin.getConnection();
+ hc.getMaster().disableTable(table.getBytes());
+ hc.getMaster().addColumn(table.getBytes(), hcolumnDescriptor);
+ hc.getMaster().enableTable(table.getBytes());
+ LOG.trace("column " + column + " created.");
-
- try {
- //hBaseAdmin.disableTable(table);
- hBaseAdmin.getTableDescriptor(table.getBytes()).addFamily(hColumnDescriptor);
- //hBaseAdmin.addColumn(table, hColumnDescriptor);
- LOG.trace("colum " + column + " created in table " + table + ".");
- //hBaseAdmin.enableTable(table);
} catch (IOException ex) {
LOG.error(ex, ex);
}
@@ -163,13 +163,19 @@
/**
* {@inheritDoc}
*/
-// @Override
+ @Override
public void deleteColumn(String table, String column) {
+
+ /**
+ * Delete Column.
+ */
try {
- hBaseAdmin.disableTable(table);
- hBaseAdmin.deleteColumn(table, column);
- LOG.trace("colum " + column + " deleted from table " + table + ".");
- hBaseAdmin.enableTable(table);
+ HConnection hc = hBaseAdmin.getConnection();
+ hc.getMaster().disableTable(table.getBytes());
+ hc.getMaster().deleteColumn(table.getBytes(), column.getBytes());
+ hc.getMaster().enableTable(table.getBytes());
+ LOG.trace("column " + column + " created.");
+
} catch (IOException ex) {
LOG.error(ex, ex);
}
@@ -178,7 +184,7 @@
/**
* {@inheritDoc}
*/
-// @Override
+ @Override
public Set<String> getColumnsNames(String table) {
Set<String> columnsNames = new HashSet<String>();
// try {
@@ -212,7 +218,7 @@
/**
* {@inheritDoc}
*/
-// @Override
+ @Override
public void put(String table, String column, String key, String content) {
try {
Put put = new Put(key.getBytes());
@@ -233,7 +239,7 @@
/**
* {@inheritDoc}
*/
-// @Override
+ @Override
public String get(String table, String column, String key) {
String ret = "";
try {
@@ -259,7 +265,7 @@
/**
* {@inheritDoc}
*/
-// @Override
+ @Override
public String get(String table, String column, String key, int version) {
String ret = "";
try {
@@ -287,7 +293,7 @@
/**
* {@inheritDoc}
*/
-// @Override
+ @Override
public Map<String, String> getRow(String table, String key) {
Map<String, String> ret = new HashMap<String, String>();
try {
@@ -318,7 +324,7 @@
/**
* {@inheritDoc}
*/
-// @Override
+ @Override
public Set<String> getKeys(String table) {
Set<String> ret = new HashSet<String>();
try {
@@ -342,7 +348,7 @@
/**
* {@inheritDoc}
*/
-// @Override
+ @Override
public void selectTable(String table) {
try {
selectedTable = new HTable(config, table);
@@ -354,7 +360,7 @@
/**
* {@inheritDoc}
*/
-// @Override
+ @Override
public String getPluginName() {
return this.getClass().getSimpleName();
}
@@ -362,7 +368,7 @@
/**
* {@inheritDoc}
*/
-// @Override
+ @Override
public String getDescription() {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -370,7 +376,7 @@
/**
* {@inheritDoc}
*/
-// @Override
+ @Override
public void load() {
final String pluginName = getPluginName();
JMenu menuConnect = MainUI.getInstance().getMenuConnect();
@@ -397,7 +403,7 @@
/**
* {@inheritDoc}
*/
-// @Override
+ @Override
public void unload() {
JMenu menuConnect = MainUI.getInstance().getMenuConnect();
if(menuItemConnect != null) {
Modified: trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/Main.java
===================================================================
--- trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/Main.java 2010-03-24 15:22:19 UTC (rev 268)
+++ trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/Main.java 2010-03-24 17:27:14 UTC (rev 269)
@@ -1,11 +1,140 @@
package org.nuiton.mapstoragemanager.plugins.hbase;
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.hbase.ColumnNameParseException;
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.HColumnDescriptor;
+import org.apache.hadoop.hbase.HServerAddress;
+import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.MasterNotRunningException;
+import org.apache.hadoop.hbase.TableExistsException;
+import org.apache.hadoop.hbase.TableNotDisabledException;
+import org.apache.hadoop.hbase.client.HBaseAdmin;
+import org.apache.hadoop.hbase.client.HConnection;
+import org.apache.hadoop.hbase.client.HTable;
+import org.apache.hadoop.hbase.client.ServerCallable;
+import org.apache.hadoop.hbase.ipc.HRegionInterface;
+import org.apache.hadoop.hbase.util.Bytes;
-public class Main{
+public class Main {
- public static void main(String[] args) throws MasterNotRunningException {
- HBase hb = new HBase();
+ /**
+ * Logger.
+ */
+ private static final Log LOG = LogFactory.getLog(Main.class);
+
+ public static void main(String[] args) {
+ HBaseConfiguration conf = new HBaseConfiguration();
+ conf.set("hbase.client.pause", "1000");
+ conf.set("hbase.master.port", "60000");
+ conf.set("hbase.regionserver.port", "60020");
+ conf.set("hbase.regionserver.info.port", "60030");
+ conf.set("hbase.client.retries.number", "5");
+ HBaseAdmin hBaseAdmin = null;
+ try {
+ LOG.debug("BEGIN : hBaseAdmin = new HBaseAdmin(conf);");
+ hBaseAdmin = new HBaseAdmin(conf);
+ LOG.debug("END : hBaseAdmin = new HBaseAdmin(conf);");
+
+ } catch (MasterNotRunningException ex) {
+ LOG.fatal(ex, ex);
+ }
+
+ if (hBaseAdmin == null) {
+ LOG.debug("hbaseAdmin : NULL");
+ } else {
+ LOG.debug("hbaseAdmin : NOT NULL");
+ }
+
+ HConnection hc = hBaseAdmin.getConnection();
+ /**
+ * Create Table.
+ */
+ String tableName = null;
+ try {
+ tableName = "test";
+ HTableDescriptor hTableDescriptor = new HTableDescriptor(tableName);
+ hc.getMaster().createTable(hTableDescriptor);
+ LOG.trace("table " + tableName + " created.");
+
+ } catch (TableExistsException e) {
+ LOG.trace("table " + tableName + " already created.");
+ } catch (IOException ex) {
+ LOG.error(ex, ex);
+ }
+
+ /**
+ * Create Column.
+ */
+ String columnName = null;
+ try {
+ tableName = "test";
+ columnName = "testCol";
+ HColumnDescriptor hcolumnDescriptor = new HColumnDescriptor(columnName);
+ hc.getMaster().disableTable(tableName.getBytes());
+ hc.getMaster().addColumn(tableName.getBytes(), hcolumnDescriptor);
+ hc.getMaster().enableTable(tableName.getBytes());
+ LOG.trace("column " + columnName + " created.");
+
+ } catch (IOException ex) {
+ LOG.error(ex, ex);
+ }
+
+ /**
+ * List Tables.
+ */
+ HTableDescriptor[] hTableDesriptors = null;
+ try {
+ System.out.println(hc.listTables().length);
+ LOG.debug("BEGIN : hTableDesriptors = hc.listTables()");
+ hc.getMaster();
+ hc.tableExists(tableName.getBytes());
+ hTableDesriptors = hc.listTables();
+ LOG.debug("END : hTableDesriptors = hc.listTables()");
+ } catch (IOException ex) {
+ LOG.fatal(ex, ex);
+ }
+
+ for (HTableDescriptor htable : hTableDesriptors) {
+ LOG.debug(htable.getName());
+ }
+
+ /**
+ * List ColumnsNames.
+ */
+
+ /**
+ * Delete Column.
+ */
+ try {
+ tableName = "test";
+ columnName = "testCol";
+ hc.getMaster().disableTable(tableName.getBytes());
+ hc.getMaster().deleteColumn(tableName.getBytes(), columnName.getBytes());
+ hc.getMaster().enableTable(tableName.getBytes());
+ LOG.trace("column " + columnName + " deleted.");
+
+ } catch (IOException ex) {
+ LOG.error(ex, ex);
+ }
+
+ /**
+ * Delete Table.
+ */
+ try {
+ tableName = "test";
+ hc.getMaster().disableTable(tableName.getBytes());
+ hc.getMaster().deleteTable(tableName.getBytes());
+ LOG.trace("table " + tableName + " deleted.");
+
+ } catch (TableNotDisabledException e) {
+ LOG.trace("table " + tableName + " not disable.");
+ } catch (IOException ex) {
+ LOG.error(ex, ex);
+ }
}
-
-}
\ No newline at end of file
+}
1
0
Author: gcrieloue
Date: 2010-03-24 16:22:19 +0100 (Wed, 24 Mar 2010)
New Revision: 268
Log:
Ajout d'une conclusion et d'une section difficult?\195?\169s rencontr?\195?\169es au rapport.
Modified:
trunk/src/site/doc/rapport/rapport.rst
Modified: trunk/src/site/doc/rapport/rapport.rst
===================================================================
--- trunk/src/site/doc/rapport/rapport.rst 2010-03-24 14:35:10 UTC (rev 267)
+++ trunk/src/site/doc/rapport/rapport.rst 2010-03-24 15:22:19 UTC (rev 268)
@@ -45,8 +45,18 @@
* 3.2 plugins
* 3.3 ui
* 3.4 Initialisation et lancement de MSM
+4. Difficultés rencontrées
+5. Conclusion
+.. sidebar:: Contents
+
+ .. contents::
+
+.. sectnum::
+
+
+
1. Spécifications : préliminaires
=================================
@@ -388,4 +398,53 @@
Visualisation du contenu d'une table
.. Manuel utilisateur TODO
-.. Manuel développeur TODO
\ No newline at end of file
+.. Manuel développeur TODO
+
+4. Difficultés rencontrées
+==========================
+
+Concernant la partie graphique (JAXX), il a été difficile de comprendre toutes
+les subtilités telles que l'utilisation de JAXXContext, l'utilisation des
+clé/valeurs pour l'insertion d'images et l'internationalisation (I18N).
+
+L'inclusion de code java dans un fichier JAXX, lorsqu'il est conséquent est
+génant. En effet, les framework tels qu'Eclipse ou Netbeans ne le reconnaissent
+pas, ce qui complique le développement.
+
+Par rapport à l'architecture à plugins, nous sommes partis de l'idée que
+c'est l'application qui appelle les méthodes des plugins, qui eux implémentent
+une interface que l'application connait. Cependant, après discussion avec Mr
+Poussin, nous avons décidé d'opter pour le chemin inverse, bien plus souple.
+Ainsi, c'est le plugin qui connaît l'application, et par conséquent peut
+beaucoup plus facilement agir sur celle ci, sans les restrictions que l'autre
+méthode impliquait.
+
+Le problème le plus bloquant que nous ayons rencontré est l'utilisation
+d'HBase en java. En effet, interroger une base Hbase avec le client en ligne
+de commande fonctionne parfaitement, mais même le tutoriel de l'API Java
+d'HBase génère des erreurs. Nous avons passé du temps à essayer les différentes
+versions d'HBase, sans succès. Notre application est pourtant prête à accueillir
+tout type d'implémentation de BigTable tels que les plugins d'exemple créés.
+
+5. Conclusion
+=============
+
+Ce projet nous a permis de découvrir de nouvelles technologies telles que jaxx,
+qui nous a semblé très intéressant et que nous n'hésiterions pas à réutiliser
+dans de futurs projets.
+
+L'architecture de l'application nous a permit de rafraichir et améliorer nos
+connaissances sur les plugins en java.
+
+De plus, dans le cadre de ce projet, nous avons eu a internationaliser
+l'application en utilisant la bibliothéque I18N, très efficace et très utilisé
+en entreprise, malgrès notre méconnaissance initiale de cet outil.
+
+Travailler dans une équipe de professionnels nous a permis d'aquérir un peu de
+leur expérience et les réunions au sein de leur entreprise ont été très
+enrichissantes. Utiliser leurs méthodologie et outils (tel que Hudson et
+les listes de diffusion) nous a initié au travail en équipe en entreprise.
+
+Enfin, la structure de notre application, pensée pour être évolutive permet
+la continuité de celle ci par d'autres développeurs.
+
1
0
Author: gcrieloue
Date: 2010-03-24 15:35:10 +0100 (Wed, 24 Mar 2010)
New Revision: 267
Log:
Mise ?\195?\160 jour du rapport (mise ?\195?\160 jour de la partie conception, sommaire ajout?\195?\169, typos), ajout d'une capture d'?\195?\169cran.
Added:
trunk/src/site/doc/rapport/img/screenshot_view_content.png
Modified:
trunk/src/site/doc/rapport/rapport.rst
Added: trunk/src/site/doc/rapport/img/screenshot_view_content.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/doc/rapport/img/screenshot_view_content.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/src/site/doc/rapport/rapport.rst
===================================================================
--- trunk/src/site/doc/rapport/rapport.rst 2010-03-21 00:37:51 UTC (rev 266)
+++ trunk/src/site/doc/rapport/rapport.rst 2010-03-24 14:35:10 UTC (rev 267)
@@ -11,7 +11,43 @@
:Version: 1.0 of 9/03/10
:Dedication: To Code Lutin & Université de Nantes
+Remerciements
+=============
+
+Avant tout chose, nous tenons à remercier toute l'équipe de Code Lutin qui nous
+a apporté une aide précieuse à l'élaboration du projet, en nous indiquant les
+démarches générales à entreprendre. Nous tenons aussi, tout particulièrement, à
+remercier Mr Poussin qui nous a guidé jusqu'ici.
+
+Nous remercions également l'Université de Nantes et l'entreprise Code Lutin pour
+avoir proposé ce sujet intéressant sur lequel nous avons pu progresser.
+
+Sommaire
+========
+
1. Spécifications : préliminaires
+* 1.1 Le demandeur
+* 1.2 La demande
+* 1.3 Objectifs
+* 1.4 Outils
+* 1.5 Chiffrage et organisation
+2. Spécifications : analyse
+* 2.1 Analyse des technologies
+* 2.1.1 Maven
+* 2.1.2 Jaxx
+* 2.1.3 Jmx
+* 2.2 Analyse du domaine
+* 2.3 Description des cas d'utilisation
+* 2.3.1 Modèle du domaine
+* 2.3.2 Architecture globale (Packages)
+3. Conception
+* 3.1 pluginloader
+* 3.2 plugins
+* 3.3 ui
+* 3.4 Initialisation et lancement de MSM
+
+
+1. Spécifications : préliminaires
=================================
1.1 Le demandeur
@@ -75,21 +111,21 @@
Voyons voir ce qui se cache derrière le nom de code MSM
(Map Storage Manager) :
-Il se trouve que Facebook, Amazone etc. utilisent depuis déjà un moment
+Il se trouve que Facebook, Amazon, etc. utilisent depuis déjà un moment
une spécification d'un système de gestion de base de données
innovant. Il s'agit de la spécification BigTable créée par Google Corp.
-Parmis les implémentations existantes de cette spécification, on trouve
+Parmi les implémentations existantes de cette spécification, on trouve
diverses bases telle que Hbase, Cassandra (Facebook)... Le concept
est relativement simple puisqu'il repose sur un principe <clé, valeur>
de type HashMap.
-Il existe dors et déjà des systèmes en ligne de commande. Toutefois, Code
+Il existe d'ores et déjà des systèmes en ligne de commande. Toutefois, Code
Lutin souhaite réaliser une application graphique permettant de visualiser
et manipuler les données au sein de telles bases, principalement HBase.
De plus, nous devons prévoir le fait que des implémentations de BigTable
naissent régulièrement et qu'un utilisateur expert de MSM pourrait
-souhaiter utiliser une nouvelle base. Il s'agit donc d'une architecture
-à plugins sous-jacente.
+souhaiter utiliser une nouvelle base. Ce qui justifie le fait de concevoir une
+architecture à plugins.
1.3 Objectifs
-------------
@@ -106,15 +142,15 @@
* SVN : Dépôt de Code Lutin prévu à cet effet
- Architecture Maven comportant un pom.xml natif à Code Lutin
- permettant l'utilisation d'artifact JAXX notamment.
+ permettant l'utilisation d'artefact JAXX notamment.
* Intégration continue : Hudson
- Site répertoriant un ensemble de statistiques sur chaque projet et
effectuant compilation et jeux de tests à chaque validation sur
- le dépôt de manière automatique.
+ le dépôt de manière automatique, ainsi qu'un contrôle de qualité du code.
-* Communication : Maillist de Nuiton pour le développement, l'utilisation et le commit.
+* Communication : Mailing list de Nuiton pour le développement, l'utilisation et le commit.
1.5 Chiffrage et organisation
-----------------------------
@@ -135,8 +171,8 @@
* 18/02/2010
* 04/03/2010
-Permettant à chaque fois de faire le point sur le travail réalisé et le
-travail à faire.
+Ces derniers permettent à chaque fois de faire le point sur le travail réalisé
+et le travail à faire.
Un compte rendu symbolisé par les rectangles noirs en fin de semaine
suit chaque réunion.
@@ -152,10 +188,10 @@
Maven est connu d'un bon nombre de développeurs. Il s'agit d'un outil de
développement permettant de faciliter la compilation, la documentation,
-les tests et surtout les dépendances récupérées automatiquement sur
-l'Internet.
+les tests et surtout la gestion de dépendances qui sont récupérées
+automatiquement sur Internet.
Le fichier de description d'un projet Maven est un pom.xml.
-Code Lutin dispose de leur propre pom.xml permettant d'aller récupérer
+Code Lutin dispose de leur propre pom.xml permettant de récupérer
les dépendances qui vont suivre.
2.1.2 Jaxx
@@ -163,9 +199,9 @@
Jaxx est un framework permettant de générer une interface graphique en
SWING (Java). SWING est parfois fastidieux à gérer et le code n'est
-pas toujours très propre, nous pensons notamment à la gestion des conteneurs,
-aux styles graphique,... Le but de Jaxx est donc de contraindre un
-développeur à obtenir du code propre et performant en SWING.
+pas toujours propre, nous pensons notamment à la gestion des conteneurs,
+aux styles graphique,... Le but de Jaxx est donc de faciliter le développement
+d'applications SWING tout en fournissant un code lisible.
Le principe est très simple. On définit les éléments de la vue
(les composants graphiques), les contrôleurs, les classes Java à utiliser
@@ -174,20 +210,19 @@
Il faut savoir qu'à l'origine, Jaxx est un projet récupéré par Code Lutin
qui l'a fait évoluer jusqu'à atteindre une version 2.0.
-La dépendance est explicitée dans le fichier pom.xml de l'entreprise.
-Plus de précisions à cet endroit :
+Plus de précisions à cette adresse :
http://maven-site.nuiton.org/jaxx/index.html
2.1.3 Jmx
~~~~~~~~~
-Jmx est une API Java permettant à la base de gérer la dynamique d'une
+Jmx est une API Java permettant de gérer la dynamique d'une
application en cours d'exécution. Elle permet notamment de faire du paramétrage
-(modification dynamique), modifier les fichiers de configurations, générer
+(dynamique), modifier les fichiers de configurations, générer
des statistiques, notifier ...
-Dans notre cadre, nous nous en servirons pour réaliser un monitoring de
+Dans notre cadre, nous pensions l'utiliser pour réaliser un monitoring de
l'application.
Plus de détails sur le Wiki :
@@ -219,7 +254,7 @@
Diagramme de classes du domaine
-De manière très simple, l'application MSM utilise un ensemble de bases
+De manière simplifiée, l'application MSM utilise un ensemble de bases
de données BigTable qui peuvent être de type HashMap, HBase ou Cassandra ou
d'autres. L'application doit permettre de réaliser l'ensemble des
fonctionnalités prévues sur cet ensemble de bases de données BigTable.
@@ -233,24 +268,28 @@
Diagramme de packages
En réalité, on veut donner la possibilité à un développeur d'intégrer
-la base et les fonctionnalités qu'il souhaite dans MSM. L'application doit
-donc être découpée en modules (packages).
+la base et les fonctionnalités qu'il souhaite dans MSM. L'application a été
+découpée en packages.
-Trois modules principaux composent l'application. On trouve le module
-*Plugin* correspondant à chaque base et dépendant du module
-gérant l'interface graphique, *Gui*, ainsi que du module *Msm* qui n'est autre
-que le coeur de l'application, véritable architecture à plugins.
+Trois packages composent l'application. On trouve le module
+*Plugins* correspondant aux interfaces des plugins,
+*ui* décrivant l'interface graphique, ainsi que du module *pluginloader*
+qui s'occupe du chargement des plugins.
+Le package ui contient un quatrième package, *engine*, qui est le contrôleur
+de l'interface graphique.
+
+
3. Conception
=============
-3.1 Msm (Core)
+3.1 pluginloader
--------------
.. figure:: img/msm.png
:scale: 400%
- Diagramme de classes de conception du module msm
+ Diagramme de classes de conception du package pluginloader
Le coeur de MSM est constitué principalement d'une architecture à plugins.
Un PluginLoader étend un URLClassLoader. On construit un PluginLoader
@@ -261,19 +300,19 @@
dans le PluginLoader. On utilise ensuite un ServiceLoader de Java pour charger
chacun des plugins de chaque type (BigTable, Importer, Exporter, Monitoring).
-Finallement, on stocke chaque plugin dans une Map dont la clé est le nom
+Finalement, on stocke chaque plugin dans une Map dont la clé est le nom
du plugin (un plugin doit implémenter la méthode getPluginName()).
Le PluginLoader propose ensuite différents services permettant de récupérer,
d'utiliser les différents plugins.
-3.2 Plugin
+3.2 plugins
----------
.. figure:: img/plugin.png
:scale: 400%
- Diagramme de classes de conception du module plugin
+ Diagramme de classes de conception du package plugins
Un plugin est avant tout décrit via une interface *Plugin* permettant de
s'auto-décrire, se charger, se désactiver. Lorsqu'un plugin se charge, il
@@ -293,7 +332,7 @@
Un développeur voulant rajouter une nouvelle base doit donc implémenter cette
interface.
-3.3 GUI
+3.3 ui
-------
.. figure:: img/ui.png
@@ -302,33 +341,32 @@
Diagramme de classes de conception du module gui
Comme dit précédemment, on utilise JAXX pour générer automatiquement une
-classe SWING. En l'occurence, la classe MainUI faisant office de Vue dans
+classe en SWING. En l'occurence, la classe MainUI faisant office de Vue dans
notre framework MVC. Cette vue est une frame composée de plusieurs composants
SWING associés à leur listener et modèles de données le cas échéant.
La vue ainsi générée implémente l'interface JaxxObject et est un type
-d'application Jaxx. Il existe une uniquement instance de l'application,
+d'application Jaxx. Il existe une unique instance de l'application,
implémentée grâce au pattern Singleton et récupérable via la méthode
getInstance() en statique.
On trouve ensuite le contrôleur, ApplicationEngine qui connaît la vue du
-module *gui*, l'interface BigTable du module *plugin* (une seule
+package *ui*, l'interface BigTable du module *plugin* (une seule
implémentation de BigTable à la fois est possible, et ApplicationEngine
-la connaît) et le PluginLoader du module *msm*. Il fait office de pivot
-entre les trois modules. On y trouve les différentes méthodes appelées depuis
-l'application MainUI ainsi qu'une méthode pour charger un plugin à partir
+la connaît) et le PluginLoader. On y trouve les différentes méthodes appelées
+depuis l'application MainUI ainsi qu'une méthode pour charger un plugin à partir
du PluginLoader. C'est également un singleton récupéré grâce à la méthode
statique getInstance().
Grâce à la technologie JAXX, on peut établir une feuille de style propre à
-notre application mais qui pourra être reutiliser si besoin. Cela offre une
-flexibilité dans la création de l'interface graphique puisqu'on a un découpage
-entre les éléments graphique, le style attribué et les actions sur ces éléments.
+notre application mais qui pourra être réutilisée si besoin. Cela offre une
+flexibilité dans la création de l'interface graphique puisque cela permet un
+découpage entre les éléments graphique et le style qui leur est attribué.
3.4 Initialisation et lancement de MSM
--------------------------------------
Au lancement du programme principal, l'instance de MainUI est récupérée,
-la configuration autour de Msm concernant notamment la localisation
+la configuration autour de MSM concernant notamment la localisation
(gérée par des classes i18n propres à Code Lutin et dont les dépendances
sont écrites dans le pom.xml du projet) également.
@@ -339,7 +377,15 @@
on fait appel au contrôleur ApplicationEngine (défini à chaque appel dans
le fichier MainUI.jaxx et donc généré tel quel dans MainUI) qui se charge
de faire le lien entre les différents plugins de son PluginLoader et
-l'interface graphique, qu'il peut modifier à sa guise.
+l'interface graphique.
+3.5 Captures d'écran
+--------------------
+
+.. figure:: img/screenshot_view_content.png
+ :scale: 400%
+
+ Visualisation du contenu d'une table
+
.. Manuel utilisateur TODO
-.. Manuel développeur TODO
+.. Manuel développeur TODO
\ No newline at end of file
1
0
r266 - in trunk: msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter msm-monitoring-plugins/src/main/java/org/nuiton/monitoring
by dlanglais@users.nuiton.org 21 Mar '10
by dlanglais@users.nuiton.org 21 Mar '10
21 Mar '10
Author: dlanglais
Date: 2010-03-21 01:37:51 +0100 (Sun, 21 Mar 2010)
New Revision: 266
Log:
Suppression annotation @Test sur methode createXMLDocument() qui n'est pas une m?\195?\169thode de test.
Suppression tabulation sur fichier ShowDiskSpace.java.
Modified:
trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLTest.java
trunk/msm-monitoring-plugins/src/main/java/org/nuiton/monitoring/ShowDiskSpace.java
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-19 11:53:50 UTC (rev 265)
+++ trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLTest.java 2010-03-21 00:37:51 UTC (rev 266)
@@ -76,7 +76,6 @@
/**
* Create a bigTable database and a XMLDocument representing the database.
*/
- @Test
public void createXMLDocument() {
actual = null;
Modified: trunk/msm-monitoring-plugins/src/main/java/org/nuiton/monitoring/ShowDiskSpace.java
===================================================================
--- trunk/msm-monitoring-plugins/src/main/java/org/nuiton/monitoring/ShowDiskSpace.java 2010-03-19 11:53:50 UTC (rev 265)
+++ trunk/msm-monitoring-plugins/src/main/java/org/nuiton/monitoring/ShowDiskSpace.java 2010-03-21 00:37:51 UTC (rev 266)
@@ -60,7 +60,7 @@
File f = new File(new File("").getAbsolutePath()).getParentFile();
if (f.exists()) {
- //show free disk space
+ //show free disk space
final long freeSpaceByte = f.getFreeSpace();
final long totalSpaceByte = f.getTotalSpace();
final long usableSpaceByte = f.getUsableSpace();
1
0
r265 - in trunk: msm/src/main/java/org/nuiton/mapstoragemanager/ui msm/src/main/java/org/nuiton/mapstoragemanager/ui/engine msm-monitoring-plugins/src/main/java/org/nuiton/monitoring
by dlanglais@users.nuiton.org 19 Mar '10
by dlanglais@users.nuiton.org 19 Mar '10
19 Mar '10
Author: dlanglais
Date: 2010-03-19 12:53:50 +0100 (Fri, 19 Mar 2010)
New Revision: 265
Log:
Correction concernant la qualit?\195?\169 du code.
Modified:
trunk/msm-monitoring-plugins/src/main/java/org/nuiton/monitoring/ShowDiskSpace.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/BootLoaderManager.jaxx
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/engine/ApplicationEngine.java
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/BootLoaderManager.jaxx
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/BootLoaderManager.jaxx 2010-03-18 18:07:59 UTC (rev 264)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/BootLoaderManager.jaxx 2010-03-19 11:53:50 UTC (rev 265)
@@ -48,7 +48,7 @@
/** Load properties file of the folder. */
final Properties properties = new Properties();
- final File propertiesFile = new File(ApplicationEngine.getInstance().getMSM_PLUGINS_DIR(), ".properties");
+ final File propertiesFile = new File(ApplicationEngine.getInstance().getMSMPLUGINSDIR(), ".properties");
try {
FileInputStream fis = new FileInputStream(propertiesFile);
properties.load(fis);
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/engine/ApplicationEngine.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/engine/ApplicationEngine.java 2010-03-18 18:07:59 UTC (rev 264)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/engine/ApplicationEngine.java 2010-03-19 11:53:50 UTC (rev 265)
@@ -86,7 +86,7 @@
* Getter for MSM_BASEDIR.
* @return MSM_BASEDIR
*/
- public static File getMSM_BASEDIR() {
+ public static File getMSMBASEDIR() {
return MSM_BASEDIR;
}
@@ -94,7 +94,7 @@
* Getter for MSM_PLUGINS_DIR.
* @return MSM_PLUGINS_DIR
*/
- public static File getMSM_PLUGINS_DIR() {
+ public static File getMSMPLUGINSDIR() {
return MSM_PLUGINS_DIR;
}
@@ -160,7 +160,7 @@
* Save plugin for next application reload.
*/
public void savePlugin() {
- PluginLoader pluginLoaderTemp = getPluginLoader();
+
final JPanel buttonDisplay = new JPanel(new GridLayout(20,3));
final JPanel content = new JPanel(new BorderLayout());
@@ -177,7 +177,7 @@
Set<Object> props = properties.keySet();
for (Object property : props) {
String nomPlugin = property.toString();
- nomPlugin = nomPlugin.substring(nomPlugin.lastIndexOf("/")+1);
+ nomPlugin = nomPlugin.substring(nomPlugin.lastIndexOf('/')+1);
nomPlugins.add(nomPlugin);
mapPlugins.put(nomPlugin, property.toString());
}
@@ -188,12 +188,12 @@
LOG.fatal(ioe, ioe);
}
-
+ final int buttonWidth = 100;
+ final int buttonHeight = 20;
- for(final String nomPlugin : nomPlugins) {
-
+ for (final String nomPlugin : nomPlugins) {
JCheckBox pluginButton = new JCheckBox(nomPlugin);
- pluginButton.setSize(100, 20);
+ pluginButton.setSize(buttonWidth, buttonHeight);
buttonDisplay.add(pluginButton);
}
@@ -205,17 +205,16 @@
@Override
public void actionPerformed(ActionEvent e) {
Component[] components = buttonDisplay.getComponents();
- for(final Component comp : components){
+ for (final Component comp : components) {
JCheckBox buttonTemp = (JCheckBox) comp;
//if disable, write false into .properties
- if(!buttonTemp.isSelected()){
+ if (!buttonTemp.isSelected()) {
properties.put(mapPlugins.get(buttonTemp.getText()), "false");
try {
- properties.store(new FileOutputStream(propertiesFile), null);
-
- } catch (IOException ex) {
- LOG.error(ex, ex);
- }
+ properties.store(new FileOutputStream(propertiesFile), null);
+ } catch (IOException ex) {
+ LOG.error(ex, ex);
+ }
}
}
frameTemp.dispose();
Modified: trunk/msm-monitoring-plugins/src/main/java/org/nuiton/monitoring/ShowDiskSpace.java
===================================================================
--- trunk/msm-monitoring-plugins/src/main/java/org/nuiton/monitoring/ShowDiskSpace.java 2010-03-18 18:07:59 UTC (rev 264)
+++ trunk/msm-monitoring-plugins/src/main/java/org/nuiton/monitoring/ShowDiskSpace.java 2010-03-19 11:53:50 UTC (rev 265)
@@ -26,17 +26,7 @@
* Number for division byte -> Mb -> Gb.
*/
private static final int DIV = 1024;
-
-// /**
-// * Width of the frame.
-// */
-// private static final int FRAME_WIDTH = 300;
-
-// /**
-// * Height of the frame.
-// */
-// private static final int FRAME_HEIGHT = 300;
-
+
/**
* MenuItemBigTable.
*/
@@ -69,7 +59,7 @@
JPanel content = new JPanel();
File f = new File(new File("").getAbsolutePath()).getParentFile();
if (f.exists()) {
-
+
//show free disk space
final long freeSpaceByte = f.getFreeSpace();
final long totalSpaceByte = f.getTotalSpace();
1
0
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>
1
0
Author: dlanglais
Date: 2010-03-18 17:58:47 +0100 (Thu, 18 Mar 2010)
New Revision: 263
Log:
Utilisation de jaxx-2.0 en version release.
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-03-18 15:56:06 UTC (rev 262)
+++ trunk/pom.xml 2010-03-18 16:58:47 UTC (rev 263)
@@ -107,7 +107,7 @@
<properties>
<projectId>mapstoragemanager</projectId>
- <jaxx.version>2.0.0-beta-5</jaxx.version>
+ <jaxx.version>2.0</jaxx.version>
<nuitonutils.version>1.2</nuitonutils.version>
<i18n.version>1.1</i18n.version>
1
0
r262 - trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase
by gcrieloue@users.nuiton.org 18 Mar '10
by gcrieloue@users.nuiton.org 18 Mar '10
18 Mar '10
Author: gcrieloue
Date: 2010-03-18 16:56:06 +0100 (Thu, 18 Mar 2010)
New Revision: 262
Log:
Ajout d'un client simple pour HBase.
Added:
trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/MyLittleHBaseClient.java
Modified:
trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/Main.java
Modified: trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/Main.java
===================================================================
--- trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/Main.java 2010-03-18 14:35:50 UTC (rev 261)
+++ trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/Main.java 2010-03-18 15:56:06 UTC (rev 262)
@@ -0,0 +1,11 @@
+package org.nuiton.mapstoragemanager.plugins.hbase;
+
+import org.apache.hadoop.hbase.MasterNotRunningException;
+
+public class Main{
+
+ public static void main(String[] args) throws MasterNotRunningException {
+ HBase hb = new HBase();
+ }
+
+}
\ No newline at end of file
Added: trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/MyLittleHBaseClient.java
===================================================================
--- trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/MyLittleHBaseClient.java (rev 0)
+++ trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/MyLittleHBaseClient.java 2010-03-18 15:56:06 UTC (rev 262)
@@ -0,0 +1,108 @@
+package org.nuiton.mapstoragemanager.plugins.hbase;
+
+import java.io.IOException;
+
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.HColumnDescriptor;
+import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.client.Get;
+import org.apache.hadoop.hbase.client.HBaseAdmin;
+import org.apache.hadoop.hbase.client.HTable;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.client.ResultScanner;
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.util.Bytes;
+
+
+// Class that has nothing but a main.
+// Does a Put, Get and a Scan against an hbase table.
+public class MyLittleHBaseClient {
+ public static void main(String[] args) throws IOException {
+ // You need a configuration object to tell the client where to connect.
+ // When you create a HBaseConfiguration, it reads in whatever you've set
+ // into your hbase-site.xml and in hbase-default.xml, as long as these can
+ // be found on the CLASSPATH
+ HBaseConfiguration config = new HBaseConfiguration();
+ String tableName = "myLittleHBaseTable";
+ /*
+ HTableDescriptor hTableDescriptor = new HTableDescriptor(tableName);
+ //hTableDescriptor.addFamily(new HColumnDescriptor("myColumnFamily"));
+ HBaseAdmin hBaseAdmin = new HBaseAdmin(config);
+
+ try{
+ hBaseAdmin.createTable(hTableDescriptor);
+ hBaseAdmin.enableTable(tableName);
+ }
+ catch(org.apache.hadoop.hbase.TableExistsException e){
+ System.out.println("Table "+tableName+" already created.");
+ }
+*/
+ // This instantiates an HTable object that connects you to
+ // the "myLittleHBaseTable" table.
+ HTable table = new HTable(config, tableName);
+ System.out.println("HTable table = new HTable(config, tableName);");
+
+ // To add to a row, use Put. A Put constructor takes the name of the row
+ // you want to insert into as a byte array. In HBase, the Bytes class has
+ // utility for converting all kinds of java types to byte arrays. In the
+ // below, we are converting the String "myLittleRow" into a byte array to
+ // use as a row key for our update. Once you have a Put instance, you can
+ // adorn it by setting the names of columns you want to update on the row,
+ // the timestamp to use in your update, etc.If no timestamp, the server
+ // applies current time to the edits.
+ Put p = new Put(Bytes.toBytes("myLittleRow"));
+
+ // To set the value you'd like to update in the row 'myLittleRow', specify
+ // the column family, column qualifier, and value of the table cell you'd
+ // like to update. The column family must already exist in your table
+ // schema. The qualifier can be anything. All must be specified as byte
+ // arrays as hbase is all about byte arrays. Lets pretend the table
+ // 'myLittleHBaseTable' was created with a family 'myLittleFamily'.
+ p.add(Bytes.toBytes("myLittleFamily"), Bytes.toBytes("someQualifier"),
+ Bytes.toBytes("Some Value"));
+
+ // Once you've adorned your Put instance with all the updates you want to
+ // make, to commit it do the following (The HTable#put method takes the
+ // Put instance you've been building and pushes the changes you made into
+ // hbase)
+ table.put(p);
+
+ // Now, to retrieve the data we just wrote. The values that come back are
+ // Result instances. Generally, a Result is an object that will package up
+ // the hbase return into the form you find most palatable.
+ Get g = new Get(Bytes.toBytes("myLittleRow"));
+ Result r = table.get(g);
+ byte [] value = r.getValue(Bytes.toBytes("myLittleFamily"),
+ Bytes.toBytes("someQualifier"));
+ // If we convert the value bytes, we should get back 'Some Value', the
+ // value we inserted at this location.
+ String valueStr = Bytes.toString(value);
+ System.out.println("GET: " + valueStr);
+
+ // Sometimes, you won't know the row you're looking for. In this case, you
+ // use a Scanner. This will give you cursor-like interface to the contents
+ // of the table. To set up a Scanner, do like you did above making a Put
+ // and a Get, create a Scan. Adorn it with column names, etc.
+ Scan s = new Scan();
+ s.addColumn(Bytes.toBytes("myLittleFamily"), Bytes.toBytes("someQualifier"));
+ ResultScanner scanner = table.getScanner(s);
+ try {
+ // Scanners return Result instances.
+ // Now, for the actual iteration. One way is to use a while loop like so:
+ for (Result rr = scanner.next(); rr != null; rr = scanner.next()) {
+ // print out the row we found and the columns we were looking for
+ System.out.println("Found row: " + rr);
+ }
+
+ // The other approach is to use a foreach loop. Scanners are iterable!
+ // for (Result rr : scanner) {
+ // System.out.println("Found row: " + rr);
+ // }
+ } finally {
+ // Make sure you close your scanners when you are done!
+ // Thats why we have it inside a try/finally clause
+ scanner.close();
+ }
+ }
+}
1
0
r261 - in trunk: msm/src/main/java/org/nuiton/mapstoragemanager msm/src/main/java/org/nuiton/mapstoragemanager/ui msm/src/main/resources msm-monitoring-plugins/src/main/java/org/nuiton/monitoring
by fgilet@users.nuiton.org 18 Mar '10
by fgilet@users.nuiton.org 18 Mar '10
18 Mar '10
Author: fgilet
Date: 2010-03-18 15:35:50 +0100 (Thu, 18 Mar 2010)
New Revision: 261
Log:
Petits changements sur plugin Monitoring
Panel de message mieux g?\195?\169rer
Modified:
trunk/msm-monitoring-plugins/src/main/java/org/nuiton/monitoring/ShowDiskSpace.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/Main.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.jaxx
trunk/msm/src/main/resources/msm.properties
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/Main.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/Main.java 2010-03-18 14:09:27 UTC (rev 260)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/Main.java 2010-03-18 14:35:50 UTC (rev 261)
@@ -95,7 +95,7 @@
}
n_("messageEntry");
String message = _("messageEntry");
- ui.displayMessage(message, 1);
+ ui.displayMessage(message, 0);
}
/**
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.jaxx
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.jaxx 2010-03-18 14:09:27 UTC (rev 260)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.jaxx 2010-03-18 14:35:50 UTC (rev 261)
@@ -89,16 +89,17 @@
this.getMessagesPanel().removeAll();
//display message
- if (code==0){
- String icon ="ok_16";
+ String icon = "ok_16";
+ if (code==0){
+ icon ="ok_16";
}else if (code==1){
- String icon ="warning_16.png";
+ icon ="warning_16";
}else if (code==2){
- String icon ="cancel_16.png";
+ icon ="cancel_16";
}
JLabel label = new JLabel(message);
- label.setIcon(jaxx.runtime.SwingUtil.getUIManagerActionIcon("ok_16"));
+ label.setIcon(jaxx.runtime.SwingUtil.getUIManagerActionIcon(icon));
this.getMessagesPanel().add(label);
this.getMessagesPanel().repaint();
this.getMessagesPanel().revalidate();
Modified: trunk/msm/src/main/resources/msm.properties
===================================================================
--- trunk/msm/src/main/resources/msm.properties 2010-03-18 14:09:27 UTC (rev 260)
+++ trunk/msm/src/main/resources/msm.properties 2010-03-18 14:35:50 UTC (rev 261)
@@ -1,5 +1,9 @@
icon.action.ok_16=ok_16.png
icon.action.ok_32=ok_32.png
+icon.action.warning_16=warning_16.png
+icon.action.warning_32=warning_32.png
+icon.action.cancel_16=cancel_16.png
+icon.action.cancel_32=cancel_32.png
icon.action.database_16=database_16.png
icon.action.database_32=database_32.png
icon.action.login_16=login_16.png
Modified: trunk/msm-monitoring-plugins/src/main/java/org/nuiton/monitoring/ShowDiskSpace.java
===================================================================
--- trunk/msm-monitoring-plugins/src/main/java/org/nuiton/monitoring/ShowDiskSpace.java 2010-03-18 14:09:27 UTC (rev 260)
+++ trunk/msm-monitoring-plugins/src/main/java/org/nuiton/monitoring/ShowDiskSpace.java 2010-03-18 14:35:50 UTC (rev 261)
@@ -10,6 +10,7 @@
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
+import javax.swing.JSeparator;
import org.nuiton.mapstoragemanager.plugins.Plugin;
import org.nuiton.mapstoragemanager.ui.MainUI;
@@ -42,6 +43,16 @@
private static JMenuItem menuItemPlugin;
/**
+ * Active Panel.
+ */
+ private JPanel nbFreePluginPanel;
+
+ /**
+ * Lock to avoid multi plugin.
+ */
+ private boolean instance = false;
+
+ /**
* Constructor.
*/
public ShowDiskSpace() {
@@ -52,6 +63,7 @@
*/
// @Override
public void display() {
+ instance=true;
//creation of content
JPanel content = new JPanel();
@@ -116,15 +128,14 @@
+ new DecimalFormat("0.00").format(maxMemoryGb) + " Gb)"));
//position of plugin
- JPanel nbFreePluginPanel = MainUI.getInstance().getFreePluginPanel();
+ nbFreePluginPanel = MainUI.getInstance().getFreePluginPanel();
if (nbFreePluginPanel==null){
this.setContentPane(content);
this.pack();
this.setVisible(true);
}else{
nbFreePluginPanel.add(content);
- nbFreePluginPanel.repaint();
- nbFreePluginPanel.revalidate();
+ refresh();
}
}
@@ -161,6 +172,9 @@
final JMenuItem menuItemDisplay = new JMenuItem("Display");
menuItemPlugin.add(menuItemDisplay);
+ final JMenuItem menuItemHide = new JMenuItem("Hide");
+ menuItemPlugin.add(menuItemHide);
+ menuItemPlugin.add(new JSeparator());
final JMenuItem menuItemDelete = new JMenuItem("Delete");
menuItemPlugin.add(menuItemDelete);
@@ -169,9 +183,20 @@
menuItemDisplay.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- display();
+ if(!instance){
+ display();
+ }else{
+ MainUI.getInstance().displayMessage("Le plugin est déjà activé", 1);
+ }
}
});
+
+ menuItemHide.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ hideContent();
+ }
+ });
menuItemDelete.addActionListener(new ActionListener() {
@Override
@@ -191,5 +216,25 @@
menuPlugin.remove(menuItemPlugin);
menuItemPlugin = null;
}
+ nbFreePluginPanel.removeAll();
+ instance=false;
+ refresh();
}
+
+ /**
+ * Hide content
+ */
+ public void hideContent() {
+ nbFreePluginPanel.removeAll();
+ instance=false;
+ refresh();
+ }
+
+ /**
+ * Refresh content.
+ */
+ private void refresh(){
+ nbFreePluginPanel.repaint();
+ nbFreePluginPanel.revalidate();
+ }
}
1
0