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
February 2010
- 7 participants
- 101 discussions
28 Feb '10
Author: dlanglais
Date: 2010-02-28 18:58:02 +0100 (Sun, 28 Feb 2010)
New Revision: 150
Added:
trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/package-info.java
trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/importer/package-info.java
trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/package-info.java
Modified:
trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/package-info.java
trunk/msm-bighashmapV2/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/package-info.java
Log:
ajout des package-info.java manquants.
Modified: trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/package-info.java
===================================================================
--- trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/package-info.java 2010-02-28 17:51:58 UTC (rev 149)
+++ trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/package-info.java 2010-02-28 17:58:02 UTC (rev 150)
@@ -1,6 +1,6 @@
package org.nuiton.mapstoragemanager.plugins.bighashmap;
/**
* package BigHashMap.
- * permet la représentation sous forme de hashMap d'une base de données selon
+ * Permet la représentation sous forme de hashMap d'une base de données selon
* la spécification bigTable.
*/
Modified: trunk/msm-bighashmapV2/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/package-info.java
===================================================================
--- trunk/msm-bighashmapV2/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/package-info.java 2010-02-28 17:51:58 UTC (rev 149)
+++ trunk/msm-bighashmapV2/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/package-info.java 2010-02-28 17:58:02 UTC (rev 150)
@@ -1,6 +1,6 @@
package org.nuiton.mapstoragemanager.plugins.bighashmapv2;
/**
* package BigHashMap.
- * permet la représentation sous forme de hashMap d'une base de données selon
+ * Permet la représentation sous forme de hashMap d'une base de données selon
* la spécification bigTable.
*/
Added: trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/package-info.java
===================================================================
--- trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/package-info.java (rev 0)
+++ trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/package-info.java 2010-02-28 17:58:02 UTC (rev 150)
@@ -0,0 +1,5 @@
+package org.nuiton.mapstoragemanager.plugins.exporter;
+/**
+ * package exporter.
+ * Permet l'export dans un format XML d'une base bigtable.
+ */
Added: trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/importer/package-info.java
===================================================================
--- trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/importer/package-info.java (rev 0)
+++ trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/importer/package-info.java 2010-02-28 17:58:02 UTC (rev 150)
@@ -0,0 +1,6 @@
+package org.nuiton.mapstoragemanager.plugins.importer;
+/**
+ * package importer.
+ * Permet l'import dans une base bigtable du contenu d'une base bigtable stockée
+ * dans un fichier XML.
+ */
Added: trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/package-info.java
===================================================================
--- trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/package-info.java (rev 0)
+++ trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/package-info.java 2010-02-28 17:58:02 UTC (rev 150)
@@ -0,0 +1,5 @@
+package org.nuiton.mapstoragemanager.plugins.hbase;
+/**
+ * package hbase.
+ * Permet de se connecter à une base HBase.
+ */
1
0
r149 - trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui
by dlanglais@users.nuiton.org 28 Feb '10
by dlanglais@users.nuiton.org 28 Feb '10
28 Feb '10
Author: dlanglais
Date: 2010-02-28 18:51:58 +0100 (Sun, 28 Feb 2010)
New Revision: 149
Modified:
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ColumnModel.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMModel.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMNavigationListener.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java
Log:
Nettoyage code :
- suppression import inutilis?\195?\169es ;
- mise en priv?\195?\169 des attributs de classe.
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java 2010-02-28 17:46:09 UTC (rev 148)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java 2010-02-28 17:51:58 UTC (rev 149)
@@ -7,8 +7,6 @@
import java.util.Properties;
import java.util.ResourceBundle;
import java.util.Set;
-import javax.swing.ImageIcon;
-import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
@@ -46,7 +44,7 @@
/**
* OurHashMap2.
*/
- OurHashMap2 ohm;
+ private OurHashMap2 ohm;
/**
* classe instance (singleton pattern).
@@ -246,12 +244,12 @@
* Informations about team.
*/
public void showAbout() {
- String message="Developers :"+"\n";
- message+=" Gilles Crieloue"+"\n";
- message+=" Amaury Fages"+"\n";
- message+=" Florent Gilet"+"\n";
- message+=" Langlais Dorian"+"\n";
- message+="Version 1.0 Codelutin @ 2009-2010";
+ String message = "Developers :" + "\n";
+ message += " Gilles Crieloue" + "\n";
+ message += " Amaury Fages" + "\n";
+ message += " Florent Gilet" + "\n";
+ message += " Langlais Dorian" + "\n";
+ message += "Version 0.1-SNAPSHOT Codelutin @ 2009-2010";
JOptionPane.showMessageDialog(null, message);
}
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ColumnModel.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ColumnModel.java 2010-02-28 17:46:09 UTC (rev 148)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ColumnModel.java 2010-02-28 17:51:58 UTC (rev 149)
@@ -1,8 +1,3 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
package org.nuiton.mapstoragemanager.ui.gui;
import java.util.Iterator;
@@ -22,12 +17,12 @@
/**
* columnNames.
*/
- String[] titres;
+ private String[] titres;
/**
* data.
*/
- String[][] data;
+ private String[][] data;
/**
* Constructor.
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMModel.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMModel.java 2010-02-28 17:46:09 UTC (rev 148)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMModel.java 2010-02-28 17:51:58 UTC (rev 149)
@@ -1,6 +1,7 @@
package org.nuiton.mapstoragemanager.ui.gui;
-import javax.swing.tree.*;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
/**
* Model of the navigation tree.
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMNavigationListener.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMNavigationListener.java 2010-02-28 17:46:09 UTC (rev 148)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMNavigationListener.java 2010-02-28 17:51:58 UTC (rev 149)
@@ -1,21 +1,10 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
package org.nuiton.mapstoragemanager.ui.gui;
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Dimension;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
-import javax.swing.ScrollPaneLayout;
-import javax.swing.SwingUtilities;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
-import javax.swing.table.TableColumn;
import javax.swing.tree.DefaultMutableTreeNode;
import org.nuiton.mapstoragemanager.ui.MainUI;
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java 2010-02-28 17:46:09 UTC (rev 148)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java 2010-02-28 17:51:58 UTC (rev 149)
@@ -1,8 +1,3 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
package org.nuiton.mapstoragemanager.ui.gui;
import java.util.Iterator;
@@ -11,8 +6,6 @@
import javax.swing.tree.DefaultMutableTreeNode;
import org.nuiton.mapstoragemanager.plugins.OurHashMap2;
-import static org.nuiton.i18n.I18n.n_;
-
/**
* Model of a table content
* @author E045231P
@@ -23,12 +16,12 @@
/**
* columnNames.
*/
- String[] titles;
+ private String[] titles;
/**
* data.
*/
- String[][] data;
+ private String[][] data;
/**
* Show the keys in the table or not.
1
0
r148 - trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui
by dlanglais@users.nuiton.org 28 Feb '10
by dlanglais@users.nuiton.org 28 Feb '10
28 Feb '10
Author: dlanglais
Date: 2010-02-28 18:46:09 +0100 (Sun, 28 Feb 2010)
New Revision: 148
Modified:
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ColumnModel.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java
Log:
J'ai l?\195?\169g?\195?\168rement modifi?\195?\169 TableModel pour tout de m?\195?\170me afficher (ou non) les cl?\195?\169s de la table (d?\195?\169sactivable ?\195?\160 l'aide d'un bool?\195?\169en).
Il est dommage d'avoir supprim?\195?\169 les commentaires javadoc, j'ai rajout?\195?\169 les commentaires h?\195?\169rit?\195?\169s.
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ColumnModel.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ColumnModel.java 2010-02-28 17:23:08 UTC (rev 147)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ColumnModel.java 2010-02-28 17:46:09 UTC (rev 148)
@@ -55,26 +55,41 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public Object getValueAt(int rowIndex, int colIndex) {
return data[colIndex][rowIndex];
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public int getColumnCount() {
return titres.length;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public int getRowCount() {
return data[0].length;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public String getColumnName(int col){
return titres[col];
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public boolean isCellEditable(int row, int col) {
return false;
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java 2010-02-28 17:23:08 UTC (rev 147)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java 2010-02-28 17:46:09 UTC (rev 148)
@@ -31,6 +31,11 @@
String[][] data;
/**
+ * Show the keys in the table or not.
+ */
+ private static boolean showTableKeys = true;
+
+ /**
* Constructor.
*/
public TableModel(DefaultMutableTreeNode node) {
@@ -39,49 +44,82 @@
OurHashMap2 hashmap = engine.getOurHashMap();
Set<String> columnsNames = hashmap.getColumnsNames(table);
- titles = new String[columnsNames.size()];
//content
- Set<String> keySetTable = hashmap.getKeys(table);
- Iterator i = columnsNames.iterator();
+ Set<String> keySetTable = hashmap.getKeys(table);
+ Iterator<String> columnName = columnsNames.iterator();
+
+ /**
+ * indexes
+ */
int colIndex=0;
int rowindex=0;
- data = new String[columnsNames.size()][keySetTable.size()];
- while(i.hasNext()){
- String titreTemp = (String)i.next();
+
+ if(showTableKeys) {
+ titles = new String[columnsNames.size() + 1];
+ titles[0] = "Keys";
+ data = new String[columnsNames.size() + 1][keySetTable.size()];
+ colIndex++;
+ } else {
+ titles = new String[columnsNames.size()];
+ data = new String[columnsNames.size()][keySetTable.size()];
+ }
+
+
+ while(columnName.hasNext()){
+ String titreTemp = columnName.next();
titles[colIndex] = titreTemp;
Set<String> columnKeys = hashmap.getKeys(table, titles[colIndex]);
- Iterator<String> i2 = columnKeys.iterator();
- while(i2.hasNext()){
- String str = hashmap.get(table,titreTemp,(String)i2.next());
- data[colIndex][rowindex]=str;
+ Iterator<String> columnKey = columnKeys.iterator();
+ while(columnKey.hasNext()){
+ String key = columnKey.next();
+ String str = hashmap.get(table, titreTemp, key);
+ if(showTableKeys) {
+ data[0][rowindex] = key;
+ }
+ data[colIndex][rowindex] = str;
rowindex++;
}
colIndex++;
}
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public Object getValueAt(int rowIndex, int colIndex) {
return data[colIndex][rowIndex];
}
-
+
+ /**
+ * {@inheritDoc}
+ */
@Override
public int getColumnCount() {
return titles.length;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public int getRowCount() {
return data[0].length;
}
-
+
+ /**
+ * {@inheritDoc}
+ */
@Override
public String getColumnName(int col){
return titles[col];
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public boolean isCellEditable(int row, int col) {
return false;
1
0
r147 - in trunk: msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2 msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins
by dlanglais@users.nuiton.org 28 Feb '10
by dlanglais@users.nuiton.org 28 Feb '10
28 Feb '10
Author: dlanglais
Date: 2010-02-28 18:23:08 +0100 (Sun, 28 Feb 2010)
New Revision: 147
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/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/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/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElement.java
Log:
Utilisation du logger apache.commons.logging au lieu du logger java.util... (mis par d?\195?\169faut pour les exceptions).
variable Log renomm?\195?\169e en LOG
Les logs d'information d'exception "lev?\195?\169e correctement" transform?\195?\169s en log.trace() (et non erreur).
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-02-28 16:50:11 UTC (rev 146)
+++ trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/CellTest.java 2010-02-28 17:23:08 UTC (rev 147)
@@ -19,7 +19,7 @@
/**
* Logger.
*/
- private static final Log log = LogFactory.getLog(CellTest.class);
+ private static final Log LOG = LogFactory.getLog(CellTest.class);
private Cell<Object> cellActual;
private Cell<Object> cell2Actual;
@@ -36,7 +36,7 @@
assertNull(cellActual.get());
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement");
+ LOG.trace("Exception levée correctement");
}
}
@@ -54,7 +54,7 @@
assertNull(cellActual.get());
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement");
+ LOG.trace("Exception levée correctement");
}
cellActual.put(objectExcepted);
@@ -77,7 +77,7 @@
assertNull(cellActual.get());
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement");
+ LOG.trace("Exception levée correctement");
}
cellActual.put(objectExcepted);
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-02-28 16:50:11 UTC (rev 146)
+++ trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/ColumnTest.java 2010-02-28 17:23:08 UTC (rev 147)
@@ -17,7 +17,7 @@
/**
* Logger.
*/
- private static final Log log = LogFactory.getLog(ColumnTest.class);
+ private static final Log LOG = LogFactory.getLog(ColumnTest.class);
private Column columnActual;
private Column column2Actual;
@@ -33,7 +33,7 @@
columnActual.get("test");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement");
+ LOG.trace("Exception levée correctement");
}
}
@@ -49,7 +49,7 @@
columnActual.get("object 1");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement");
+ LOG.trace("Exception levée correctement");
}
columnActual.put("object 1", expected);
@@ -82,7 +82,7 @@
columnActual.get("integer 1");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement.");
+ LOG.trace("Exception levée correctement.");
}
assertEquals(columnActual.get("integer 2"), expected2);
@@ -94,7 +94,7 @@
columnActual.get("integer 2");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement.");
+ LOG.trace("Exception levée correctement.");
}
}
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-02-28 16:50:11 UTC (rev 146)
+++ trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/RowTest.java 2010-02-28 17:23:08 UTC (rev 147)
@@ -11,7 +11,7 @@
/**
* Logger.
*/
- private static final Log log = LogFactory.getLog(RowTest.class);
+ private static final Log LOG = LogFactory.getLog(RowTest.class);
private Structure structureExpected;
private Map<String, Object> contentExpected;
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-02-28 16:50:11 UTC (rev 146)
+++ trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/StructureTest.java 2010-02-28 17:23:08 UTC (rev 147)
@@ -5,8 +5,6 @@
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import junit.framework.TestCase;
import org.apache.commons.logging.LogFactory;
@@ -17,7 +15,7 @@
/**
* Logger.
*/
- private static final Log log = LogFactory.getLog(StructureTest.class);
+ private static final Log LOG = LogFactory.getLog(StructureTest.class);
private Structure structureActual;
private Map<String, Class<?>> structureContentActual;
@@ -64,13 +62,13 @@
assertEquals(structureContentExpected, structureContentActual);
} catch (IllegalArgumentException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (IllegalAccessException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (NoSuchFieldException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (SecurityException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
}
}
@@ -131,13 +129,13 @@
} catch (IllegalArgumentException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (IllegalAccessException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (NoSuchFieldException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (SecurityException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
}
}
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-02-28 16:50:11 UTC (rev 146)
+++ trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/TableTest.java 2010-02-28 17:23:08 UTC (rev 147)
@@ -10,8 +10,6 @@
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import junit.framework.Assert;
import junit.framework.TestCase;
import org.apache.commons.logging.LogFactory;
@@ -26,7 +24,7 @@
/**
* Logger.
*/
- private static final Log log = LogFactory.getLog(TableTest.class);
+ private static final Log LOG = LogFactory.getLog(TableTest.class);
private Table tableActual;
private Structure tableStructureActual;
@@ -59,13 +57,13 @@
assertEquals(tableColumnsActual, tableColumnsExpected);
} catch (IllegalArgumentException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (IllegalAccessException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (NoSuchFieldException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (SecurityException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
}
}
@@ -120,13 +118,13 @@
assertEquals(tableColumnsActual, tableColumnsExpected);
} catch (IllegalArgumentException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (IllegalAccessException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (NoSuchFieldException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (SecurityException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
}
}
@@ -190,13 +188,13 @@
} catch (IllegalArgumentException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (IllegalAccessException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (NoSuchFieldException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (SecurityException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
}
}
@@ -243,13 +241,13 @@
assertEquals(expectedInteger2, tableColumns.get("Integer").get("integer2"));
} catch (NoSuchFieldException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (SecurityException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (IllegalArgumentException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (IllegalAccessException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
}
}
@@ -465,7 +463,7 @@
tableActual.get("String", "string1");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement.");
+ LOG.trace("Exception levée correctement.");
}
assertEquals(expectedString2, tableActual.get("String", "string2"));
assertEquals(expectedInteger1, tableActual.get("Integer", "integer1"));
@@ -476,7 +474,7 @@
tableActual.get("String", "string2");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement.");
+ LOG.trace("Exception levée correctement.");
}
assertEquals(expectedInteger1, tableActual.get("Integer", "integer1"));
assertEquals(expectedInteger2, tableActual.get("Integer", "integer2"));
@@ -486,7 +484,7 @@
tableActual.get("Integer", "integer1");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement.");
+ LOG.trace("Exception levée correctement.");
}
assertEquals(expectedInteger2, tableActual.get("Integer", "integer2"));
@@ -495,7 +493,7 @@
tableActual.get("Integer", "integer2");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement.");
+ LOG.trace("Exception levée correctement.");
}
}
}
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-02-28 16:50:11 UTC (rev 146)
+++ trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/CellTest.java 2010-02-28 17:23:08 UTC (rev 147)
@@ -1,7 +1,5 @@
package org.nuiton.mapstoragemanager.plugins.bighashmapv2;
-import org.nuiton.mapstoragemanager.plugins.bighashmapv2.CellImpl;
-import org.nuiton.mapstoragemanager.plugins.bighashmapv2.Cell;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -21,7 +19,7 @@
/**
* Logger.
*/
- private static final Log log = LogFactory.getLog(CellTest.class);
+ private static final Log LOG = LogFactory.getLog(CellTest.class);
private Cell cellActual;
private Cell cell2Actual;
@@ -38,7 +36,7 @@
assertNull(cellActual.get());
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement");
+ LOG.trace("Exception levée correctement");
}
}
@@ -56,7 +54,7 @@
assertNull(cellActual.get());
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement");
+ LOG.trace("Exception levée correctement");
}
cellActual.put(objectExpected1);
@@ -79,7 +77,7 @@
assertNull(cellActual.get());
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement");
+ LOG.trace("Exception levée correctement");
}
cellActual.put(objectExpected1);
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-02-28 16:50:11 UTC (rev 146)
+++ trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/ColumnTest.java 2010-02-28 17:23:08 UTC (rev 147)
@@ -17,7 +17,7 @@
/**
* Logger.
*/
- private static final Log log = LogFactory.getLog(ColumnTest.class);
+ private static final Log LOG = LogFactory.getLog(ColumnTest.class);
private Column columnActual1;
private Column columnActual2;
@@ -33,7 +33,7 @@
columnActual1.get("test");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement");
+ LOG.trace("Exception levée correctement");
}
}
@@ -49,7 +49,7 @@
columnActual1.get("object 1");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement");
+ LOG.trace("Exception levée correctement");
}
columnActual1.put("object 1", expected1);
@@ -82,7 +82,7 @@
columnActual1.get("integer 1");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement.");
+ LOG.trace("Exception levée correctement.");
}
assertEquals(columnActual1.get("integer 2"), expected2);
@@ -94,7 +94,7 @@
columnActual1.get("integer 2");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement.");
+ LOG.trace("Exception levée correctement.");
}
}
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-02-28 16:50:11 UTC (rev 146)
+++ trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/RowTest.java 2010-02-28 17:23:08 UTC (rev 147)
@@ -1,9 +1,5 @@
package org.nuiton.mapstoragemanager.plugins.bighashmapv2;
-import org.nuiton.mapstoragemanager.plugins.bighashmapv2.StructureImpl;
-import org.nuiton.mapstoragemanager.plugins.bighashmapv2.Row;
-import org.nuiton.mapstoragemanager.plugins.bighashmapv2.RowImpl;
-import org.nuiton.mapstoragemanager.plugins.bighashmapv2.Structure;
import java.util.HashMap;
import java.util.Map;
import junit.framework.TestCase;
@@ -15,7 +11,7 @@
/**
* Logger.
*/
- private static final Log log = LogFactory.getLog(RowTest.class);
+ private static final Log LOG = LogFactory.getLog(RowTest.class);
private Structure structureExpected;
private Map<String, String> contentExpected;
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-02-28 16:50:11 UTC (rev 146)
+++ trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/StructureTest.java 2010-02-28 17:23:08 UTC (rev 147)
@@ -1,12 +1,8 @@
package org.nuiton.mapstoragemanager.plugins.bighashmapv2;
-import org.nuiton.mapstoragemanager.plugins.bighashmapv2.StructureImpl;
-import org.nuiton.mapstoragemanager.plugins.bighashmapv2.Structure;
import java.lang.reflect.Field;
import java.util.HashSet;
import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import junit.framework.TestCase;
import org.apache.commons.logging.LogFactory;
@@ -17,7 +13,7 @@
/**
* Logger.
*/
- private static final Log log = LogFactory.getLog(StructureTest.class);
+ private static final Log LOG = LogFactory.getLog(StructureTest.class);
private Structure structureActual;
private Set<String> structureContentActual;
@@ -64,13 +60,13 @@
assertEquals(structureContentExpected, structureContentActual);
} catch (IllegalArgumentException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (IllegalAccessException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (NoSuchFieldException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (SecurityException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
}
}
@@ -131,13 +127,13 @@
} catch (IllegalArgumentException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (IllegalAccessException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (NoSuchFieldException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (SecurityException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
}
}
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-02-28 16:50:11 UTC (rev 146)
+++ trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/TableTest.java 2010-02-28 17:23:08 UTC (rev 147)
@@ -1,7 +1,3 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
package org.nuiton.mapstoragemanager.plugins.bighashmapv2;
import java.lang.reflect.Field;
@@ -10,8 +6,6 @@
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import junit.framework.Assert;
import junit.framework.TestCase;
import org.apache.commons.logging.LogFactory;
@@ -26,7 +20,7 @@
/**
* Logger.
*/
- private static final Log log = LogFactory.getLog(TableTest.class);
+ private static final Log LOG = LogFactory.getLog(TableTest.class);
private Table tableActual;
private Structure tableStructureActual;
@@ -61,13 +55,13 @@
tableColumnsExpected.toString());
} catch (IllegalArgumentException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (IllegalAccessException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (NoSuchFieldException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (SecurityException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
}
}
@@ -128,13 +122,13 @@
tableColumnsExpected.toString());
} catch (IllegalArgumentException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (IllegalAccessException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (NoSuchFieldException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (SecurityException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
}
}
@@ -204,13 +198,13 @@
} catch (IllegalArgumentException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (IllegalAccessException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (NoSuchFieldException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (SecurityException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
}
}
@@ -257,13 +251,13 @@
assertEquals(expectedInteger2, tableColumns.get("Integer").get("integer2"));
} catch (NoSuchFieldException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (SecurityException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (IllegalArgumentException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (IllegalAccessException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
}
}
@@ -479,7 +473,7 @@
tableActual.get("String", "string1");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement.");
+ LOG.trace("Exception levée correctement.");
}
assertEquals(expectedString2, tableActual.get("String", "string2"));
assertEquals(expectedInteger1, tableActual.get("Integer", "integer1"));
@@ -490,7 +484,7 @@
tableActual.get("String", "string2");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement.");
+ LOG.trace("Exception levée correctement.");
}
assertEquals(expectedInteger1, tableActual.get("Integer", "integer1"));
assertEquals(expectedInteger2, tableActual.get("Integer", "integer2"));
@@ -500,7 +494,7 @@
tableActual.get("Integer", "integer1");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement.");
+ LOG.trace("Exception levée correctement.");
}
assertEquals(expectedInteger2, tableActual.get("Integer", "integer2"));
@@ -509,7 +503,7 @@
tableActual.get("Integer", "integer2");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement.");
+ LOG.trace("Exception levée correctement.");
}
}
}
Modified: trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElement.java
===================================================================
--- trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElement.java 2010-02-28 16:50:11 UTC (rev 146)
+++ trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElement.java 2010-02-28 17:23:08 UTC (rev 147)
@@ -23,7 +23,10 @@
*/
private static final Log LOG = LogFactory.getLog(AssertJdomElement.class);
- private static boolean test = false;
+ /**
+ * trace or not.
+ */
+ private static boolean trace = false;
/**
* Test if to Element are equivalent.
@@ -34,8 +37,8 @@
public static void assertEquivalent(Element expected, Element actual)
throws AssertionFailedError {
- if(test) {
- System.out.println("---------------------------------------------");
+ if(trace) {
+ LOG.trace("------------------------------------------------------");
}
String expectedElementName = expected.getName();
@@ -81,8 +84,8 @@
}
}
- if(test) {
- LOG.info("Attribues"
+ if(trace) {
+ LOG.trace("Attribues"
+ '\n' + expectedAttributes
+ '\n' + actualAttributes
+ '\n' + "Children"
@@ -97,8 +100,8 @@
throw new AssertionFailedError();
// return;
} else if (expectedChildren.isEmpty()) {
- if(test) {
- LOG.info(expectedValue + '\n' + actualValue);
+ if(trace) {
+ LOG.trace(expectedValue + '\n' + actualValue);
}
if (!expected.getValue().equals(actual.getValue())) {
throw new AssertionFailedError();
@@ -121,7 +124,7 @@
TF = true;
}
catch (AssertionFailedError e) {
- LOG.error(e);
+ LOG.trace(e);
}
/*if (testEquals(expectedChild,actualChild)) {
// actualChildren.remove(actualChild);
@@ -141,8 +144,8 @@
}
}
if (TF == false) {
- if(test) {
- LOG.info("RETURN FALSE");
+ if(trace) {
+ LOG.trace("RETURN FALSE");
}
throw new AssertionFailedError();
}
@@ -157,14 +160,14 @@
assertEquivalent(expected, actual);
}
catch (AssertionFailedError e) {
- if(test) {
- LOG.info(expected.toString()
+ if(trace) {
+ LOG.trace(expected.toString()
+ ' ' + actual.toString() + " : not equals");
}
return;
}
- if(test) {
- LOG.info(expected.toString()
+ if(trace) {
+ LOG.trace(expected.toString()
+ ' ' + actual.toString() + " : equals");
}
throw new AssertionFailedError();
1
0
r146 - trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui
by fgilet@users.nuiton.org 28 Feb '10
by fgilet@users.nuiton.org 28 Feb '10
28 Feb '10
Author: fgilet
Date: 2010-02-28 17:50:11 +0100 (Sun, 28 Feb 2010)
New Revision: 146
Added:
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ColumnModel.java
Modified:
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMNavigationListener.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java
Log:
Affichage d'une colonne suppl?\195?\169mentaire si besoin rajout?\195?\169e
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java 2010-02-28 15:19:21 UTC (rev 145)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java 2010-02-28 16:50:11 UTC (rev 146)
@@ -161,11 +161,26 @@
DefaultTreeModel dtm = ((DefaultTreeModel) ui.getNavigation().getModel());
Set<String> tableNames = ohm.getTablesNames();
+
Iterator i = tableNames.iterator();
while(i.hasNext()){
+
+ //display the node table
String tableName = (String)i.next();
- dtm.insertNodeInto(new DefaultMutableTreeNode(tableName), root, root.getChildCount());
+ DefaultMutableTreeNode tableNameToInsert = new DefaultMutableTreeNode(tableName);
+ dtm.insertNodeInto(tableNameToInsert, root, root.getChildCount());
+
+ //display the node column
+ Set<String> columnNames = ohm.getColumnsNames(tableName);
+ Iterator i2 = columnNames.iterator();
+ while(i2.hasNext()){
+ String columnName = (String)i2.next();
+ DefaultMutableTreeNode columnNameToInsert = new DefaultMutableTreeNode(columnName);
+ dtm.insertNodeInto(columnNameToInsert, tableNameToInsert, tableNameToInsert.getChildCount());
+ }
+
+
}
ui.getNavigation().repaint();
Added: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ColumnModel.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ColumnModel.java (rev 0)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ColumnModel.java 2010-02-28 16:50:11 UTC (rev 146)
@@ -0,0 +1,84 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.nuiton.mapstoragemanager.ui.gui;
+
+import java.util.Iterator;
+import java.util.Set;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.TreeNode;
+import org.nuiton.mapstoragemanager.plugins.OurHashMap2;
+
+/**
+ * Model of a table content
+ * @author E045231P
+ */
+public class ColumnModel extends AbstractTableModel {
+
+
+ /**
+ * columnNames.
+ */
+ String[] titres;
+
+ /**
+ * data.
+ */
+ String[][] data;
+
+ /**
+ * Constructor.
+ */
+ public ColumnModel(TreeNode parent, DefaultMutableTreeNode node) {
+ String table = parent.toString();
+ String column = node.toString();
+ ApplicationEngine engine = ApplicationEngine.getInstance();
+ OurHashMap2 testHashmap2 = engine.getOurHashMap();
+ titres = new String[2];
+ titres[0]="Key";
+ titres[1]="Value";
+
+ //content
+ Set<String> keySetTable = testHashmap2.getKeys(table,column);
+ Iterator i = keySetTable.iterator();
+ data = new String[2][keySetTable.size()];
+ int j=0;
+ while(i.hasNext()){
+ String key = (String)i.next();
+ String value = testHashmap2.get(table, column, key);
+ data[0][j]=key;
+ data[1][j]=value;
+ j++;
+ }
+ }
+
+ @Override
+ public Object getValueAt(int rowIndex, int colIndex) {
+ return data[colIndex][rowIndex];
+ }
+
+ @Override
+ public int getColumnCount() {
+ return titres.length;
+ }
+
+ @Override
+ public int getRowCount() {
+ return data[0].length;
+ }
+
+ @Override
+ public String getColumnName(int col){
+ return titres[col];
+ }
+
+ @Override
+ public boolean isCellEditable(int row, int col) {
+ return false;
+ }
+
+
+}
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMNavigationListener.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMNavigationListener.java 2010-02-28 15:19:21 UTC (rev 145)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMNavigationListener.java 2010-02-28 16:50:11 UTC (rev 146)
@@ -36,6 +36,20 @@
/* if nothing is selected */
if (node == null || node.isRoot()) {
return;
+ } else if (node.isLeaf()){
+ //we create a standard model of column
+ ColumnModel model = new ColumnModel(node.getParent(),node);
+ JTable jTable = new JTable(model);
+
+ JScrollPane scrollPane = new JScrollPane(jTable);
+ jTable.setFillsViewportHeight(true);
+
+ //we check attributes and values of the select table
+
+
+ //and display the result into the JPanel named 'tableContent'
+ ui.getTableContent().add(scrollPane);
+
} else {
//we create a standard model of table
TableModel model = new TableModel(node);
@@ -54,6 +68,8 @@
ui.getTableName().add(new JLabel("<html><b><u>"+node.toString()+"</b></u></html>"));
ui.getTableContent().repaint();
ui.getTableContent().revalidate();
+ ui.getTableName().repaint();
+ ui.getTableName().revalidate();
}
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java 2010-02-28 15:19:21 UTC (rev 145)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java 2010-02-28 16:50:11 UTC (rev 146)
@@ -39,99 +39,49 @@
OurHashMap2 hashmap = engine.getOurHashMap();
Set<String> columnsNames = hashmap.getColumnsNames(table);
- titles = new String[columnsNames.size()+1];
+ titles = new String[columnsNames.size()];
//content
- Set<String> tableKeys = hashmap.getKeys(table);
- Iterator<String> i = columnsNames.iterator();
- int colIndex = 0;
- int rowIndex = 0;
- System.out.println("set.size() : " + columnsNames.size()
- + " | keySet.size() : " + tableKeys.size());
- data = new String[columnsNames.size()+1][tableKeys.size()];
-
- // a column which shows keys.
- titles[colIndex++] = n_("keys");
-
+ Set<String> keySetTable = hashmap.getKeys(table);
+ Iterator i = columnsNames.iterator();
+ int colIndex=0;
+ int rowindex=0;
+ data = new String[columnsNames.size()][keySetTable.size()];
while(i.hasNext()){
- String titreTemp = i.next();
+ String titreTemp = (String)i.next();
titles[colIndex] = titreTemp;
- Set<String> columnKeys =
- hashmap.getKeys(table, titles[colIndex]);
+ Set<String> columnKeys = hashmap.getKeys(table, titles[colIndex]);
Iterator<String> i2 = columnKeys.iterator();
while(i2.hasNext()){
- String key = i2.next();
- System.out.println("table = " + table);
- System.out.println("titreTemp = " + titreTemp);
- String str = hashmap.get(table, titreTemp, key);
- //data[j][k]=str;
- // the key
- this.setValueAt(rowIndex, 0, key);
- this.setValueAt(rowIndex, colIndex, str);
- System.out.println("data[" + colIndex + "][" + rowIndex + "] = "
- + data[colIndex][rowIndex]);
- rowIndex++;
+ String str = hashmap.get(table,titreTemp,(String)i2.next());
+ data[colIndex][rowindex]=str;
+ rowindex++;
}
colIndex++;
}
}
- /**
- * put data into the table.
- * @param rowIndex the rox index
- * @param colIndex the column index
- * @param value to put in the table.
- */
- public void setValueAt(int rowIndex, int colIndex, String value) {
- data[colIndex][rowIndex] = value;
- }
-
- /**
- * get data from the table.
- * @param rowIndex the rox index
- * @param colIndex the column index
- */
@Override
public Object getValueAt(int rowIndex, int colIndex) {
return data[colIndex][rowIndex];
}
- /**
- * count the number of column.
- * @return the column count
- */
@Override
public int getColumnCount() {
return titles.length;
}
- /**
- * count the number of line.
- * @return the line count
- */
@Override
public int getRowCount() {
return data[0].length;
}
- /**
- * count the number of column.
- * @param col the column number
- * @return the name of the column col
- */
@Override
public String getColumnName(int col){
return titles[col];
}
-
- /**
- * Check if the cell is editable.
- * @param row the line number
- * @param col the column number
- * @return false
- */
@Override
public boolean isCellEditable(int row, int col) {
return false;
1
0
r145 - trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins
by dlanglais@users.nuiton.org 28 Feb '10
by dlanglais@users.nuiton.org 28 Feb '10
28 Feb '10
Author: dlanglais
Date: 2010-02-28 16:19:21 +0100 (Sun, 28 Feb 2010)
New Revision: 145
Modified:
trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElement.java
trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElementTest.java
Log:
Prise en compte des attributs dans la comparaison de deux elements.
Modified: trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElement.java
===================================================================
--- trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElement.java 2010-02-28 13:30:46 UTC (rev 144)
+++ trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElement.java 2010-02-28 15:19:21 UTC (rev 145)
@@ -23,7 +23,7 @@
*/
private static final Log LOG = LogFactory.getLog(AssertJdomElement.class);
- private static boolean test = true;
+ private static boolean test = false;
/**
* Test if to Element are equivalent.
@@ -34,14 +34,9 @@
public static void assertEquivalent(Element expected, Element actual)
throws AssertionFailedError {
-// String expectedContent = expected.getContent();
-// String actualContent = actual.getContent();
-
if(test) {
System.out.println("---------------------------------------------");
}
-// System.out.println(expected.getContent());
-// System.out.println(actual.getContent());
String expectedElementName = expected.getName();
String actualElementName = actual.getName();
@@ -74,21 +69,28 @@
}
} else {
// case with only many attribute.
- // TODO -> we have only one attribute for instance.
+ for(Attribute expectedAttribute : expectedAttributes) {
+ String attributeName = expectedAttribute.getName();
+ String expectedAttributeValue =
+ expected.getAttributeValue(attributeName);
+ String actualAttributeValue =
+ actual.getAttributeValue(attributeName);
+ if (!expectedAttributeValue.equals(actualAttributeValue)) {
+ throw new AssertionFailedError();
+ }
+ }
}
if(test) {
LOG.info("Attribues"
+ '\n' + expectedAttributes
- + '\n' + actualAttributes);
-
-// System.out.println("Children");
-// System.out.println(expectedChildren);
-// System.out.println(actualChildren);
-
-// System.out.println("Value");
-// System.out.println(expectedValue);
-// System.out.println(actualValue);
+ + '\n' + actualAttributes
+ + '\n' + "Children"
+ + '\n' + expectedChildren
+ + '\n' + actualChildren
+ + '\n' + "Value"
+ + '\n' + expectedValue
+ + '\n' + actualValue);
}
if (expectedChildren.size() != actualChildren.size()) {
Modified: trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElementTest.java
===================================================================
--- trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElementTest.java 2010-02-28 13:30:46 UTC (rev 144)
+++ trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElementTest.java 2010-02-28 15:19:21 UTC (rev 145)
@@ -37,6 +37,100 @@
* test if two simple elements with attributes are equivalents or not.
*/
public void testSimpleElementWithAttributes() {
+ Element a;
+ Element b;
+ Element c;
+ Element d;
+
+// assertEquivalent(a, b);
+// assertEquivalent(c, d);
+// assertNotEquivalent(a, c);
+// assertNotEquivalent(b, c);
+// assertNotEquivalent(a, d);
+// assertNotEquivalent(b, d);
+
+ /**
+ * We put attribute and verify they are not same.
+ */
+ {
+ a = new Element("test");
+ b = new Element("test");
+ c = new Element("test2");
+ d = new Element("test2");
+
+ a.setAttribute(new Attribute("attrib1", "attrib1"));
+ assertNotEquivalent(a, b);
+
+ b.setAttribute(new Attribute("attrib1", "attrib1"));
+ assertEquivalent(a, b);
+
+ c.setAttribute(new Attribute("attrib1", "attrib1"));
+ assertNotEquivalent(c, d);
+
+ d.setAttribute(new Attribute("attrib1", "attrib1"));
+ assertEquivalent(c, d);
+ }
+
+ /**
+ * we put same attributes in different order.
+ */
+ {
+ a = new Element("test");
+ b = new Element("test");
+ c = new Element("test2");
+ d = new Element("test2");
+
+ a.setAttribute(new Attribute("attrib2", "attrib2"));
+ assertNotEquivalent(a, b);
+ a.setAttribute(new Attribute("attrib3", "attrib3"));
+ assertNotEquivalent(a, b);
+
+ b.setAttribute(new Attribute("attrib3", "attrib3"));
+ assertNotEquivalent(a, b);
+ b.setAttribute(new Attribute("attrib2", "attrib2"));
+ assertEquivalent(a, b);
+
+ c.setAttribute(new Attribute("attrib2", "attrib2"));
+ assertNotEquivalent(c, d);
+ c.setAttribute(new Attribute("attrib3", "attrib3"));
+ assertNotEquivalent(c, d);
+
+ d.setAttribute(new Attribute("attrib3", "attrib3"));
+ assertNotEquivalent(c, d);
+ d.setAttribute(new Attribute("attrib2", "attrib2"));
+ assertEquivalent(c, d);
+ }
+
+ /**
+ * we put different attributes.
+ */
+ {
+ a = new Element("test");
+ b = new Element("test");
+
+ a.setAttribute(new Attribute("attrib4", "attrib4"));
+ a.setAttribute(new Attribute("attrib5", "attrib5"));
+ assertNotEquivalent(a, b);
+
+ b.setAttribute(new Attribute("attrib6", "attrib6"));
+ b.setAttribute(new Attribute("attrib7", "attrib7"));
+ assertNotEquivalent(a, b);
+
+
+ a.setAttribute(new Attribute("attrib7", "attrib7"));
+ a.setAttribute(new Attribute("attrib6", "attrib6"));
+ assertNotEquivalent(a, b);
+
+ b.setAttribute(new Attribute("attrib5", "attrib5"));
+ b.setAttribute(new Attribute("attrib4", "attrib4"));
+ assertEquivalent(a, b);
+ }
+ }
+
+ /**
+ * test if two simple elements with values are equivalent or not.
+ */
+ public void testSimpleElementWithValue() {
Element a = new Element("test");
Element b = new Element("test");
Element c = new Element("test2");
@@ -49,43 +143,84 @@
assertNotEquivalent(a, d);
assertNotEquivalent(b, d);
- /**
- * We put attribute and verify they are not same.
- */
-
- a.setAttribute(new Attribute("attrib1", "attrib1"));
+ a.setText("test");
assertNotEquivalent(a, b);
-
- b.setAttribute(new Attribute("attrib1", "attrib1"));
+ b.setText("test");
assertEquivalent(a, b);
-
- c.setAttribute(new Attribute("attrib2", "attrib2"));
+ c.setText("test");
assertNotEquivalent(c, d);
-
- d.setAttribute(new Attribute("attrib2", "attrib2"));
+ d.setText("test");
assertEquivalent(c, d);
/**
- * we put same attributes in different order.
+ * We test that with same value, they are not equivalents.
*/
- a.setAttribute(new Attribute("attrib2", "attrib2"));
- assertNotEquivalent(a, b);
- a.setAttribute(new Attribute("attrib3", "attrib3"));
- assertNotEquivalent(a, b);
+ assertNotEquivalent(a, c);
+ assertNotEquivalent(b, c);
+ assertNotEquivalent(a, d);
+ assertNotEquivalent(b, d);
+ }
- b.setAttribute(new Attribute("attrib3", "attrib3"));
- assertNotEquivalent(a, b);
- b.setAttribute(new Attribute("attrib2", "attrib2"));
- assertEquivalent(a, b);
+ /**
+ * test if two simple elements with values are equivalent or not.
+ */
+ public void testSimpleElementWithSimpleChildren() {
+ final Element childA = new Element("childTest1");
+ final Element childB = new Element("childTest2");
+ assertNotEquivalent(childA,childB);
- c.setAttribute(new Attribute("attrib4", "attrib4"));
- assertNotEquivalent(c, d);
- c.setAttribute(new Attribute("attrib5", "attrib5"));
- assertNotEquivalent(c, d);
+ {
+ /**
+ * test with children in same order.
+ */
+ Element a = new Element("test");
+ Element b = new Element("test");
+ assertEquivalent(a, b);
- d.setAttribute(new Attribute("attrib5", "attrib5"));
- assertNotEquivalent(c, d);
- d.setAttribute(new Attribute("attrib4", "attrib4"));
- assertEquivalent(c, d);
+ a.addContent((Element) childA.clone());
+ assertNotEquivalent(a, b);
+ b.addContent((Element) childA.clone());
+ assertEquivalent(a, b);
+
+ a.addContent((Element) childB.clone());
+ assertNotEquivalent(a, b);
+ b.addContent((Element) childB.clone());
+ assertEquivalent(a, b);
+ }
+ {
+ /**
+ * test with children in different order.
+ */
+ Element a = new Element("test");
+ Element b = new Element("test");
+ assertEquivalent(a, b);
+
+ a.addContent((Element) childA.clone());
+ assertNotEquivalent(a, b);
+ b.addContent((Element) childB.clone());
+ assertNotEquivalent(a, b);
+ a.addContent((Element) childB.clone());
+ assertNotEquivalent(a, b);
+ b.addContent((Element) childA.clone());
+ assertEquivalent(a, b);
+ }
+ {
+ /**
+ * test with one chidren in one Element
+ * and with two same children in the second element.
+ */
+ Element a = new Element("test");
+ Element b = new Element("test");
+ assertEquivalent(a, b);
+
+ a.addContent((Element) childA.clone());
+ a.addContent((Element) childA.clone());
+ assertNotEquivalent(a, b);
+
+ b.addContent((Element) childA.clone());
+ assertNotEquivalent(a, b);
+ b.addContent((Element) childA.clone());
+ assertEquivalent(a, b);
+ }
}
}
1
0
r144 - in trunk/msm-fromtoXML/src: main test/java/org/nuiton/mapstoragemanager/plugins test/java/org/nuiton/mapstoragemanager/plugins/exporter
by dlanglais@users.nuiton.org 28 Feb '10
by dlanglais@users.nuiton.org 28 Feb '10
28 Feb '10
Author: dlanglais
Date: 2010-02-28 14:30:46 +0100 (Sun, 28 Feb 2010)
New Revision: 144
Added:
trunk/msm-fromtoXML/src/main/resources/
trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElement.java
trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElementTest.java
Modified:
trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLTest.java
Log:
Transformation de la m?\195?\169thode de test d'?\195?\169quivalent d'Element jdom en assertEquivalent.
D?\195?\169but de test de cette m?\195?\169thode assertEquivalent.
Added: trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElement.java
===================================================================
--- trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElement.java (rev 0)
+++ trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElement.java 2010-02-28 13:30:46 UTC (rev 144)
@@ -0,0 +1,170 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.nuiton.mapstoragemanager.plugins;
+
+import java.util.List;
+import junit.framework.AssertionFailedError;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdom.Attribute;
+import org.jdom.Element;
+
+/**
+ *
+ * @author Dorian Langlais
+ */
+public class AssertJdomElement {
+
+ /**
+ * Logger.
+ */
+ private static final Log LOG = LogFactory.getLog(AssertJdomElement.class);
+
+ private static boolean test = true;
+
+ /**
+ * Test if to Element are equivalent.
+ * @param expected expected element.
+ * @param actual actual element.
+ * @return true if expected and actual are equivalents.
+ */
+ public static void assertEquivalent(Element expected, Element actual)
+ throws AssertionFailedError {
+
+// String expectedContent = expected.getContent();
+// String actualContent = actual.getContent();
+
+ if(test) {
+ System.out.println("---------------------------------------------");
+ }
+// System.out.println(expected.getContent());
+// System.out.println(actual.getContent());
+
+ String expectedElementName = expected.getName();
+ String actualElementName = actual.getName();
+
+ if(!expectedElementName.equals(actualElementName)) {
+ throw new AssertionFailedError();
+ }
+
+ List<Attribute> expectedAttributes = expected.getAttributes();
+ List<Attribute> actualAttributes = actual.getAttributes();
+
+ List<Element> expectedChildren = expected.getChildren();
+ List<Element> actualChildren = actual.getChildren();
+
+ String expectedValue = expected.getValue();
+ String actualValue = actual.getValue();
+
+
+ // we compare attributes.
+ if (expectedAttributes.size() != actualAttributes.size()) {
+ throw new AssertionFailedError();
+// return;
+ } else if (expectedAttributes.size() == 1) {
+ // case with only one attribute.
+ String expectedAttribute = expectedAttributes.toString();
+ String actualAttribute = actualAttributes.toString();
+ if (! expectedAttribute.equals(actualAttribute)) {
+ throw new AssertionFailedError();
+// return;
+ }
+ } else {
+ // case with only many attribute.
+ // TODO -> we have only one attribute for instance.
+ }
+
+ if(test) {
+ LOG.info("Attribues"
+ + '\n' + expectedAttributes
+ + '\n' + actualAttributes);
+
+// System.out.println("Children");
+// System.out.println(expectedChildren);
+// System.out.println(actualChildren);
+
+// System.out.println("Value");
+// System.out.println(expectedValue);
+// System.out.println(actualValue);
+ }
+
+ if (expectedChildren.size() != actualChildren.size()) {
+ throw new AssertionFailedError();
+// return;
+ } else if (expectedChildren.isEmpty()) {
+ if(test) {
+ LOG.info(expectedValue + '\n' + actualValue);
+ }
+ if (!expected.getValue().equals(actual.getValue())) {
+ throw new AssertionFailedError();
+
+ }
+ return;
+ }
+// System.out.println(expectedChildren);
+// System.out.println(actualChildren);
+
+ boolean TF;
+ // same elements.
+ for (Element expectedChild : expectedChildren) {
+ TF = false;
+ for (Element actualChild : actualChildren) {
+ if(actualChild.getChildren().size() ==
+ expectedChild.getChildren().size()) {
+ try {
+ assertEquivalent(expectedChild, actualChild);
+ TF = true;
+ }
+ catch (AssertionFailedError e) {
+ LOG.error(e);
+ }
+ /*if (testEquals(expectedChild,actualChild)) {
+// actualChildren.remove(actualChild);
+ TF = true;
+ if(trace) {
+ System.out.println("EQUIVALENT");
+ System.out.println(expectedChild.getValue());
+ System.out.println(actualChild.getValue());
+ }
+ } else {
+ if(trace) {
+ System.out.println("NOT EQUIVALENT");
+ System.out.println(expectedChild.getValue());
+ System.out.println(actualChild.getValue());
+ }
+ }*/
+ }
+ }
+ if (TF == false) {
+ if(test) {
+ LOG.info("RETURN FALSE");
+ }
+ throw new AssertionFailedError();
+ }
+ }
+
+ return;
+ }
+
+ public static void assertNotEquivalent(Element expected, Element actual)
+ throws AssertionFailedError {
+ try{
+ assertEquivalent(expected, actual);
+ }
+ catch (AssertionFailedError e) {
+ if(test) {
+ LOG.info(expected.toString()
+ + ' ' + actual.toString() + " : not equals");
+ }
+ return;
+ }
+ if(test) {
+ LOG.info(expected.toString()
+ + ' ' + actual.toString() + " : equals");
+ }
+ throw new AssertionFailedError();
+ }
+}
Added: trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElementTest.java
===================================================================
--- trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElementTest.java (rev 0)
+++ trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElementTest.java 2010-02-28 13:30:46 UTC (rev 144)
@@ -0,0 +1,91 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.nuiton.mapstoragemanager.plugins;
+
+import junit.framework.TestCase;
+import org.jdom.Attribute;
+import org.jdom.Element;
+import static
+ org.nuiton.mapstoragemanager.plugins.AssertJdomElement.assertEquivalent;
+import static
+ org.nuiton.mapstoragemanager.plugins.AssertJdomElement.assertNotEquivalent;
+
+/**
+ *
+ * @author Dorian Langlais
+ */
+public class AssertJdomElementTest extends TestCase {
+
+ /**
+ * test if two simple elements with same name are equivalents.
+ * test if two simple elements with different name are equivalents.
+ */
+ public void testSimpleElement() {
+ Element a = new Element("test");
+ Element b = new Element("test");
+ Element c = new Element("test2");
+
+ assertEquivalent(a, b);
+ assertNotEquivalent(a, c);
+ assertNotEquivalent(b, c);
+ }
+
+ /**
+ * test if two simple elements with attributes are equivalents or not.
+ */
+ public void testSimpleElementWithAttributes() {
+ Element a = new Element("test");
+ Element b = new Element("test");
+ Element c = new Element("test2");
+ Element d = new Element("test2");
+
+ assertEquivalent(a, b);
+ assertEquivalent(c, d);
+ assertNotEquivalent(a, c);
+ assertNotEquivalent(b, c);
+ assertNotEquivalent(a, d);
+ assertNotEquivalent(b, d);
+
+ /**
+ * We put attribute and verify they are not same.
+ */
+
+ a.setAttribute(new Attribute("attrib1", "attrib1"));
+ assertNotEquivalent(a, b);
+
+ b.setAttribute(new Attribute("attrib1", "attrib1"));
+ assertEquivalent(a, b);
+
+ c.setAttribute(new Attribute("attrib2", "attrib2"));
+ assertNotEquivalent(c, d);
+
+ d.setAttribute(new Attribute("attrib2", "attrib2"));
+ assertEquivalent(c, d);
+
+ /**
+ * we put same attributes in different order.
+ */
+ a.setAttribute(new Attribute("attrib2", "attrib2"));
+ assertNotEquivalent(a, b);
+ a.setAttribute(new Attribute("attrib3", "attrib3"));
+ assertNotEquivalent(a, b);
+
+ b.setAttribute(new Attribute("attrib3", "attrib3"));
+ assertNotEquivalent(a, b);
+ b.setAttribute(new Attribute("attrib2", "attrib2"));
+ assertEquivalent(a, b);
+
+ c.setAttribute(new Attribute("attrib4", "attrib4"));
+ assertNotEquivalent(c, d);
+ c.setAttribute(new Attribute("attrib5", "attrib5"));
+ assertNotEquivalent(c, d);
+
+ d.setAttribute(new Attribute("attrib5", "attrib5"));
+ assertNotEquivalent(c, d);
+ d.setAttribute(new Attribute("attrib4", "attrib4"));
+ assertEquivalent(c, d);
+ }
+}
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-02-28 11:06:53 UTC (rev 143)
+++ trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLTest.java 2010-02-28 13:30:46 UTC (rev 144)
@@ -5,7 +5,7 @@
package org.nuiton.mapstoragemanager.plugins.exporter;
-import java.io.IOException;
+//import java.io.IOException;
import java.lang.reflect.Field;
import java.util.List;
import junit.framework.TestCase;
@@ -14,10 +14,11 @@
import org.jdom.Attribute;
import org.jdom.Document;
import org.jdom.Element;
-import org.jdom.output.Format;
-import org.jdom.output.XMLOutputter;
+//import org.jdom.output.Format;
+//import org.jdom.output.XMLOutputter;
import org.nuiton.mapstoragemanager.plugins.Exporter;
import org.nuiton.mapstoragemanager.plugins.NewBigTable;
+import org.nuiton.mapstoragemanager.plugins.AssertJdomElement;
import org.nuiton.mapstoragemanager.plugins.bighashmapv2.BigHashMap;
/**
@@ -46,7 +47,8 @@
Element actualRoot = actual.getRootElement();
Element expectedRoot = expected.getRootElement();
- assertTrue(testEquals(expectedRoot, actualRoot));
+// assertTrue(testEquals(expectedRoot, actualRoot));
+ AssertJdomElement.assertEquivalent(expectedRoot, actualRoot);
}
/**
@@ -248,7 +250,7 @@
* @param actual actual element.
* @return true if expected and actual are equivalents.
*/
- public static boolean testEquals(Element expected, Element actual) {
+ /*public static boolean testEquals(Element expected, Element actual) {
boolean trace = true;
// String expectedContent = expected.getContent();
@@ -260,6 +262,13 @@
// System.out.println(expected.getContent());
// System.out.println(actual.getContent());
+ String expectedElementName = expected.getName();
+ String actualElementName = actual.getName();
+
+ if(!expectedElementName.equals(actualElementName)) {
+ return false;
+ }
+
List<Attribute> expectedAttributes = expected.getAttributes();
List<Attribute> actualAttributes = actual.getAttributes();
@@ -344,7 +353,7 @@
}
return true;
- }
+ }*/
public static void main(String[] args) {
NewBigTable nbt = new BigHashMap();
1
0
r143 - trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter
by dlanglais@users.nuiton.org 28 Feb '10
by dlanglais@users.nuiton.org 28 Feb '10
28 Feb '10
Author: dlanglais
Date: 2010-02-28 12:06:53 +0100 (Sun, 28 Feb 2010)
New Revision: 143
Modified:
trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLTest.java
Log:
Avancement fonction de comparaison d'?\195?\169lement jdom.
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-02-28 11:00:34 UTC (rev 142)
+++ trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLTest.java 2010-02-28 11:06:53 UTC (rev 143)
@@ -31,14 +31,32 @@
*/
private static final Log LOG = LogFactory.getLog(ToXMLTest.class);
+
+
+ private static Document actual;
+ private static Document expected;
+
/**
* Test to export a bigTable database in a xml format.
*/
public void testToXML() {
+ // init actual et expected.
+ createXMLDocument();
- Document actual = null;
- Document expected = new Document();
+ Element actualRoot = actual.getRootElement();
+ Element expectedRoot = expected.getRootElement();
+ assertTrue(testEquals(expectedRoot, actualRoot));
+ }
+
+ /**
+ * Create a bigTable database and a XMLDocument representing the database.
+ */
+ public void createXMLDocument() {
+
+ actual = null;
+ expected = new Document();
+
/********************************
* Creation of the database. *
********************************/
@@ -142,51 +160,51 @@
value5.setText("content5");
cell5.addContent(value5);
-// nbt.put("table2", "column3", "6", "content6");
-// Element cell6 = new Element("cell");
-// Attribute cell6key = new Attribute("key", "6");
-// cell6.setAttribute(cell6key);
-// column3.addContent(cell6);
-// Element value6 = new Element("value");
-// value6.setText("content6");
-// cell6.addContent(value6);
-//
-// nbt.put("table2", "column4", "7", "content7");
-// Element cell7 = new Element("cell");
-// Attribute cell7key = new Attribute("key", "7");
-// cell7.setAttribute(cell7key);
-// column4.addContent(cell7);
-// Element value7 = new Element("value");
-// value7.setText("content7");
-// cell7.addContent(value7);
-//
-// nbt.put("table2", "column4", "8", "content8");
-// Element cell8 = new Element("cell");
-// Attribute cell8key = new Attribute("key", "8");
-// cell8.setAttribute(cell8key);
-// column4.addContent(cell8);
-// Element value8 = new Element("value");
-// value8.setText("content8");
-// cell8.addContent(value8);
-//
-// nbt.put("table2", "column5", "9", "content9");
-// Element cell9 = new Element("cell");
-// Attribute cell9key = new Attribute("key", "9");
-// cell9.setAttribute(cell9key);
-// column5.addContent(cell9);
-// Element value9 = new Element("value");
-// value9.setText("content9");
-// cell9.addContent(value9);
-//
-// nbt.put("table2", "column5", "10", "content10");
-// Element cell10 = new Element("cell");
-// Attribute cell10key = new Attribute("key", "10");
-// cell10.setAttribute(cell10key);
-// column5.addContent(cell10);
-// Element value10 = new Element("value");
-// value10.setText("content10");
-// cell10.addContent(value10);
+ nbt.put("table2", "column3", "6", "content6");
+ Element cell6 = new Element("cell");
+ Attribute cell6key = new Attribute("key", "6");
+ cell6.setAttribute(cell6key);
+ column3.addContent(cell6);
+ Element value6 = new Element("value");
+ value6.setText("content6");
+ cell6.addContent(value6);
+ nbt.put("table2", "column4", "7", "content7");
+ Element cell7 = new Element("cell");
+ Attribute cell7key = new Attribute("key", "7");
+ cell7.setAttribute(cell7key);
+ column4.addContent(cell7);
+ Element value7 = new Element("value");
+ value7.setText("content7");
+ cell7.addContent(value7);
+
+ nbt.put("table2", "column4", "8", "content8");
+ Element cell8 = new Element("cell");
+ Attribute cell8key = new Attribute("key", "8");
+ cell8.setAttribute(cell8key);
+ column4.addContent(cell8);
+ Element value8 = new Element("value");
+ value8.setText("content8");
+ cell8.addContent(value8);
+
+ nbt.put("table2", "column5", "9", "content9");
+ Element cell9 = new Element("cell");
+ Attribute cell9key = new Attribute("key", "9");
+ cell9.setAttribute(cell9key);
+ column5.addContent(cell9);
+ Element value9 = new Element("value");
+ value9.setText("content9");
+ cell9.addContent(value9);
+
+ nbt.put("table2", "column5", "10", "content10");
+ Element cell10 = new Element("cell");
+ Attribute cell10key = new Attribute("key", "10");
+ cell10.setAttribute(cell10key);
+ column5.addContent(cell10);
+ Element value10 = new Element("value");
+ value10.setText("content10");
+ cell10.addContent(value10);
+
Exporter exporter = new ToXML();
exporter.exportTo(nbt, null);
@@ -208,13 +226,13 @@
LOG.error(ex, ex);
}
- try {
- XMLOutputter output = new XMLOutputter(Format.getPrettyFormat());
- output.output(expected, System.out);
- output.output(actual, System.out);
- } catch (IOException ex) {
- LOG.error(ex, ex);
- }
+// try {
+// XMLOutputter output = new XMLOutputter(Format.getPrettyFormat());
+// output.output(expected, System.out);
+// output.output(actual, System.out);
+// } catch (IOException ex) {
+// LOG.error(ex, ex);
+// }
// assertEquals(expected,actual);
// testEquals(expected.getRootElement(),actual.getRootElement());
@@ -224,40 +242,71 @@
// assertEquals(expected, actual);
}
+ /**
+ * Test if to Element are equal.
+ * @param expected expected element.
+ * @param actual actual element.
+ * @return true if expected and actual are equivalents.
+ */
public static boolean testEquals(Element expected, Element actual) {
- System.out.println(expected.getContent());
- System.out.println(actual.getContent());
+ boolean trace = true;
+// String expectedContent = expected.getContent();
+// String actualContent = actual.getContent();
- // same attribute list.
-// if (!expected.getAttributes().equals(actual.getAttributes())) {
-// return false;
-// }
+ if(trace) {
+ System.out.println("---------------------------------------------");
+ }
+// System.out.println(expected.getContent());
+// System.out.println(actual.getContent());
-// if (!expected.getAttributes().equals(actual.getAttributes())) {
-// return false;
-// }
+ List<Attribute> expectedAttributes = expected.getAttributes();
+ List<Attribute> actualAttributes = actual.getAttributes();
-// System.out.println(expected.getAttributes());
-// System.out.println(actual.getAttributes());
- // same attributes values.
-// for (Attribute attribute : (List<Attribute>) expected.getAttributes()) {
-// String attrName = attribute.getName();
-// String expectedAttrValue = expected.getAttributeValue(attrName);
-// String actualAttrValue = actual.getAttributeValue(attrName);
-// if (!expectedAttrValue.equals(actualAttrValue)) {
-// return false;
-// }
-// }
+ List<Element> expectedChildren = expected.getChildren();
+ List<Element> actualChildren = actual.getChildren();
+ String expectedValue = expected.getValue();
+ String actualValue = actual.getValue();
- List<Element> expectedChildren = (List<Element>) expected.getChildren();
- List<Element> actualChildren = (List<Element>) actual.getChildren();
+ // we compare attributes.
+ if (expectedAttributes.size() != actualAttributes.size()) {
+ return false;
+ } else if (expectedAttributes.size() == 1) {
+ // case with only one attribute.
+ String expectedAttribute = expectedAttributes.toString();
+ String actualAttribute = actualAttributes.toString();
+ if (! expectedAttribute.equals(actualAttribute)) {
+ return false;
+ }
+ } else {
+ // case with only many attribute.
+ // TODO -> we have only one attribute for instance.
+ }
+
+ if(trace) {
+ System.out.println("Attribues");
+ System.out.println(expectedAttributes);
+ System.out.println(actualAttributes);
+
+// System.out.println("Children");
+// System.out.println(expectedChildren);
+// System.out.println(actualChildren);
+
+// System.out.println("Value");
+// System.out.println(expectedValue);
+// System.out.println(actualValue);
+ }
+
if (expectedChildren.size() != actualChildren.size()) {
return false;
} else if (expectedChildren.isEmpty()) {
- return expected.getContent().equals(actual.getContent());
+ if(trace) {
+ System.out.println(expectedValue);
+ System.out.println(actualValue);
+ }
+ return expected.getValue().equals(actual.getValue());
}
// System.out.println(expectedChildren);
// System.out.println(actualChildren);
@@ -272,15 +321,26 @@
if (testEquals(expectedChild,actualChild)) {
// actualChildren.remove(actualChild);
TF = true;
+ if(trace) {
+ System.out.println("EQUIVALENT");
+ System.out.println(expectedChild.getValue());
+ System.out.println(actualChild.getValue());
+ }
} else {
- // System.out.println(expectedChild.getChildren());
- // System.out.println(actualChild.getChildren());
+ if(trace) {
+ System.out.println("NOT EQUIVALENT");
+ System.out.println(expectedChild.getValue());
+ System.out.println(actualChild.getValue());
+ }
}
}
}
-// if (TF == false) {
-// return false;
-// }
+ if (TF == false) {
+ if(trace) {
+ System.out.println("RETURN FALSE");
+ }
+ return false;
+ }
}
return true;
@@ -312,8 +372,5 @@
Exporter exporter = new ToXML();
exporter.exportTo(nbt, null);
-
- Document a = new Document();
- Document b = new Document();
}
}
1
0
Author: afages
Date: 2010-02-28 12:00:34 +0100 (Sun, 28 Feb 2010)
New Revision: 142
Added:
trunk/src/site/reports/planningMSM.xls
Modified:
trunk/src/site/reports/CompteRendu_18-02-2010.rst
Log:
Ajout d'un planning pr?\195?\169visionnel dans reports/
Modified: trunk/src/site/reports/CompteRendu_18-02-2010.rst
===================================================================
--- trunk/src/site/reports/CompteRendu_18-02-2010.rst 2010-02-27 21:15:05 UTC (rev 141)
+++ trunk/src/site/reports/CompteRendu_18-02-2010.rst 2010-02-28 11:00:34 UTC (rev 142)
@@ -30,6 +30,7 @@
- Amélioration graphique sur tous les points (arbre, menu, boutons,...).
- Réalisation des "Cockburn" des cas d'utilisations.
- Test sous shell HBase sur le retour des méthodes et faire l'analogie avec l'API.
+- Planning de gestion de projet !
RAF (Reste à faire)
@@ -38,4 +39,5 @@
- Diagramme de classe.
- Décrire les actions du diagramme du cas d'utilisation.
- Schéma général de l'application (architecture, action entre les entités, dépendances,...).
-- Implémentation plus complexe de l'interface graphique.
\ No newline at end of file
+- Implémentation plus complexe de l'interface graphique.
+- Planning
\ No newline at end of file
Added: trunk/src/site/reports/planningMSM.xls
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/reports/planningMSM.xls
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
1
0
r141 - trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter
by dlanglais@users.nuiton.org 27 Feb '10
by dlanglais@users.nuiton.org 27 Feb '10
27 Feb '10
Author: dlanglais
Date: 2010-02-27 22:15:05 +0100 (Sat, 27 Feb 2010)
New Revision: 141
Added:
trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLTest.java
Removed:
trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ExporterTest.java
Log:
Commencement d'une fonction de comparaison de document jdom...
Deleted: trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ExporterTest.java
===================================================================
--- trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ExporterTest.java 2010-02-27 16:31:53 UTC (rev 140)
+++ trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ExporterTest.java 2010-02-27 21:15:05 UTC (rev 141)
@@ -1,251 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package org.nuiton.mapstoragemanager.plugins.exporter;
-
-import java.io.IOException;
-import java.lang.reflect.Field;
-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 org.jdom.output.Format;
-import org.jdom.output.XMLOutputter;
-import org.nuiton.mapstoragemanager.plugins.Exporter;
-import org.nuiton.mapstoragemanager.plugins.NewBigTable;
-import org.nuiton.mapstoragemanager.plugins.bighashmapv2.BigHashMap;
-
-/**
- *
- * @author Dorian Langlais
- */
-public class ExporterTest extends TestCase {
-
- /**
- * Logger.
- */
- private static final Log LOG = LogFactory.getLog(ExporterTest.class);
-// private static final Log LOGXML = LogFactory.getLog(ToXML.class);
- public void testToXML() {
-
- Document actual = null;
- Document expected = new Document();
-
- /********************************
- * Creation of the database. *
- ********************************/
- NewBigTable nbt = new BigHashMap();
- Element database = new Element("database");
- expected.addContent(database);
-
- /********************************
- * Creation of the tables. *
- ********************************/
- nbt.createTable("table1");
- Element table1 = new Element("table");
- Attribute table1name = new Attribute("tableName", "table1");
- table1.setAttribute(table1name);
- database.addContent(table1);
- nbt.createTable("table2");
- Element table2 = new Element("table");
- Attribute table2name = new Attribute("tableName", "table2");
- table2.setAttribute(table2name);
- database.addContent(table2);
-
- /********************************
- * Creation of the columns. *
- ********************************/
- nbt.createColumn("table1", "column1");
- Element column1 = new Element("column");
- Attribute column1name = new Attribute("columnName", "column1");
- column1.setAttribute(column1name);
- table1.addContent(column1);
-
- nbt.createColumn("table1", "column2");
- Element column2 = new Element("column");
- Attribute column2name = new Attribute("columnName", "column2");
- column2.setAttribute(column2name);
- table1.addContent(column2);
-
- nbt.createColumn("table2", "column3");
- Element column3 = new Element("column");
- Attribute column3name = new Attribute("columnName", "column3");
- column3.setAttribute(column3name);
- table2.addContent(column3);
-
- nbt.createColumn("table2", "column4");
- Element column4 = new Element("column");
- Attribute column4name = new Attribute("columnName", "column4");
- column4.setAttribute(column4name);
- table2.addContent(column4);
-
- nbt.createColumn("table2", "column5");
- Element column5 = new Element("column");
- Attribute column5name = new Attribute("columnName", "column5");
- column5.setAttribute(column5name);
- table2.addContent(column5);
-
-
- /********************************
- * Put elements in the columns. *
- ********************************/
- nbt.put("table1", "column1", "1", "content1");
- Element cell1 = new Element("cell");
- Attribute cell1key = new Attribute("key", "1");
- cell1.setAttribute(cell1key);
- column1.addContent(cell1);
- Element value1 = new Element("value");
- value1.setText("content1");
- cell1.addContent(value1);
-
- nbt.put("table1", "column1", "2", "content2");
- Element cell2 = new Element("cell");
- Attribute cell2key = new Attribute("key", "2");
- cell2.setAttribute(cell2key);
- column1.addContent(cell2);
- Element value2 = new Element("value");
- value2.setText("content2");
- cell2.addContent(value2);
-
- nbt.put("table1", "column2", "3", "content3");
- Element cell3 = new Element("cell");
- Attribute cell3key = new Attribute("key", "3");
- cell3.setAttribute(cell3key);
- column2.addContent(cell3);
- Element value3 = new Element("value");
- value3.setText("content3");
- cell3.addContent(value3);
-
- nbt.put("table1", "column2", "4", "content4");
- Element cell4 = new Element("cell");
- Attribute cell4key = new Attribute("key", "4");
- cell4.setAttribute(cell4key);
- column2.addContent(cell4);
- Element value4 = new Element("value");
- value4.setText("content4");
- cell4.addContent(value4);
-
- nbt.put("table2", "column3", "5", "content5");
- Element cell5 = new Element("cell");
- Attribute cell5key = new Attribute("key", "5");
- cell5.setAttribute(cell5key);
- column3.addContent(cell5);
- Element value5 = new Element("value");
- value5.setText("content5");
- cell5.addContent(value5);
-
- nbt.put("table2", "column3", "6", "content6");
- Element cell6 = new Element("cell");
- Attribute cell6key = new Attribute("key", "6");
- cell6.setAttribute(cell6key);
- column3.addContent(cell6);
- Element value6 = new Element("value");
- value6.setText("content6");
- cell6.addContent(value6);
-
- nbt.put("table2", "column4", "7", "content7");
- Element cell7 = new Element("cell");
- Attribute cell7key = new Attribute("key", "7");
- cell7.setAttribute(cell7key);
- column4.addContent(cell7);
- Element value7 = new Element("value");
- value7.setText("content7");
- cell7.addContent(value7);
-
- nbt.put("table2", "column4", "8", "content8");
- Element cell8 = new Element("cell");
- Attribute cell8key = new Attribute("key", "8");
- cell8.setAttribute(cell8key);
- column4.addContent(cell8);
- Element value8 = new Element("value");
- value8.setText("content8");
- cell8.addContent(value8);
-
- nbt.put("table2", "column5", "9", "content9");
- Element cell9 = new Element("cell");
- Attribute cell9key = new Attribute("key", "9");
- cell9.setAttribute(cell9key);
- column5.addContent(cell9);
- Element value9 = new Element("value");
- value9.setText("content9");
- cell9.addContent(value9);
-
- nbt.put("table2", "column5", "10", "content10");
- Element cell10 = new Element("cell");
- Attribute cell10key = new Attribute("key", "10");
- cell10.setAttribute(cell10key);
- column5.addContent(cell10);
- Element value10 = new Element("value");
- value10.setText("content10");
- cell10.addContent(value10);
-
- Exporter exporter = new ToXML();
- exporter.exportTo(nbt, null);
-
-
-// expected.toString();
-
- Field fdocument;
- try {
- fdocument = exporter.getClass().getDeclaredField("document");
- fdocument.setAccessible(true);
- actual = (Document) fdocument.get(exporter);
- } catch (IllegalArgumentException ex) {
- LOG.error(ex, ex);
- } catch (IllegalAccessException ex) {
- LOG.error(ex, ex);
- } catch (NoSuchFieldException ex) {
- LOG.error(ex, ex);
- } catch (SecurityException ex) {
- LOG.error(ex, ex);
- }
-
- try {
- XMLOutputter output = new XMLOutputter(Format.getPrettyFormat());
- output.output(expected, System.out);
- output.output(actual, System.out);
- } catch (IOException ex) {
- LOG.error(ex, ex);
- }
-
-// System.out.println(expected);
-// System.out.println(actual);
-// assertEquals(expected.toString(),actual.toString());
-// assertEquals(expected, actual);
- }
-
- public static void main(String[] args) {
- NewBigTable nbt = new BigHashMap();
- nbt.createTable("table1");
- nbt.createTable("table2");
-
- nbt.createColumn("table1", "column1");
- nbt.createColumn("table1", "column2");
-
- nbt.createColumn("table2", "column3");
- nbt.createColumn("table2", "column4");
- nbt.createColumn("table2", "column5");
-
- nbt.put("table1", "column1", "1", "content1");
- nbt.put("table1", "column1", "2", "content2");
- nbt.put("table1", "column2", "3", "content3");
- nbt.put("table1", "column2", "4", "content4");
-
- nbt.put("table2", "column3", "5", "content5");
- nbt.put("table2", "column3", "6", "content6");
- nbt.put("table2", "column4", "7", "content7");
- nbt.put("table2", "column4", "8", "content8");
- nbt.put("table2", "column5", "9", "content9");
- nbt.put("table2", "column5", "10", "content10");
-
- Exporter exporter = new ToXML();
- exporter.exportTo(nbt, null);
-
- Document a = new Document();
- Document b = new Document();
- }
-}
Added: 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 (rev 0)
+++ trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLTest.java 2010-02-27 21:15:05 UTC (rev 141)
@@ -0,0 +1,319 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.nuiton.mapstoragemanager.plugins.exporter;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.util.List;
+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 org.jdom.output.Format;
+import org.jdom.output.XMLOutputter;
+import org.nuiton.mapstoragemanager.plugins.Exporter;
+import org.nuiton.mapstoragemanager.plugins.NewBigTable;
+import org.nuiton.mapstoragemanager.plugins.bighashmapv2.BigHashMap;
+
+/**
+ *
+ * @author Dorian Langlais
+ */
+public class ToXMLTest extends TestCase {
+
+ /**
+ * Logger.
+ */
+ private static final Log LOG = LogFactory.getLog(ToXMLTest.class);
+
+ /**
+ * Test to export a bigTable database in a xml format.
+ */
+ public void testToXML() {
+
+ Document actual = null;
+ Document expected = new Document();
+
+ /********************************
+ * Creation of the database. *
+ ********************************/
+ NewBigTable nbt = new BigHashMap();
+ Element database = new Element("database");
+ expected.addContent(database);
+
+ /********************************
+ * Creation of the tables. *
+ ********************************/
+ nbt.createTable("table1");
+ Element table1 = new Element("table");
+ Attribute table1name = new Attribute("tableName", "table1");
+ table1.setAttribute(table1name);
+ database.addContent(table1);
+ nbt.createTable("table2");
+ Element table2 = new Element("table");
+ Attribute table2name = new Attribute("tableName", "table2");
+ table2.setAttribute(table2name);
+ database.addContent(table2);
+
+ /********************************
+ * Creation of the columns. *
+ ********************************/
+ nbt.createColumn("table1", "column1");
+ Element column1 = new Element("column");
+ Attribute column1name = new Attribute("columnName", "column1");
+ column1.setAttribute(column1name);
+ table1.addContent(column1);
+
+ nbt.createColumn("table1", "column2");
+ Element column2 = new Element("column");
+ Attribute column2name = new Attribute("columnName", "column2");
+ column2.setAttribute(column2name);
+ table1.addContent(column2);
+
+ nbt.createColumn("table2", "column3");
+ Element column3 = new Element("column");
+ Attribute column3name = new Attribute("columnName", "column3");
+ column3.setAttribute(column3name);
+ table2.addContent(column3);
+
+ nbt.createColumn("table2", "column4");
+ Element column4 = new Element("column");
+ Attribute column4name = new Attribute("columnName", "column4");
+ column4.setAttribute(column4name);
+ table2.addContent(column4);
+
+ nbt.createColumn("table2", "column5");
+ Element column5 = new Element("column");
+ Attribute column5name = new Attribute("columnName", "column5");
+ column5.setAttribute(column5name);
+ table2.addContent(column5);
+
+
+ /********************************
+ * Put elements in the columns. *
+ ********************************/
+ nbt.put("table1", "column1", "1", "content1");
+ Element cell1 = new Element("cell");
+ Attribute cell1key = new Attribute("key", "1");
+ cell1.setAttribute(cell1key);
+ column1.addContent(cell1);
+ Element value1 = new Element("value");
+ value1.setText("content1");
+ cell1.addContent(value1);
+
+ nbt.put("table1", "column1", "2", "content2");
+ Element cell2 = new Element("cell");
+ Attribute cell2key = new Attribute("key", "2");
+ cell2.setAttribute(cell2key);
+ column1.addContent(cell2);
+ Element value2 = new Element("value");
+ value2.setText("content2");
+ cell2.addContent(value2);
+
+ nbt.put("table1", "column2", "3", "content3");
+ Element cell3 = new Element("cell");
+ Attribute cell3key = new Attribute("key", "3");
+ cell3.setAttribute(cell3key);
+ column2.addContent(cell3);
+ Element value3 = new Element("value");
+ value3.setText("content3");
+ cell3.addContent(value3);
+
+ nbt.put("table1", "column2", "4", "content4");
+ Element cell4 = new Element("cell");
+ Attribute cell4key = new Attribute("key", "4");
+ cell4.setAttribute(cell4key);
+ column2.addContent(cell4);
+ Element value4 = new Element("value");
+ value4.setText("content4");
+ cell4.addContent(value4);
+
+ nbt.put("table2", "column3", "5", "content5");
+ Element cell5 = new Element("cell");
+ Attribute cell5key = new Attribute("key", "5");
+ cell5.setAttribute(cell5key);
+ column3.addContent(cell5);
+ Element value5 = new Element("value");
+ value5.setText("content5");
+ cell5.addContent(value5);
+
+// nbt.put("table2", "column3", "6", "content6");
+// Element cell6 = new Element("cell");
+// Attribute cell6key = new Attribute("key", "6");
+// cell6.setAttribute(cell6key);
+// column3.addContent(cell6);
+// Element value6 = new Element("value");
+// value6.setText("content6");
+// cell6.addContent(value6);
+//
+// nbt.put("table2", "column4", "7", "content7");
+// Element cell7 = new Element("cell");
+// Attribute cell7key = new Attribute("key", "7");
+// cell7.setAttribute(cell7key);
+// column4.addContent(cell7);
+// Element value7 = new Element("value");
+// value7.setText("content7");
+// cell7.addContent(value7);
+//
+// nbt.put("table2", "column4", "8", "content8");
+// Element cell8 = new Element("cell");
+// Attribute cell8key = new Attribute("key", "8");
+// cell8.setAttribute(cell8key);
+// column4.addContent(cell8);
+// Element value8 = new Element("value");
+// value8.setText("content8");
+// cell8.addContent(value8);
+//
+// nbt.put("table2", "column5", "9", "content9");
+// Element cell9 = new Element("cell");
+// Attribute cell9key = new Attribute("key", "9");
+// cell9.setAttribute(cell9key);
+// column5.addContent(cell9);
+// Element value9 = new Element("value");
+// value9.setText("content9");
+// cell9.addContent(value9);
+//
+// nbt.put("table2", "column5", "10", "content10");
+// Element cell10 = new Element("cell");
+// Attribute cell10key = new Attribute("key", "10");
+// cell10.setAttribute(cell10key);
+// column5.addContent(cell10);
+// Element value10 = new Element("value");
+// value10.setText("content10");
+// cell10.addContent(value10);
+
+ Exporter exporter = new ToXML();
+ exporter.exportTo(nbt, null);
+
+
+// expected.toString();
+
+ Field fdocument;
+ try {
+ fdocument = exporter.getClass().getDeclaredField("document");
+ fdocument.setAccessible(true);
+ actual = (Document) fdocument.get(exporter);
+ } catch (IllegalArgumentException ex) {
+ LOG.error(ex, ex);
+ } catch (IllegalAccessException ex) {
+ LOG.error(ex, ex);
+ } catch (NoSuchFieldException ex) {
+ LOG.error(ex, ex);
+ } catch (SecurityException ex) {
+ LOG.error(ex, ex);
+ }
+
+ try {
+ XMLOutputter output = new XMLOutputter(Format.getPrettyFormat());
+ output.output(expected, System.out);
+ output.output(actual, System.out);
+ } catch (IOException ex) {
+ LOG.error(ex, ex);
+ }
+
+// assertEquals(expected,actual);
+// testEquals(expected.getRootElement(),actual.getRootElement());
+// System.out.println(expected);
+// System.out.println(actual);
+// assertEquals(expected.toString(),actual.toString());
+// assertEquals(expected, actual);
+ }
+
+ public static boolean testEquals(Element expected, Element actual) {
+
+ System.out.println(expected.getContent());
+ System.out.println(actual.getContent());
+
+ // same attribute list.
+// if (!expected.getAttributes().equals(actual.getAttributes())) {
+// return false;
+// }
+
+// if (!expected.getAttributes().equals(actual.getAttributes())) {
+// return false;
+// }
+
+// System.out.println(expected.getAttributes());
+// System.out.println(actual.getAttributes());
+ // same attributes values.
+// for (Attribute attribute : (List<Attribute>) expected.getAttributes()) {
+// String attrName = attribute.getName();
+// String expectedAttrValue = expected.getAttributeValue(attrName);
+// String actualAttrValue = actual.getAttributeValue(attrName);
+// if (!expectedAttrValue.equals(actualAttrValue)) {
+// return false;
+// }
+// }
+
+
+ List<Element> expectedChildren = (List<Element>) expected.getChildren();
+ List<Element> actualChildren = (List<Element>) actual.getChildren();
+
+ if (expectedChildren.size() != actualChildren.size()) {
+ return false;
+ } else if (expectedChildren.isEmpty()) {
+ return expected.getContent().equals(actual.getContent());
+ }
+// System.out.println(expectedChildren);
+// System.out.println(actualChildren);
+
+ boolean TF;
+ // same elements.
+ for (Element expectedChild : expectedChildren) {
+ TF = false;
+ for (Element actualChild : actualChildren) {
+ if(actualChild.getChildren().size() ==
+ expectedChild.getChildren().size()) {
+ if (testEquals(expectedChild,actualChild)) {
+// actualChildren.remove(actualChild);
+ TF = true;
+ } else {
+ // System.out.println(expectedChild.getChildren());
+ // System.out.println(actualChild.getChildren());
+ }
+ }
+ }
+// if (TF == false) {
+// return false;
+// }
+ }
+
+ return true;
+ }
+
+ public static void main(String[] args) {
+ NewBigTable nbt = new BigHashMap();
+ nbt.createTable("table1");
+ nbt.createTable("table2");
+
+ nbt.createColumn("table1", "column1");
+ nbt.createColumn("table1", "column2");
+
+ nbt.createColumn("table2", "column3");
+ nbt.createColumn("table2", "column4");
+ nbt.createColumn("table2", "column5");
+
+ nbt.put("table1", "column1", "1", "content1");
+ nbt.put("table1", "column1", "2", "content2");
+ nbt.put("table1", "column2", "3", "content3");
+ nbt.put("table1", "column2", "4", "content4");
+
+ nbt.put("table2", "column3", "5", "content5");
+ nbt.put("table2", "column3", "6", "content6");
+ nbt.put("table2", "column4", "7", "content7");
+ nbt.put("table2", "column4", "8", "content8");
+ nbt.put("table2", "column5", "9", "content9");
+ nbt.put("table2", "column5", "10", "content10");
+
+ Exporter exporter = new ToXML();
+ exporter.exportTo(nbt, null);
+
+ Document a = new Document();
+ Document b = new Document();
+ }
+}
1
0