[Joafip-svn] SF.net SVN: joafip:[2970] trunk
Brought to you by:
luc_peuvrier
|
From: <luc...@us...> - 2011-11-18 02:52:34
|
Revision: 2970
http://joafip.svn.sourceforge.net/joafip/?rev=2970&view=rev
Author: luc_peuvrier
Date: 2011-11-18 02:52:27 +0000 (Fri, 18 Nov 2011)
Log Message:
-----------
error in xml value import reading corrected
Modified Paths:
--------------
trunk/joafip/doc/_todo.txt
trunk/joafip/doc/missing.txt
trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/InValueHandler.java
trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/Item.java
trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestEnumMap.java
trunk/joafip-4test/src/main/java/net/sf/joafip/asm/MainAsmForNewProxyCallBack.java
trunk/joafip-4test/src/main/java/net/sf/joafip/asm/NewProxyCallBack.java
trunk/joafip-4test/src/main/java/net/sf/joafip/bugtree/MainTreeBlockFile.java
trunk/joafip-4test/src/main/java/net/sf/joafip/bugtree/MainTreeDual.java
trunk/joafip-4test/src/main/java/net/sf/joafip/bugtree/MainTreeMultiFile.java
trunk/joafip-4test/src/main/java/net/sf/joafip/bugtree/TreeMem.java
trunk/joafip-4test/src/main/java/net/sf/joafip/performance/items/service/AbstractSearcher.java
trunk/joafip-testsuite/src/main/java/net/sf/joafip/PersistanceTestsNoLongTests.java
Added Paths:
-----------
trunk/joafip/src/test/java/net/sf/joafip/util/TestXmlWriter.java
trunk/joafip-testsuite/src/main/java/net/sf/joafip/util/
trunk/joafip-testsuite/src/main/java/net/sf/joafip/util/UtilTests.java
Removed Paths:
-------------
trunk/joafip-4test/src/main/java/net/sf/joafip/performance/items/service/MainExportScanner.java
Modified: trunk/joafip/doc/_todo.txt
===================================================================
--- trunk/joafip/doc/_todo.txt 2011-11-13 06:40:17 UTC (rev 2969)
+++ trunk/joafip/doc/_todo.txt 2011-11-18 02:52:27 UTC (rev 2970)
@@ -19,6 +19,7 @@
- asm 3.3 embedded
- java agent changed
- project divided on sub project
+- import error reading xml value corrected
- export speed up
- kept in memory for object referenced by static field
- persisted class byte code checked for persistence constraints
@@ -79,25 +80,25 @@
currently:
-------------------------------------------------------------------------------------
-auto save problems with jhupedom:
-- HeapFileDataManager problem ?
-
-export/import problem.
-- test with BlockDataManger
+export:
- no more static field management
+- use of a linked list in file instead of heapFileDataManager
xml file for export:
bad namespace xmlns="http://joafip.sourceforge.net/schema"
should be xmlns="http://joafip.sourceforge.net"
may be /joafip/src/main/java/net/sf/joafip/store/service/export_import/joafip.xsd to update
+auto save problems with jhupedom:
+- HeapFileDataManager problem ?
+
+garbage management error with jhupedom
+
BlockDataManger
- test performance with cache, if ok it is a good alternative but:
- big file, do not reuse free space
- fixed max data record length
-garbage management error with jhupedom
-
kept in memory problem
joafip reflect project (see setAccessible )
Modified: trunk/joafip/doc/missing.txt
===================================================================
--- trunk/joafip/doc/missing.txt 2011-11-13 06:40:17 UTC (rev 2969)
+++ trunk/joafip/doc/missing.txt 2011-11-18 02:52:27 UTC (rev 2970)
@@ -3,4 +3,64 @@
missing list=[108738, 118200, 132948, 142808, 165872]
using HeapFileDataManager:
-missing list=[108738, 118200, 132948, 142808, 165872]
\ No newline at end of file
+missing list=[108738, 118200, 132948, 142808, 165872]
+
+from xml analyse: check of item identifier
+missing 197290 197290
+missing 197806 197806
+missing 230918 230918
+missing 244118 244118
+missing 250610 250610
+missing 252190 252190
+missing 285034 285034
+missing 298138 298138
+missing 303602 303602
+missing 307170 307170
+missing 315234 315234
+missing 331234 331234
+missing 357662 357662
+missing 361086 361086
+missing 373054 373054
+missing 386462 386462
+missing 412458 412458
+missing 412794 412794
+missing 443458 443458
+missing 476050 476050
+missing 520578 520578
+missing 522050 522050
+missing 524382 524382
+
+
+from import searcher:
+ missing list=
+108738
+118200
+132948
+142808
+165872
+
+mismatch list=
+
+90 for 197290
+6 for 197806
+8 for 230918
+8 for 244118
+10 for 250610
+90 for 252190
+4 for 285034
+38 for 298138
+2 for 303602
+0 for 307170
+34 for 315234
+4 for 331234
+2 for 357662
+86 for 361086
+54 for 373054
+62 for 386462
+8 for 412458
+4 for 412794
+8 for 443458
+0 for 476050
+78 for 520578
+0 for 522050
+82 for 524382
\ No newline at end of file
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/InValueHandler.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/InValueHandler.java 2011-11-13 06:40:17 UTC (rev 2969)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/InValueHandler.java 2011-11-18 02:52:27 UTC (rev 2970)
@@ -28,7 +28,7 @@
@NotStorableClass
public class InValueHandler extends InSimpleHandler {
- private Object data;
+ private final StringBuilder dataBuilder = new StringBuilder();
public InValueHandler(final XmlImporter xmlImporter) {
super(xmlImporter);
@@ -37,11 +37,11 @@
@Override
public void characters(final char[] chars, final int start, final int length)// NOPMD
throws SAXException {
- data = new String(chars, start, length);
+ dataBuilder.append(chars, start, length);
}
@Override
public Object getData() {
- return data;
+ return dataBuilder.toString();
}
}
Modified: trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/Item.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/Item.java 2011-11-13 06:40:17 UTC (rev 2969)
+++ trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/Item.java 2011-11-18 02:52:27 UTC (rev 2970)
@@ -42,8 +42,7 @@
this.identifier = identifier;
}
- public Item(final int identifier,
- final String value) {
+ public Item(final int identifier, final String value) {
super();
this.identifier = identifier;
this.value = value;
Modified: trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestEnumMap.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestEnumMap.java 2011-11-13 06:40:17 UTC (rev 2969)
+++ trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestEnumMap.java 2011-11-18 02:52:27 UTC (rev 2970)
@@ -65,17 +65,17 @@
IFilePersistence filePersistence = createFilePersistence(true);
IDataAccessSession session = filePersistence.createDataAccessSession();
session.open();
- Item item=new Item(0, "value");
- session.setObject("key",item);
+ Item item = new Item(0, "value");
+ session.setObject("key", item);
session.closeAndWait(EnumFilePersistenceCloseAction.SAVE);
filePersistence.close();
filePersistence = createFilePersistence(false);
session = filePersistence.createDataAccessSession();
session.open();
- item=(Item) session.getObject("key");
- assertEquals("bad state",0,item.getIdentifier());
- assertEquals("bad state","value",item.getValue());
+ item = (Item) session.getObject("key");
+ assertEquals("bad state", 0, item.getIdentifier());
+ assertEquals("bad state", "value", item.getValue());
session.closeAndWait(EnumFilePersistenceCloseAction.SAVE);
filePersistence.close();
}
Added: trunk/joafip/src/test/java/net/sf/joafip/util/TestXmlWriter.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/util/TestXmlWriter.java (rev 0)
+++ trunk/joafip/src/test/java/net/sf/joafip/util/TestXmlWriter.java 2011-11-18 02:52:27 UTC (rev 2970)
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2011 Luc Peuvrier
+ *
+ * This file is a part of JOAFIP.
+ *
+ * JOAFIP is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License.
+ *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE
+ * Licensed under the LGPL License, Version 3, 29 June 2007 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * JOAFIP is distributed in the hope that it will be useful, but
+ * unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.joafip.util;
+
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+
+import net.sf.joafip.AbstractJoafipTestCase;
+import net.sf.joafip.NoStorableAccess;
+import net.sf.joafip.NotStorableClass;
+import net.sf.joafip.TestConstant;
+import net.sf.joafip.TestException;
+
+/**
+ *
+ * @author luc peuvrier
+ *
+ */
+@NotStorableClass
+@NoStorableAccess
+public class TestXmlWriter extends AbstractJoafipTestCase {
+
+ public TestXmlWriter() throws TestException {
+ super();
+ }
+
+ public TestXmlWriter(final String name) throws TestException {
+ super(name);
+ }
+
+ public void test() throws XmlWriterException, IOException, TestException {
+ final String file = TestConstant.getWinRamDiskRuntimeDir()
+ + "/xmlWriterTestFile.txt";
+ final OutputStream outputStream = new FileOutputStream(file);
+ final XmlWriter xmlWriter = new XmlWriter(outputStream);
+ for (int index = 0; index <= 1000000; index++) {
+ xmlWriter
+ .writeText(0, Integer.toString(index), true/* writeNewLine */);
+ }
+ xmlWriter.close();
+
+ final BufferedReader reader = new BufferedReader(new InputStreamReader(
+ new FileInputStream(file), "UTF-8"));
+ int index = 0;
+ String line;
+ // skip xml declaration
+ assertNotNull("must has line", reader.readLine());
+ // then check lines
+ while ((line = reader.readLine()) != null) {// NOPMD
+ final int value = Integer.parseInt(line);
+ assertEquals("bad value", index, value);
+ index++;
+ }
+ assertEquals("missing value", 1000001, index);
+ reader.close();
+ }
+}
Modified: trunk/joafip-4test/src/main/java/net/sf/joafip/asm/MainAsmForNewProxyCallBack.java
===================================================================
--- trunk/joafip-4test/src/main/java/net/sf/joafip/asm/MainAsmForNewProxyCallBack.java 2011-11-13 06:40:17 UTC (rev 2969)
+++ trunk/joafip-4test/src/main/java/net/sf/joafip/asm/MainAsmForNewProxyCallBack.java 2011-11-18 02:52:27 UTC (rev 2970)
@@ -6,8 +6,9 @@
public static void main(final String[] args) {
try {
- ASMifierClassVisitor.outAsm(false, NewProxyCallBack.class.getName(),
- "src/main/java/asm/net/sf/joafip/asm/NewProxyCallBackDump.java");
+ ASMifierClassVisitor
+ .outAsm(false, NewProxyCallBack.class.getName(),
+ "src/main/java/asm/net/sf/joafip/asm/NewProxyCallBackDump.java");
} catch (Exception e) {
e.printStackTrace();// NOPMD
}
Modified: trunk/joafip-4test/src/main/java/net/sf/joafip/asm/NewProxyCallBack.java
===================================================================
--- trunk/joafip-4test/src/main/java/net/sf/joafip/asm/NewProxyCallBack.java 2011-11-13 06:40:17 UTC (rev 2969)
+++ trunk/joafip-4test/src/main/java/net/sf/joafip/asm/NewProxyCallBack.java 2011-11-18 02:52:27 UTC (rev 2970)
@@ -8,10 +8,9 @@
private final IProxyCallBackProxyDelegation proxyCallBack;
- public NewProxyCallBack()
- throws ProxyException {
+ public NewProxyCallBack() throws ProxyException {
super();
- proxyCallBack=new ProxyCallBack();
+ proxyCallBack = new ProxyCallBack();
}
public IProxyCallBackProxyDelegation getProxyCallBack() {
Modified: trunk/joafip-4test/src/main/java/net/sf/joafip/bugtree/MainTreeBlockFile.java
===================================================================
--- trunk/joafip-4test/src/main/java/net/sf/joafip/bugtree/MainTreeBlockFile.java 2011-11-13 06:40:17 UTC (rev 2969)
+++ trunk/joafip-4test/src/main/java/net/sf/joafip/bugtree/MainTreeBlockFile.java 2011-11-18 02:52:27 UTC (rev 2970)
@@ -45,7 +45,8 @@
FilePersistenceTooBigForSerializationException, RBTException,
HeapException {
final FilePersistenceBuilder builder = new FilePersistenceBuilder();
- final IHeapDataManager dataManager = new BlockDataManager(10 * 1024, 10 * 1024,1024);
+ final IHeapDataManager dataManager = new BlockDataManager(10 * 1024,
+ 10 * 1024, 1024);
builder.setDataManager(dataManager);
builder.setProxyMode(true);
builder.setRemoveFiles(true);
Modified: trunk/joafip-4test/src/main/java/net/sf/joafip/bugtree/MainTreeDual.java
===================================================================
--- trunk/joafip-4test/src/main/java/net/sf/joafip/bugtree/MainTreeDual.java 2011-11-13 06:40:17 UTC (rev 2969)
+++ trunk/joafip-4test/src/main/java/net/sf/joafip/bugtree/MainTreeDual.java 2011-11-18 02:52:27 UTC (rev 2970)
@@ -51,18 +51,21 @@
FilePersistenceTooBigForSerializationException, RBTException,
HeapException, TestException {
final FilePersistenceBuilder builder = new FilePersistenceBuilder();
- final String dir = "runtime";//TestConstant.getWinRamDiskRuntimeDir();
- final IHeapDataManager blockDataManager = new BlockDataManager(dir+"/data",1024);
-// 10 * 1024, 10 * 1024);
- final HeapFileSetup setup = new HeapFileSetup(new File(dir+"/store.data"), false/*crashSafeMode*/,
- false/*useCacheMode*/,false/*deleteRenaming*/, false/*clearResizeFile*/,
- 0/*maxFileOperationRetry*/,0/*fileOperationRetryMsDelay*/,
- new File("runtime/openFileTraceFile.txt"));
+ final String dir = "runtime";// TestConstant.getWinRamDiskRuntimeDir();
+ final IHeapDataManager blockDataManager = new BlockDataManager(dir
+ + "/data", 1024);
+ // 10 * 1024, 10 * 1024);
+ final HeapFileSetup setup = new HeapFileSetup(new File(dir
+ + "/store.data"), false/* crashSafeMode */,
+ false/* useCacheMode */, false/* deleteRenaming */,
+ false/* clearResizeFile */, 0/* maxFileOperationRetry */,
+ 0/* fileOperationRetryMsDelay */, new File(
+ "runtime/openFileTraceFile.txt"));
final IHeapDataManager fileDataManager = new HeapFileDataManager(setup);
builder.setDataManager(new DualWrapDataManager(fileDataManager,
blockDataManager));
-
+
builder.setProxyMode(true);
builder.setRemoveFiles(true);
builder.setCrashSafeMode(false);
Modified: trunk/joafip-4test/src/main/java/net/sf/joafip/bugtree/MainTreeMultiFile.java
===================================================================
--- trunk/joafip-4test/src/main/java/net/sf/joafip/bugtree/MainTreeMultiFile.java 2011-11-13 06:40:17 UTC (rev 2969)
+++ trunk/joafip-4test/src/main/java/net/sf/joafip/bugtree/MainTreeMultiFile.java 2011-11-18 02:52:27 UTC (rev 2970)
@@ -77,7 +77,7 @@
@Override
public void saveDone(final int numberOfObjectState,
final int numberOfWeakreference, final long msDuration) {
- System.out.println("n=" + numberOfObjectState + " w="//NOPMD
+ System.out.println("n=" + numberOfObjectState + " w="// NOPMD
+ numberOfWeakreference + " t=" + msDuration + " mS");
}
}
Modified: trunk/joafip-4test/src/main/java/net/sf/joafip/bugtree/TreeMem.java
===================================================================
--- trunk/joafip-4test/src/main/java/net/sf/joafip/bugtree/TreeMem.java 2011-11-13 06:40:17 UTC (rev 2969)
+++ trunk/joafip-4test/src/main/java/net/sf/joafip/bugtree/TreeMem.java 2011-11-18 02:52:27 UTC (rev 2970)
@@ -9,7 +9,7 @@
import net.sf.joafip.redblacktree.service.RedBlackTree;
@StorableClass
-public class TreeMem<E> extends Tree<E>{
+public class TreeMem<E> extends Tree<E> {
@AssertNotNull
protected final RedBlackTree<E> redBlackTree;
Modified: trunk/joafip-4test/src/main/java/net/sf/joafip/performance/items/service/AbstractSearcher.java
===================================================================
--- trunk/joafip-4test/src/main/java/net/sf/joafip/performance/items/service/AbstractSearcher.java 2011-11-13 06:40:17 UTC (rev 2969)
+++ trunk/joafip-4test/src/main/java/net/sf/joafip/performance/items/service/AbstractSearcher.java 2011-11-18 02:52:27 UTC (rev 2970)
@@ -32,6 +32,7 @@
import net.sf.joafip.entity.EnumFilePersistenceCloseAction;
import net.sf.joafip.heapfile.service.IHeapDataManager;
import net.sf.joafip.logger.JoafipLogger;
+import net.sf.joafip.performance.items.entity.Item;
import net.sf.joafip.performance.items.entity.ItemList;
import net.sf.joafip.service.FilePersistenceClassNotFoundException;
import net.sf.joafip.service.FilePersistenceDataCorruptedException;
@@ -86,18 +87,29 @@
initializeByItemDuration();
int missingCount = 0;
final List<Integer> missingList = new LinkedList<Integer>();
+ int misMatchCount = 0;
+ final List<String> misMatchList = new LinkedList<String>();
for (int identifier = 0; identifier < NUMBER_OF_ITEM; identifier++) {
final ItemList itemList = getItemList(session);
final long startSearchTime = System.currentTimeMillis();
- if (itemList.get(identifier) == null) {
+ final Item item = itemList.get(identifier);
+ if (item == null) {
// throw new
// IllegalStateException("missing item for identifier "
// + identifier);
logger.info("missing item for identifier " + identifier);
missingCount++;
- if (missingCount < 20) {
+ if (missingCount < 40) {
missingList.add(identifier);
}
+ } else {
+ if (item.getIdentifier() != identifier) {
+ misMatchCount++;
+ if (misMatchCount < 40) {
+ misMatchList.add(item.getIdentifier() + " for "
+ + identifier);
+ }
+ }
}
final long currentTime = System.currentTimeMillis();
final long searchDuration = currentTime - startSearchTime;
@@ -123,8 +135,27 @@
logger.info("max search time " + maxSearchTime);
logger.info((endTime - startTime) + " mS for " + NUMBER_OF_ITEM
+ " items");
+
logger.info("missing count=" + missingCount);
- logger.info("missing list=" + missingList.toString());
+ StringBuilder stringBuilder = new StringBuilder();
+
+ stringBuilder.append("missing list=\n");
+ for (int missing : missingList) {
+ stringBuilder.append(missing);
+ stringBuilder.append('\n');
+ }
+ logger.info(stringBuilder.toString());
+
+ logger.info("mismatch count=" + misMatchCount);
+
+ stringBuilder = new StringBuilder();
+ stringBuilder.append("mismatch list=\n");
+ for (String mismatch : misMatchList) {
+ stringBuilder.append(mismatch);
+ stringBuilder.append('\n');
+ }
+ logger.info(stringBuilder.toString());
+
final ObjectOutputStream objectOutputStream = new ObjectOutputStream(
new FileOutputStream(DURATION_BIN));
objectOutputStream.writeObject(byItemDuration);
Deleted: trunk/joafip-4test/src/main/java/net/sf/joafip/performance/items/service/MainExportScanner.java
===================================================================
--- trunk/joafip-4test/src/main/java/net/sf/joafip/performance/items/service/MainExportScanner.java 2011-11-13 06:40:17 UTC (rev 2969)
+++ trunk/joafip-4test/src/main/java/net/sf/joafip/performance/items/service/MainExportScanner.java 2011-11-18 02:52:27 UTC (rev 2970)
@@ -1,240 +0,0 @@
-/*
- * Copyright 2011 Luc Peuvrier
- *
- * This file is a part of JOAFIP.
- *
- * JOAFIP is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License.
- *
- * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE
- * Licensed under the LGPL License, Version 3, 29 June 2007 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.gnu.org/licenses/lgpl.html
- *
- * JOAFIP is distributed in the hope that it will be useful, but
- * unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.joafip.performance.items.service;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Arrays;
-import java.util.Deque;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.Set;
-import java.util.TreeSet;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import net.sf.joafip.NotStorableClass;
-import net.sf.joafip.logger.JoafipLogger;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.XMLReader;
-
-/**
- *
- * @author luc peuvrier
- *
- */
-@NotStorableClass
-public final class MainExportScanner implements ErrorHandler, ContentHandler {
-
- private static final JoafipLogger LOGGER = JoafipLogger
- .getLogger(MainExportScanner.class);
-
- private final Deque<String> que = new LinkedList<String>();
-
- private final Deque<String> attrQue = new LinkedList<String>();
-
- private final Set<Integer> valueSet = new TreeSet<Integer>();
-
- private int total;
-
- private int count;
-
- private PrintWriter printWriter;
-
- private MainExportScanner() {
- super();
- }
-
- public static void main(final String[] args) {
- try {
- final MainExportScanner main = new MainExportScanner();
- main.run();
- } catch (Exception exception) {
- LOGGER.error("execution failure", exception);
- }
- }
-
- private void run() throws ParserConfigurationException, SAXException,
- IOException {
- printWriter = new PrintWriter(new File(
- "runtime_perf/export/missing.txt"));
- total = 0;
- count = 0;
- valueSet.add(108738);
- valueSet.add(118200);
- valueSet.add(132948);
- valueSet.add(142808);
- valueSet.add(165872);
-
- final SAXParserFactory factory = SAXParserFactory.newInstance();
- factory.setValidating(false);
- factory.setNamespaceAware(true);
- final SAXParser parser = factory.newSAXParser();
- final XMLReader reader = parser.getXMLReader();
- reader.setErrorHandler(this);
- reader.setContentHandler(this);
- reader.parse(new InputSource("runtime_perf/export/export.xml"));
- System.out.println("count=" + count + " total=" + total);// NOPMD
- printWriter.close();
- }
-
- @Override
- public void warning(final SAXParseException exception) throws SAXException {
- LOGGER.warn("sax error", exception);
- }
-
- @Override
- public void error(final SAXParseException exception) throws SAXException {
- LOGGER.warn("sax error", exception);
- }
-
- @Override
- public void fatalError(final SAXParseException exception)
- throws SAXException {
- LOGGER.warn("sax error", exception);
- }
-
- @Override
- public void startDocument() throws SAXException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void endDocument() throws SAXException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void setDocumentLocator(final Locator locator) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void startPrefixMapping(final String prefix, final String uri)
- throws SAXException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void endPrefixMapping(final String prefix) throws SAXException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void startElement(final String uri, final String localName,
- final String qName, final Attributes atts) throws SAXException {
- final StringBuilder stringBuilder = new StringBuilder();
- final String peekLast = que.peekLast();
- if (peekLast != null) {
- stringBuilder.append(peekLast);
- }
- stringBuilder.append('/');
- stringBuilder.append(localName);
- if ("field".equals(localName)) {
- stringBuilder.append('{');
- stringBuilder.append(atts.getValue("name"));
- stringBuilder.append(',');
- stringBuilder.append(atts.getValue("declClass"));
- stringBuilder.append('}');
- }
- que.addLast(stringBuilder.toString());
- attrQue.addLast(attrToString(atts));
- }
-
- @Override
- public void endElement(final String uri, final String localName,
- final String qName) throws SAXException {
- que.removeLast();
- attrQue.removeLast();
- }
-
- @Override
- public void characters(final char[] chars, final int start, final int length)
- throws SAXException {
- final String peekLast = que.peekLast();
- if ("/objects/object/field{identifier,net.sf.joafip.performance.items.entity.Item}/value"
- .equals(peekLast)) {
- final int value = Integer.parseInt(new String(Arrays.copyOfRange(
- chars, start, start + length)));
- total++;
- if (valueSet.contains(value)) {
- count++;
- final Iterator<String> iterator = attrQue.descendingIterator();
- for (int count = 0; count < 2; count++) {
- iterator.next();
- }
- final String attrs = iterator.next();
- printWriter.print(attrs);
- printWriter.print(", value=");
- printWriter.println(value);
- }
- }
- }
-
- private String attrToString(final Attributes attrs) {
- final StringBuilder stringBuilder = new StringBuilder();
- final int length = attrs.getLength();
- for (int index = 0; index < length; index++) {
- stringBuilder.append(attrs.getQName(index));
- stringBuilder.append('=');
- stringBuilder.append(attrs.getValue(index));
- stringBuilder.append(',');
- }
- return stringBuilder.toString();
- }
-
- @Override
- public void ignorableWhitespace(final char[] chars, final int start,
- final int length) throws SAXException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void processingInstruction(final String target, final String data)
- throws SAXException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void skippedEntity(final String name) throws SAXException {
- // TODO Auto-generated method stub
-
- }
-}
Modified: trunk/joafip-testsuite/src/main/java/net/sf/joafip/PersistanceTestsNoLongTests.java
===================================================================
--- trunk/joafip-testsuite/src/main/java/net/sf/joafip/PersistanceTestsNoLongTests.java 2011-11-13 06:40:17 UTC (rev 2969)
+++ trunk/joafip-testsuite/src/main/java/net/sf/joafip/PersistanceTestsNoLongTests.java 2011-11-18 02:52:27 UTC (rev 2970)
@@ -27,6 +27,7 @@
import net.sf.joafip.redblacktree.RedBlackTreeTests;
import net.sf.joafip.service.ServiceTests;
import net.sf.joafip.store.StoreTests;
+import net.sf.joafip.util.UtilTests;
@NotStorableClass
public class PersistanceTestsNoLongTests {// NOPMD
@@ -39,6 +40,7 @@
final TestSuite suite = new TestSuite(
"main (speed) Tests for persistence");
// $JUnit-BEGIN$
+ suite.addTest(UtilTests.suite());
suite.addTest(MemInspectorTests.suite());
suite.addTest(OGraphTests.suite());
suite.addTest(RedBlackTreeTests.suite());
Added: trunk/joafip-testsuite/src/main/java/net/sf/joafip/util/UtilTests.java
===================================================================
--- trunk/joafip-testsuite/src/main/java/net/sf/joafip/util/UtilTests.java (rev 0)
+++ trunk/joafip-testsuite/src/main/java/net/sf/joafip/util/UtilTests.java 2011-11-18 02:52:27 UTC (rev 2970)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2011 Luc Peuvrier
+ *
+ * This file is a part of JOAFIP.
+ *
+ * JOAFIP is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License.
+ *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE
+ * Licensed under the LGPL License, Version 3, 29 June 2007 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * JOAFIP is distributed in the hope that it will be useful, but
+ * unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.joafip.util;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import net.sf.joafip.NotStorableClass;
+
+/**
+ *
+ * @author luc peuvrier
+ *
+ */
+@NotStorableClass
+public class UtilTests {
+
+ public static Test suite() {
+ final TestSuite suite = new TestSuite("util Tests");
+ // $JUnit-BEGIN$
+ suite.addTestSuite(TestXmlWriter.class);
+ // suite.addTest(xxxx.suite());
+ // $JUnit-END$
+ return suite;
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|