OSDN Git Service

move test case to new opcode extraction library
authortama3 <tama3@acee48c3-7b26-0410-bdac-b3d0e5314bbc>
Mon, 26 Apr 2010 10:19:44 +0000 (10:19 +0000)
committertama3 <tama3@acee48c3-7b26-0410-bdac-b3d0e5314bbc>
Mon, 26 Apr 2010 10:19:44 +0000 (10:19 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/stigmata/plugins/trunk@388 acee48c3-7b26-0410-bdac-b3d0e5314bbc

wsp/pom.xml
wsp/src/main/java/jp/sourceforge/stigmata/birthmarks/wsp/CurrentDepth.java
wsp/src/main/java/jp/sourceforge/stigmata/birthmarks/wsp/OpcodeWeightCalculatePreprocessor.java
wsp/src/main/java/jp/sourceforge/stigmata/birthmarks/wsp/StackPatternBasedBirthmarkElement.java
wsp/src/main/java/jp/sourceforge/stigmata/birthmarks/wsp/StackPatternBasedBirthmarkExtractor.java
wsp/src/site/resources/images/logos/stigmata_plugins.png
wsp/src/site/site.xml
wsp/src/test/java/jp/sourceforge/stigmata/birthmarks/wsp/CurrentDepthTest.java
wsp/src/test/java/jp/sourceforge/stigmata/birthmarks/wsp/StackPatternBasedBirthmarkElementTest.java

index d5f6d86..72ce525 100644 (file)
@@ -8,7 +8,7 @@
   <modelVersion>4.0.0</modelVersion>\r
   <groupId>jp.sourceforge.stigmata.plugins</groupId>\r
   <artifactId>wsp</artifactId>\r
   <modelVersion>4.0.0</modelVersion>\r
   <groupId>jp.sourceforge.stigmata.plugins</groupId>\r
   <artifactId>wsp</artifactId>\r
-  <name>wsp</name>\r
+  <name>Weighted Stack Pattern Birthmark</name>\r
   <version>1.0.1-SNAPSHOT</version>\r
   <url>http://stigmata.sourceforge.jp/plugins/wsp/</url>\r
 \r
   <version>1.0.1-SNAPSHOT</version>\r
   <url>http://stigmata.sourceforge.jp/plugins/wsp/</url>\r
 \r
index b635a2b..a3ac359 100644 (file)
@@ -4,8 +4,10 @@ package jp.sourceforge.stigmata.birthmarks.wsp;
  * $Id$
  */
 
  * $Id$
  */
 
+import jp.sourceforge.stigmata.plugins.Opcode;
+
 /**
 /**
- * 
+ *
  * @author Haruaki Tamada
  * @version $Revision$
  */
  * @author Haruaki Tamada
  * @version $Revision$
  */
index e8de6e6..7791ea8 100644 (file)
@@ -17,6 +17,8 @@ import jp.sourceforge.stigmata.BirthmarkContext;
 import jp.sourceforge.stigmata.birthmarks.AbstractBirthmarkPreprocessor;
 import jp.sourceforge.stigmata.digger.ClassFileArchive;
 import jp.sourceforge.stigmata.digger.ClassFileEntry;
 import jp.sourceforge.stigmata.birthmarks.AbstractBirthmarkPreprocessor;
 import jp.sourceforge.stigmata.digger.ClassFileArchive;
 import jp.sourceforge.stigmata.digger.ClassFileEntry;
+import jp.sourceforge.stigmata.plugins.Opcode;
+import jp.sourceforge.stigmata.plugins.OpcodeExtractMethodVisitor;
 import jp.sourceforge.stigmata.spi.BirthmarkSpi;
 
 import org.objectweb.asm.ClassAdapter;
 import jp.sourceforge.stigmata.spi.BirthmarkSpi;
 
 import org.objectweb.asm.ClassAdapter;
@@ -25,7 +27,7 @@ import org.objectweb.asm.ClassWriter;
 import org.objectweb.asm.MethodVisitor;
 
 /**
 import org.objectweb.asm.MethodVisitor;
 
 /**
- * 
+ *
  * @author Haruaki Tamada
  * @version $Revision$
  */
  * @author Haruaki Tamada
  * @version $Revision$
  */
@@ -71,8 +73,8 @@ public class OpcodeWeightCalculatePreprocessor extends AbstractBirthmarkPreproce
                 ClassAdapter opcodeExtractVisitor = new ClassAdapter(writer){
                     @Override
                     public MethodVisitor visitMethod(int arg0, String arg1, String arg2, String arg3, String[] arg4){
                 ClassAdapter opcodeExtractVisitor = new ClassAdapter(writer){
                     @Override
                     public MethodVisitor visitMethod(int arg0, String arg1, String arg2, String arg3, String[] arg4){
-                        OpcodeExtractionMethodVisitor visitor =
-                            new OpcodeExtractionMethodVisitor(super.visitMethod(arg0, arg1, arg2, arg3, arg4), opcodes);
+                        OpcodeExtractMethodVisitor visitor =
+                            new OpcodeExtractMethodVisitor(super.visitMethod(arg0, arg1, arg2, arg3, arg4), opcodes);
                         return visitor;
                     }
                 };
                         return visitor;
                     }
                 };
index d055b08..4be7002 100644 (file)
@@ -10,11 +10,13 @@ import java.util.Iterator;
 import java.util.List;
 
 import jp.sourceforge.stigmata.BirthmarkElement;
 import java.util.List;
 
 import jp.sourceforge.stigmata.BirthmarkElement;
+import jp.sourceforge.stigmata.plugins.Opcode;
+import jp.sourceforge.stigmata.plugins.OpcodeManager;
 
 /**
 
 /**
- * 
+ *
  * @author Haruaki TAMADA
  * @author Haruaki TAMADA
- * @version $Revision$ 
+ * @version $Revision$
  */
 public class StackPatternBasedBirthmarkElement extends BirthmarkElement implements Iterable<CurrentDepth>{
     private static final long serialVersionUID = 7965456413167854L;
  */
 public class StackPatternBasedBirthmarkElement extends BirthmarkElement implements Iterable<CurrentDepth>{
     private static final long serialVersionUID = 7965456413167854L;
index 330c938..fd722fc 100644 (file)
@@ -16,6 +16,9 @@ import jp.sourceforge.stigmata.BirthmarkElement;
 import jp.sourceforge.stigmata.ExtractionUnit;
 import jp.sourceforge.stigmata.birthmarks.ASMBirthmarkExtractor;
 import jp.sourceforge.stigmata.birthmarks.BirthmarkExtractVisitor;
 import jp.sourceforge.stigmata.ExtractionUnit;
 import jp.sourceforge.stigmata.birthmarks.ASMBirthmarkExtractor;
 import jp.sourceforge.stigmata.birthmarks.BirthmarkExtractVisitor;
+import jp.sourceforge.stigmata.plugins.LabelOpcode;
+import jp.sourceforge.stigmata.plugins.Opcode;
+import jp.sourceforge.stigmata.plugins.OpcodeExtractMethodVisitor;
 import jp.sourceforge.stigmata.spi.BirthmarkSpi;
 
 import org.objectweb.asm.ClassVisitor;
 import jp.sourceforge.stigmata.spi.BirthmarkSpi;
 
 import org.objectweb.asm.ClassVisitor;
@@ -24,7 +27,7 @@ import org.objectweb.asm.Label;
 import org.objectweb.asm.MethodVisitor;
 
 /**
 import org.objectweb.asm.MethodVisitor;
 
 /**
- * 
+ *
  * @author Haruaki Tamada
  * @version $Revision$
  */
  * @author Haruaki Tamada
  * @version $Revision$
  */
@@ -61,9 +64,9 @@ public class StackPatternBasedBirthmarkExtractor extends ASMBirthmarkExtractor{
 
         return elements.toArray(new BirthmarkElement[elements.size()]);
     }
 
         return elements.toArray(new BirthmarkElement[elements.size()]);
     }
-    
+
     @SuppressWarnings("unchecked")
     @SuppressWarnings("unchecked")
-    private List<CurrentDepth> buildStackPattern(List<Opcode> opcodes, BirthmarkContext context){ 
+    private List<CurrentDepth> buildStackPattern(List<Opcode> opcodes, BirthmarkContext context){
         Map<Label, Integer> tableMap = new HashMap<Label, Integer>();
         List<CurrentDepth> pattern = new ArrayList<CurrentDepth>();
         Map<Integer, Integer> weights = (Map<Integer, Integer>)context.getProperty("birthmarks.wsp.weights");
         Map<Label, Integer> tableMap = new HashMap<Label, Integer>();
         List<CurrentDepth> pattern = new ArrayList<CurrentDepth>();
         Map<Integer, Integer> weights = (Map<Integer, Integer>)context.getProperty("birthmarks.wsp.weights");
@@ -80,7 +83,7 @@ public class StackPatternBasedBirthmarkExtractor extends ASMBirthmarkExtractor{
                     currentDepth += opcode.getAct();
                 }
                 else{
                     currentDepth += opcode.getAct();
                 }
                 else{
-                    currentDepth = forwardedStatus + opcode.getAct(); 
+                    currentDepth = forwardedStatus + opcode.getAct();
                 }
                 forwardedStatus = null;
 
                 }
                 forwardedStatus = null;
 
@@ -113,7 +116,7 @@ public class StackPatternBasedBirthmarkExtractor extends ASMBirthmarkExtractor{
         @Override
         public MethodVisitor visitMethod(int arg0, String arg1, String arg2, String arg3, String[] arg4){
             MethodVisitor visitor = super.visitMethod(arg0, arg1, arg2, arg3, arg4);
         @Override
         public MethodVisitor visitMethod(int arg0, String arg1, String arg2, String arg3, String[] arg4){
             MethodVisitor visitor = super.visitMethod(arg0, arg1, arg2, arg3, arg4);
-            OpcodeExtractionMethodVisitor opcodeVisitor = new OpcodeExtractionMethodVisitor(visitor, opcodeList);
+            OpcodeExtractMethodVisitor opcodeVisitor = new OpcodeExtractMethodVisitor(visitor, opcodeList);
 
             return opcodeVisitor;
         }
 
             return opcodeVisitor;
         }
index ddc59f9..60bedc4 100644 (file)
Binary files a/wsp/src/site/resources/images/logos/stigmata_plugins.png and b/wsp/src/site/resources/images/logos/stigmata_plugins.png differ
index 1d9e2d9..11685c7 100644 (file)
@@ -8,7 +8,9 @@
 \r
   <body>\r
     <menu name="WSP" inherit="top">\r
 \r
   <body>\r
     <menu name="WSP" inherit="top">\r
-      <item name="Introduction"        href="index.html"/>\r
+      <item name="Introduction"   href="wsp/index.html"/>\r
+      <item name="How to install" href="install.html" />\r
+      <item name="Download"       href="download.html"/>\r
     </menu>\r
 \r
     <menu ref="reports"/>\r
     </menu>\r
 \r
     <menu ref="reports"/>\r
index 9f813c6..ec60f36 100644 (file)
@@ -4,12 +4,14 @@ package jp.sourceforge.stigmata.birthmarks.wsp;
  * $Id$
  */
 
  * $Id$
  */
 
+import jp.sourceforge.stigmata.plugins.Opcode;
+
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
 /**
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
 /**
- * 
+ *
  * @author Haruaki Tamada
  * @version $Revision$
  */
  * @author Haruaki Tamada
  * @version $Revision$
  */
index 32b814b..b63ee6d 100644 (file)
@@ -4,12 +4,14 @@ package jp.sourceforge.stigmata.birthmarks.wsp;
  * $Id$
  */
 
  * $Id$
  */
 
+import jp.sourceforge.stigmata.plugins.Opcode;
+
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
 /**
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
 /**
- * 
+ *
  * @author Haruaki Tamada
  * @version $Revision$
  */
  * @author Haruaki Tamada
  * @version $Revision$
  */