├── .gitignore ├── README.md ├── SDTEST ├── .classpath ├── .project ├── .settings │ └── gradle │ │ ├── org.springsource.ide.eclipse.gradle.core.import.prefs │ │ ├── org.springsource.ide.eclipse.gradle.core.prefs │ │ └── org.springsource.ide.eclipse.gradle.refresh.prefs ├── build.gradle ├── doc │ ├── test │ ├── test.AnnotationTest.captionTest.tex │ ├── test.AnnotationTest.labelTest.tex │ ├── test.AnnotationTest.noAnnotationsTest.tex │ ├── test.DiagramStructureTest.forBeanOperation.tex │ ├── test.DiagramStructureTest.longBeanOperation.tex │ ├── test.DiagramStructureTest.recursiveBeanOperation.tex │ ├── test.DiagramStructureTest.simpleStructureTest.log │ ├── test.DiagramStructureTest.simpleStructureTest.tex │ ├── test.aux │ ├── test.log │ ├── test.pdf │ └── test.tex └── src │ ├── main │ └── java │ │ └── test │ │ ├── AbstractSuperClass.java │ │ ├── Bean.java │ │ ├── Controller.java │ │ ├── Model.java │ │ ├── Persistor.java │ │ └── RealSubClass.java │ └── test │ └── java │ └── test │ ├── AnnotationTest.java │ └── DiagramStructureTest.java ├── build.gradle ├── example.png └── src ├── main └── java │ └── sk │ └── anivit │ └── stacktracegen │ ├── InjectorTranslator.java │ ├── SDGeneratorMain.java │ ├── SDInjector.java │ ├── annotations │ ├── Caption.java │ ├── FileName.java │ ├── Label.java │ ├── OutputDirectory.java │ └── SequenceDiagram.java │ ├── finder │ ├── ClassFinder.java │ └── Visitor.java │ ├── recording │ ├── CalledMethod.java │ ├── DiagramBean.java │ └── DiagramRecorder.java │ ├── test │ └── T.java │ └── writer │ ├── LatexWriter.java │ └── WriterI.java └── test └── java └── sk └── anivit └── stacktracegen ├── recording ├── DiagramRecorderTest.java └── Test.java └── writer └── LatexWriterTest.java /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | build/ 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | java-sequence-diagram-generator 2 | =============================== 3 | Simple latex sequence diagram generator. This project uses annotated junit tests to generate latex sequence diagrams. 4 | 5 | SDTEST/doc/test.pdf contains some rendered examples 6 | First compile the root project, then you can run gradle diagram or gradle latex in the SDTEST folder 7 | 8 | Example output : 9 | ![alt tag](https://github.com/sherif181/java-sequence-diagram-generator/raw/master/example.png) 10 | 11 | Hello World : 12 | 13 | @Test 14 | @SequenceDiagram({ Controller.class, Model.class }) 15 | public void testMethod() { 16 | Controller c = new Controller(new Model()); 17 | c.init(); 18 | c.simpleBeanOperation(); 19 | } 20 | 21 | 22 | SDTEST contains also other examples 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SDTEST/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /SDTEST/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | SDTEST 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.springsource.ide.eclipse.gradle.core.nature 16 | org.eclipse.jdt.core.javanature 17 | 18 | 19 | -------------------------------------------------------------------------------- /SDTEST/.settings/gradle/org.springsource.ide.eclipse.gradle.core.import.prefs: -------------------------------------------------------------------------------- 1 | #org.springsource.ide.eclipse.gradle.core.preferences.GradleImportPreferences 2 | #Tue Apr 29 13:24:18 CEST 2014 3 | addResourceFilters=true 4 | afterTasks=afterEclipseImport; 5 | beforeTasks=cleanEclipse;eclipse; 6 | enableAfterTasks=true 7 | enableBeforeTasks=true 8 | enableDSLD=false 9 | enableDependendencyManagement=true 10 | projects=; 11 | -------------------------------------------------------------------------------- /SDTEST/.settings/gradle/org.springsource.ide.eclipse.gradle.core.prefs: -------------------------------------------------------------------------------- 1 | #org.springsource.ide.eclipse.gradle.core.preferences.GradleProjectPreferences 2 | #Tue Apr 29 13:24:19 CEST 2014 3 | org.springsource.ide.eclipse.gradle.linkedresources= 4 | org.springsource.ide.eclipse.gradle.rootprojectloc= 5 | -------------------------------------------------------------------------------- /SDTEST/.settings/gradle/org.springsource.ide.eclipse.gradle.refresh.prefs: -------------------------------------------------------------------------------- 1 | #org.springsource.ide.eclipse.gradle.core.actions.GradleRefreshPreferences 2 | #Tue Apr 29 13:24:19 CEST 2014 3 | addResourceFilters=true 4 | afterTasks=afterEclipseImport; 5 | beforeTasks=cleanEclipse;eclipse; 6 | enableAfterTasks=true 7 | enableBeforeTasks=true 8 | enableDSLD=false 9 | useHierarchicalNames=false 10 | -------------------------------------------------------------------------------- /SDTEST/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java' 2 | version = '1.0' 3 | 4 | 5 | repositories { 6 | mavenCentral() 7 | maven { 8 | url "http://repo1.maven.org/maven2/" 9 | } 10 | } 11 | 12 | 13 | dependencies { 14 | testCompile "org.javassist:javassist:3.18.1-GA" 15 | testCompile "org.reflections:reflections:0.9.10" 16 | testCompile "junit:junit:4.12" 17 | testCompile files('../build/libs/java-sequence-diagram-generator-1.0.jar') 18 | } 19 | 20 | 21 | task diagram(type: JavaExec) { 22 | main = "sk.anivit.stacktracegen.SDGeneratorMain" 23 | classpath = sourceSets.test.runtimeClasspath 24 | 25 | } 26 | 27 | task latex(type:Exec, dependsOn: diagram) { 28 | workingDir "doc" 29 | commandLine '/usr/bin/pdflatex' 30 | args "test.tex" 31 | } 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /SDTEST/doc/test: -------------------------------------------------------------------------------- 1 | \begin{figure} 2 | \begin{center} 3 | \begin{sequencediagram} 4 | \newthread{testAnnotationTest}{AnnotationTest} 5 | \newinst{testController}{Controller} 6 | \newinst{testModel}{Model} 7 | \begin{call}{testAnnotationTest}{init}{testController}{void 0ms} 8 | \begin{call}{testController}{newInstance}{testBean}{Bean 0ms} 9 | \end{call} 10 | \begin{call}{testController}{setBean}{testModel}{void 0ms} 11 | \end{call} 12 | \begin{call}{testController}{persist}{testModel}{boolean 0ms} 13 | \begin{call}{testModel}{persist}{testPersistor}{void 0ms} 14 | \end{call} 15 | \end{call} 16 | \end{call} 17 | \begin{call}{testAnnotationTest}{simpleBeanOperation}{testController}{void 0ms} 18 | \begin{call}{testController}{getBean}{testModel}{Bean 0ms} 19 | \end{call} 20 | \begin{call}{testController}{simpleBeanOperation}{testBean}{void 0ms} 21 | \end{call} 22 | \begin{call}{testController}{setBean}{testModel}{void 0ms} 23 | \end{call} 24 | \begin{call}{testController}{persist}{testModel}{boolean 0ms} 25 | \begin{call}{testModel}{persist}{testPersistor}{void 0ms} 26 | \end{call} 27 | \end{call} 28 | \end{call} 29 | \end{sequencediagram} 30 | \caption{test.AnnotationTest fileNameTest} 31 | \label{test.AnnotationTest.fileNameTest} 32 | \end{center} 33 | \end{figure} 34 | -------------------------------------------------------------------------------- /SDTEST/doc/test.AnnotationTest.captionTest.tex: -------------------------------------------------------------------------------- 1 | \begin{figure} 2 | \begin{center} 3 | \begin{sequencediagram} 4 | \newthread{testAnnotationTest}{AnnotationTest} 5 | \newinst{testController}{Controller} 6 | \newinst{testModel}{Model} 7 | \begin{call}{testAnnotationTest}{init}{testController}{void 0ms} 8 | \begin{call}{testController}{newInstance}{testBean}{Bean 0ms} 9 | \end{call} 10 | \begin{call}{testController}{setBean}{testModel}{void 0ms} 11 | \end{call} 12 | \begin{call}{testController}{persist}{testModel}{boolean 0ms} 13 | \begin{call}{testModel}{persist}{testPersistor}{void 0ms} 14 | \end{call} 15 | \end{call} 16 | \end{call} 17 | \begin{call}{testAnnotationTest}{simpleBeanOperation}{testController}{void 0ms} 18 | \begin{call}{testController}{getBean}{testModel}{Bean 0ms} 19 | \end{call} 20 | \begin{call}{testController}{simpleBeanOperation}{testBean}{void 0ms} 21 | \end{call} 22 | \begin{call}{testController}{setBean}{testModel}{void 0ms} 23 | \end{call} 24 | \begin{call}{testController}{persist}{testModel}{boolean 0ms} 25 | \begin{call}{testModel}{persist}{testPersistor}{void 0ms} 26 | \end{call} 27 | \end{call} 28 | \end{call} 29 | \end{sequencediagram} 30 | \caption{CAPTION} 31 | \label{test.AnnotationTest.captionTest} 32 | \end{center} 33 | \end{figure} 34 | -------------------------------------------------------------------------------- /SDTEST/doc/test.AnnotationTest.labelTest.tex: -------------------------------------------------------------------------------- 1 | \begin{figure} 2 | \begin{center} 3 | \begin{sequencediagram} 4 | \newthread{testAnnotationTest}{AnnotationTest} 5 | \newinst{testController}{Controller} 6 | \newinst{testModel}{Model} 7 | \begin{call}{testAnnotationTest}{init}{testController}{void 0ms} 8 | \begin{call}{testController}{newInstance}{testBean}{Bean 0ms} 9 | \end{call} 10 | \begin{call}{testController}{setBean}{testModel}{void 0ms} 11 | \end{call} 12 | \begin{call}{testController}{persist}{testModel}{boolean 0ms} 13 | \begin{call}{testModel}{persist}{testPersistor}{void 0ms} 14 | \end{call} 15 | \end{call} 16 | \end{call} 17 | \begin{call}{testAnnotationTest}{simpleBeanOperation}{testController}{void 0ms} 18 | \begin{call}{testController}{getBean}{testModel}{Bean 0ms} 19 | \end{call} 20 | \begin{call}{testController}{simpleBeanOperation}{testBean}{void 0ms} 21 | \end{call} 22 | \begin{call}{testController}{setBean}{testModel}{void 0ms} 23 | \end{call} 24 | \begin{call}{testController}{persist}{testModel}{boolean 0ms} 25 | \begin{call}{testModel}{persist}{testPersistor}{void 0ms} 26 | \end{call} 27 | \end{call} 28 | \end{call} 29 | \end{sequencediagram} 30 | \caption{test.AnnotationTest labelTest} 31 | \label{LABEL} 32 | \end{center} 33 | \end{figure} 34 | -------------------------------------------------------------------------------- /SDTEST/doc/test.AnnotationTest.noAnnotationsTest.tex: -------------------------------------------------------------------------------- 1 | \begin{figure} 2 | \begin{center} 3 | \begin{sequencediagram} 4 | \newthread{testAnnotationTest}{AnnotationTest} 5 | \newinst{testController}{Controller} 6 | \newinst{testModel}{Model} 7 | \begin{call}{testAnnotationTest}{init}{testController}{void 0ms} 8 | \begin{call}{testController}{newInstance}{testBean}{Bean 0ms} 9 | \end{call} 10 | \begin{call}{testController}{setBean}{testModel}{void 0ms} 11 | \end{call} 12 | \begin{call}{testController}{persist}{testModel}{boolean 0ms} 13 | \begin{call}{testModel}{persist}{testPersistor}{void 0ms} 14 | \end{call} 15 | \end{call} 16 | \end{call} 17 | \begin{call}{testAnnotationTest}{simpleBeanOperation}{testController}{void 1ms} 18 | \begin{call}{testController}{getBean}{testModel}{Bean 0ms} 19 | \end{call} 20 | \begin{call}{testController}{simpleBeanOperation}{testBean}{void 0ms} 21 | \end{call} 22 | \begin{call}{testController}{setBean}{testModel}{void 0ms} 23 | \end{call} 24 | \begin{call}{testController}{persist}{testModel}{boolean 0ms} 25 | \begin{call}{testModel}{persist}{testPersistor}{void 0ms} 26 | \end{call} 27 | \end{call} 28 | \end{call} 29 | \end{sequencediagram} 30 | \caption{test.AnnotationTest noAnnotationsTest} 31 | \label{test.AnnotationTest.noAnnotationsTest} 32 | \end{center} 33 | \end{figure} 34 | -------------------------------------------------------------------------------- /SDTEST/doc/test.DiagramStructureTest.forBeanOperation.tex: -------------------------------------------------------------------------------- 1 | \begin{figure} 2 | \begin{center} 3 | \begin{sequencediagram} 4 | \newthread{testDiagramStructureTest}{DiagramStructureTest} 5 | \newinst{testController}{Controller} 6 | \newinst{testModel}{Model} 7 | \newinst{testBean}{Bean} 8 | \newinst{testPersistor}{Persistor} 9 | \begin{call}{testDiagramStructureTest}{init}{testController}{void 0ms} 10 | \begin{call}{testController}{newInstance}{testBean}{Bean 0ms} 11 | \end{call} 12 | \begin{call}{testController}{setBean}{testModel}{void 0ms} 13 | \end{call} 14 | \begin{call}{testController}{persist}{testModel}{boolean 0ms} 15 | \begin{call}{testModel}{persist}{testPersistor}{void 0ms} 16 | \end{call} 17 | \end{call} 18 | \end{call} 19 | \begin{call}{testDiagramStructureTest}{forBeanOperation}{testController}{void 0ms} 20 | \begin{call}{testController}{getBean}{testModel}{Bean 0ms} 21 | \end{call} 22 | \begin{call}{testController}{forBeanOperation}{testBean}{void 0ms} 23 | \begin{sdblock}{Loop/multiple}{} 24 | \begin{call}{testBean}{simpleBeanOperation}{testBean}{void 0ms} 25 | \end{call} 26 | \end{sdblock} 27 | \end{call} 28 | \begin{call}{testController}{setBean}{testModel}{void 0ms} 29 | \end{call} 30 | \end{call} 31 | \end{sequencediagram} 32 | \caption{test.DiagramStructureTest forBeanOperation} 33 | \label{test.DiagramStructureTest.forBeanOperation} 34 | \end{center} 35 | \end{figure} 36 | -------------------------------------------------------------------------------- /SDTEST/doc/test.DiagramStructureTest.longBeanOperation.tex: -------------------------------------------------------------------------------- 1 | \begin{figure} 2 | \begin{center} 3 | \begin{sequencediagram} 4 | \newthread{testDiagramStructureTest}{DiagramStructureTest} 5 | \newinst{testController}{Controller} 6 | \newinst{testModel}{Model} 7 | \newinst{testBean}{Bean} 8 | \newinst{testPersistor}{Persistor} 9 | \begin{call}{testDiagramStructureTest}{init}{testController}{void 0ms} 10 | \begin{call}{testController}{newInstance}{testBean}{Bean 0ms} 11 | \end{call} 12 | \begin{call}{testController}{setBean}{testModel}{void 0ms} 13 | \end{call} 14 | \begin{call}{testController}{persist}{testModel}{boolean 0ms} 15 | \begin{call}{testModel}{persist}{testPersistor}{void 0ms} 16 | \end{call} 17 | \end{call} 18 | \end{call} 19 | \begin{call}{testDiagramStructureTest}{longBeanOperation}{testController}{void 1.02s} 20 | \begin{call}{testController}{getBean}{testModel}{Bean 0ms} 21 | \end{call} 22 | \begin{call}{testController}{longBeanOperation}{testBean}{void 1.02s} 23 | \begin{call}{testBean}{simpleBeanOperation}{testBean}{void 0ms} 24 | \end{call} 25 | \end{call} 26 | \begin{call}{testController}{setBean}{testModel}{void 0ms} 27 | \end{call} 28 | \begin{call}{testController}{persist}{testModel}{boolean 0ms} 29 | \begin{call}{testModel}{persist}{testPersistor}{void 0ms} 30 | \end{call} 31 | \end{call} 32 | \end{call} 33 | \end{sequencediagram} 34 | \caption{test.DiagramStructureTest longBeanOperation} 35 | \label{test.DiagramStructureTest.longBeanOperation} 36 | \end{center} 37 | \end{figure} 38 | -------------------------------------------------------------------------------- /SDTEST/doc/test.DiagramStructureTest.recursiveBeanOperation.tex: -------------------------------------------------------------------------------- 1 | \begin{figure} 2 | \begin{center} 3 | \begin{sequencediagram} 4 | \newthread{testDiagramStructureTest}{DiagramStructureTest} 5 | \newinst{testController}{Controller} 6 | \newinst{testModel}{Model} 7 | \newinst{testBean}{Bean} 8 | \newinst{testPersistor}{Persistor} 9 | \begin{call}{testDiagramStructureTest}{init}{testController}{void 2ms} 10 | \begin{call}{testController}{newInstance}{testBean}{Bean 0ms} 11 | \end{call} 12 | \begin{call}{testController}{setBean}{testModel}{void 0ms} 13 | \end{call} 14 | \begin{call}{testController}{persist}{testModel}{boolean 1ms} 15 | \begin{call}{testModel}{persist}{testPersistor}{void 0ms} 16 | \end{call} 17 | \end{call} 18 | \end{call} 19 | \begin{call}{testDiagramStructureTest}{recursiveBeanOperation}{testController}{void 0ms} 20 | \begin{call}{testController}{getBean}{testModel}{Bean 0ms} 21 | \end{call} 22 | \begin{call}{testController}{recursiveBeanOperation}{testBean}{void 0ms} 23 | \begin{call}{testBean}{recurse}{testBean}{void 0ms} 24 | \begin{call}{testBean}{recurse}{testBean}{void 0ms} 25 | \begin{call}{testBean}{recurse}{testBean}{void 0ms} 26 | \begin{call}{testBean}{recurse}{testBean}{void 0ms} 27 | \begin{call}{testBean}{recurse}{testBean}{void 0ms} 28 | \begin{call}{testBean}{recurse}{testBean}{void 0ms} 29 | \end{call} 30 | \end{call} 31 | \end{call} 32 | \end{call} 33 | \end{call} 34 | \end{call} 35 | \end{call} 36 | \begin{call}{testController}{setBean}{testModel}{void 0ms} 37 | \end{call} 38 | \begin{call}{testController}{persist}{testModel}{boolean 0ms} 39 | \begin{call}{testModel}{persist}{testPersistor}{void 0ms} 40 | \end{call} 41 | \end{call} 42 | \end{call} 43 | \end{sequencediagram} 44 | \caption{test.DiagramStructureTest recursiveBeanOperation} 45 | \label{test.DiagramStructureTest.recursiveBeanOperation} 46 | \end{center} 47 | \end{figure} 48 | -------------------------------------------------------------------------------- /SDTEST/doc/test.DiagramStructureTest.simpleStructureTest.log: -------------------------------------------------------------------------------- 1 | This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian) (format=pdflatex 2014.4.11) 29 APR 2014 19:05 2 | entering extended mode 3 | restricted \write18 enabled. 4 | %&-line parsing enabled. 5 | **test.DiagramStructureTest.simpleStructureTest.tex 6 | (./test.DiagramStructureTest.simpleStructureTest.tex 7 | LaTeX2e <2011/06/27> 8 | Babel <3.9k> and hyphenation patterns for 4 languages loaded. 9 | 10 | ! LaTeX Error: Environment figure undefined. 11 | 12 | See the LaTeX manual or LaTeX Companion for explanation. 13 | Type H for immediate help. 14 | ... 15 | 16 | l.1 \begin{figure} 17 | 18 | Your command was ignored. 19 | Type I to replace it with another command, 20 | or to continue without it. 21 | 22 | 23 | ! LaTeX Error: Missing \begin{document}. 24 | 25 | See the LaTeX manual or LaTeX Companion for explanation. 26 | Type H for immediate help. 27 | ... 28 | 29 | l.2 \begin{center} 30 | 31 | You're in trouble here. Try typing to proceed. 32 | If that doesn't work, type X to quit. 33 | 34 | 35 | Overfull \hbox (20.0pt too wide) in paragraph at lines 2--2 36 | [] 37 | [] 38 | 39 | 40 | ! LaTeX Error: Environment sequencediagram undefined. 41 | 42 | See the LaTeX manual or LaTeX Companion for explanation. 43 | Type H for immediate help. 44 | ... 45 | 46 | l.3 \begin{sequencediagram} 47 | 48 | Your command was ignored. 49 | Type I to replace it with another command, 50 | or to continue without it. 51 | 52 | ! Undefined control sequence. 53 | l.4 \newinst 54 | {testDiagramStructureTest}{DiagramStructureTest} 55 | The control sequence at the end of the top line 56 | of your error message was never \def'ed. If you have 57 | misspelled it (e.g., `\hobx'), type `I' and the correct 58 | spelling (e.g., `I\hbox'). Otherwise just continue, 59 | and I'll forget about whatever was undefined. 60 | 61 | Missing character: There is no t in font nullfont! 62 | Missing character: There is no e in font nullfont! 63 | Missing character: There is no s in font nullfont! 64 | Missing character: There is no t in font nullfont! 65 | Missing character: There is no D in font nullfont! 66 | Missing character: There is no i in font nullfont! 67 | Missing character: There is no a in font nullfont! 68 | Missing character: There is no g in font nullfont! 69 | Missing character: There is no r in font nullfont! 70 | Missing character: There is no a in font nullfont! 71 | Missing character: There is no m in font nullfont! 72 | Missing character: There is no S in font nullfont! 73 | Missing character: There is no t in font nullfont! 74 | Missing character: There is no r in font nullfont! 75 | Missing character: There is no u in font nullfont! 76 | Missing character: There is no c in font nullfont! 77 | Missing character: There is no t in font nullfont! 78 | Missing character: There is no u in font nullfont! 79 | Missing character: There is no r in font nullfont! 80 | Missing character: There is no e in font nullfont! 81 | Missing character: There is no T in font nullfont! 82 | Missing character: There is no e in font nullfont! 83 | Missing character: There is no s in font nullfont! 84 | Missing character: There is no t in font nullfont! 85 | Missing character: There is no D in font nullfont! 86 | Missing character: There is no i in font nullfont! 87 | Missing character: There is no a in font nullfont! 88 | Missing character: There is no g in font nullfont! 89 | Missing character: There is no r in font nullfont! 90 | Missing character: There is no a in font nullfont! 91 | Missing character: There is no m in font nullfont! 92 | Missing character: There is no S in font nullfont! 93 | Missing character: There is no t in font nullfont! 94 | Missing character: There is no r in font nullfont! 95 | Missing character: There is no u in font nullfont! 96 | Missing character: There is no c in font nullfont! 97 | Missing character: There is no t in font nullfont! 98 | Missing character: There is no u in font nullfont! 99 | Missing character: There is no r in font nullfont! 100 | Missing character: There is no e in font nullfont! 101 | Missing character: There is no T in font nullfont! 102 | Missing character: There is no e in font nullfont! 103 | Missing character: There is no s in font nullfont! 104 | Missing character: There is no t in font nullfont! 105 | ! Undefined control sequence. 106 | l.5 \newinst 107 | {testController}{Controller} 108 | The control sequence at the end of the top line 109 | of your error message was never \def'ed. If you have 110 | misspelled it (e.g., `\hobx'), type `I' and the correct 111 | spelling (e.g., `I\hbox'). Otherwise just continue, 112 | and I'll forget about whatever was undefined. 113 | 114 | Missing character: There is no t in font nullfont! 115 | Missing character: There is no e in font nullfont! 116 | Missing character: There is no s in font nullfont! 117 | Missing character: There is no t in font nullfont! 118 | Missing character: There is no C in font nullfont! 119 | Missing character: There is no o in font nullfont! 120 | Missing character: There is no n in font nullfont! 121 | Missing character: There is no t in font nullfont! 122 | Missing character: There is no r in font nullfont! 123 | Missing character: There is no o in font nullfont! 124 | Missing character: There is no l in font nullfont! 125 | Missing character: There is no l in font nullfont! 126 | Missing character: There is no e in font nullfont! 127 | Missing character: There is no r in font nullfont! 128 | Missing character: There is no C in font nullfont! 129 | Missing character: There is no o in font nullfont! 130 | Missing character: There is no n in font nullfont! 131 | Missing character: There is no t in font nullfont! 132 | Missing character: There is no r in font nullfont! 133 | Missing character: There is no o in font nullfont! 134 | Missing character: There is no l in font nullfont! 135 | Missing character: There is no l in font nullfont! 136 | Missing character: There is no e in font nullfont! 137 | Missing character: There is no r in font nullfont! 138 | ! Undefined control sequence. 139 | l.6 \newinst 140 | {testModel}{Model} 141 | The control sequence at the end of the top line 142 | of your error message was never \def'ed. If you have 143 | misspelled it (e.g., `\hobx'), type `I' and the correct 144 | spelling (e.g., `I\hbox'). Otherwise just continue, 145 | and I'll forget about whatever was undefined. 146 | 147 | Missing character: There is no t in font nullfont! 148 | Missing character: There is no e in font nullfont! 149 | Missing character: There is no s in font nullfont! 150 | Missing character: There is no t in font nullfont! 151 | Missing character: There is no M in font nullfont! 152 | Missing character: There is no o in font nullfont! 153 | Missing character: There is no d in font nullfont! 154 | Missing character: There is no e in font nullfont! 155 | Missing character: There is no l in font nullfont! 156 | Missing character: There is no M in font nullfont! 157 | Missing character: There is no o in font nullfont! 158 | Missing character: There is no d in font nullfont! 159 | Missing character: There is no e in font nullfont! 160 | Missing character: There is no l in font nullfont! 161 | ! Undefined control sequence. 162 | l.7 \newinst 163 | {testBean}{Bean} 164 | The control sequence at the end of the top line 165 | of your error message was never \def'ed. If you have 166 | misspelled it (e.g., `\hobx'), type `I' and the correct 167 | spelling (e.g., `I\hbox'). Otherwise just continue, 168 | and I'll forget about whatever was undefined. 169 | 170 | Missing character: There is no t in font nullfont! 171 | Missing character: There is no e in font nullfont! 172 | Missing character: There is no s in font nullfont! 173 | Missing character: There is no t in font nullfont! 174 | Missing character: There is no B in font nullfont! 175 | Missing character: There is no e in font nullfont! 176 | Missing character: There is no a in font nullfont! 177 | Missing character: There is no n in font nullfont! 178 | Missing character: There is no B in font nullfont! 179 | Missing character: There is no e in font nullfont! 180 | Missing character: There is no a in font nullfont! 181 | Missing character: There is no n in font nullfont! 182 | ! Undefined control sequence. 183 | l.8 \newinst 184 | {testPersistor}{Persistor} 185 | The control sequence at the end of the top line 186 | of your error message was never \def'ed. If you have 187 | misspelled it (e.g., `\hobx'), type `I' and the correct 188 | spelling (e.g., `I\hbox'). Otherwise just continue, 189 | and I'll forget about whatever was undefined. 190 | 191 | Missing character: There is no t in font nullfont! 192 | Missing character: There is no e in font nullfont! 193 | Missing character: There is no s in font nullfont! 194 | Missing character: There is no t in font nullfont! 195 | Missing character: There is no P in font nullfont! 196 | Missing character: There is no e in font nullfont! 197 | Missing character: There is no r in font nullfont! 198 | Missing character: There is no s in font nullfont! 199 | Missing character: There is no i in font nullfont! 200 | Missing character: There is no s in font nullfont! 201 | Missing character: There is no t in font nullfont! 202 | Missing character: There is no o in font nullfont! 203 | Missing character: There is no r in font nullfont! 204 | Missing character: There is no P in font nullfont! 205 | Missing character: There is no e in font nullfont! 206 | Missing character: There is no r in font nullfont! 207 | Missing character: There is no s in font nullfont! 208 | Missing character: There is no i in font nullfont! 209 | Missing character: There is no s in font nullfont! 210 | Missing character: There is no t in font nullfont! 211 | Missing character: There is no o in font nullfont! 212 | Missing character: There is no r in font nullfont! 213 | 214 | ! LaTeX Error: Environment call undefined. 215 | 216 | See the LaTeX manual or LaTeX Companion for explanation. 217 | Type H for immediate help. 218 | ... 219 | 220 | l.9 \begin{call} 221 | {testDiagramStructureTest}{init}{testController}{void 0ms} 222 | Your command was ignored. 223 | Type I to replace it with another command, 224 | or to continue without it. 225 | 226 | Missing character: There is no t in font nullfont! 227 | Missing character: There is no e in font nullfont! 228 | Missing character: There is no s in font nullfont! 229 | Missing character: There is no t in font nullfont! 230 | Missing character: There is no D in font nullfont! 231 | Missing character: There is no i in font nullfont! 232 | Missing character: There is no a in font nullfont! 233 | Missing character: There is no g in font nullfont! 234 | Missing character: There is no r in font nullfont! 235 | Missing character: There is no a in font nullfont! 236 | Missing character: There is no m in font nullfont! 237 | Missing character: There is no S in font nullfont! 238 | Missing character: There is no t in font nullfont! 239 | Missing character: There is no r in font nullfont! 240 | Missing character: There is no u in font nullfont! 241 | Missing character: There is no c in font nullfont! 242 | Missing character: There is no t in font nullfont! 243 | Missing character: There is no u in font nullfont! 244 | Missing character: There is no r in font nullfont! 245 | Missing character: There is no e in font nullfont! 246 | Missing character: There is no T in font nullfont! 247 | Missing character: There is no e in font nullfont! 248 | Missing character: There is no s in font nullfont! 249 | Missing character: There is no t in font nullfont! 250 | Missing character: There is no i in font nullfont! 251 | Missing character: There is no n in font nullfont! 252 | Missing character: There is no i in font nullfont! 253 | Missing character: There is no t in font nullfont! 254 | Missing character: There is no t in font nullfont! 255 | Missing character: There is no e in font nullfont! 256 | Missing character: There is no s in font nullfont! 257 | Missing character: There is no t in font nullfont! 258 | Missing character: There is no C in font nullfont! 259 | Missing character: There is no o in font nullfont! 260 | Missing character: There is no n in font nullfont! 261 | Missing character: There is no t in font nullfont! 262 | Missing character: There is no r in font nullfont! 263 | Missing character: There is no o in font nullfont! 264 | Missing character: There is no l in font nullfont! 265 | Missing character: There is no l in font nullfont! 266 | Missing character: There is no e in font nullfont! 267 | Missing character: There is no r in font nullfont! 268 | Missing character: There is no v in font nullfont! 269 | Missing character: There is no o in font nullfont! 270 | Missing character: There is no i in font nullfont! 271 | Missing character: There is no d in font nullfont! 272 | Missing character: There is no 0 in font nullfont! 273 | Missing character: There is no m in font nullfont! 274 | Missing character: There is no s in font nullfont! 275 | 276 | ! LaTeX Error: Environment call undefined. 277 | 278 | See the LaTeX manual or LaTeX Companion for explanation. 279 | Type H for immediate help. 280 | ... 281 | 282 | l.10 \begin{call} 283 | {testController}{newInstance}{testBean}{Bean 0ms} 284 | Your command was ignored. 285 | Type I to replace it with another command, 286 | or to continue without it. 287 | 288 | Missing character: There is no t in font nullfont! 289 | Missing character: There is no e in font nullfont! 290 | Missing character: There is no s in font nullfont! 291 | Missing character: There is no t in font nullfont! 292 | Missing character: There is no C in font nullfont! 293 | Missing character: There is no o in font nullfont! 294 | Missing character: There is no n in font nullfont! 295 | Missing character: There is no t in font nullfont! 296 | Missing character: There is no r in font nullfont! 297 | Missing character: There is no o in font nullfont! 298 | Missing character: There is no l in font nullfont! 299 | Missing character: There is no l in font nullfont! 300 | Missing character: There is no e in font nullfont! 301 | Missing character: There is no r in font nullfont! 302 | Missing character: There is no n in font nullfont! 303 | Missing character: There is no e in font nullfont! 304 | Missing character: There is no w in font nullfont! 305 | Missing character: There is no I in font nullfont! 306 | Missing character: There is no n in font nullfont! 307 | Missing character: There is no s in font nullfont! 308 | Missing character: There is no t in font nullfont! 309 | Missing character: There is no a in font nullfont! 310 | Missing character: There is no n in font nullfont! 311 | Missing character: There is no c in font nullfont! 312 | Missing character: There is no e in font nullfont! 313 | Missing character: There is no t in font nullfont! 314 | Missing character: There is no e in font nullfont! 315 | Missing character: There is no s in font nullfont! 316 | Missing character: There is no t in font nullfont! 317 | Missing character: There is no B in font nullfont! 318 | Missing character: There is no e in font nullfont! 319 | Missing character: There is no a in font nullfont! 320 | Missing character: There is no n in font nullfont! 321 | Missing character: There is no B in font nullfont! 322 | Missing character: There is no e in font nullfont! 323 | Missing character: There is no a in font nullfont! 324 | Missing character: There is no n in font nullfont! 325 | Missing character: There is no 0 in font nullfont! 326 | Missing character: There is no m in font nullfont! 327 | Missing character: There is no s in font nullfont! 328 | 329 | ! LaTeX Error: \begin{center} on input line 2 ended by \end{call}. 330 | 331 | See the LaTeX manual or LaTeX Companion for explanation. 332 | Type H for immediate help. 333 | ... 334 | 335 | l.11 \end{call} 336 | 337 | Your command was ignored. 338 | Type I to replace it with another command, 339 | or to continue without it. 340 | 341 | 342 | ! LaTeX Error: \begin{center} on input line 2 ended by \end{call}. 343 | 344 | See the LaTeX manual or LaTeX Companion for explanation. 345 | Type H for immediate help. 346 | ... 347 | 348 | l.13 \end{call} 349 | 350 | Your command was ignored. 351 | Type I to replace it with another command, 352 | or to continue without it. 353 | 354 | 355 | ! LaTeX Error: \begin{center} on input line 2 ended by \end{sequencediagram}. 356 | 357 | See the LaTeX manual or LaTeX Companion for explanation. 358 | Type H for immediate help. 359 | ... 360 | 361 | l.15 \end{sequencediagram} 362 | 363 | Your command was ignored. 364 | Type I to replace it with another command, 365 | or to continue without it. 366 | 367 | 368 | ! LaTeX Error: \caption outside float. 369 | 370 | See the LaTeX manual or LaTeX Companion for explanation. 371 | Type H for immediate help. 372 | ... 373 | 374 | l.16 \caption 375 | {test.DiagramStructureTest simpleStructureTest} 376 | You're in trouble here. Try typing to proceed. 377 | If that doesn't work, type X to quit. 378 | 379 | Missing character: There is no t in font nullfont! 380 | Missing character: There is no e in font nullfont! 381 | Missing character: There is no s in font nullfont! 382 | Missing character: There is no t in font nullfont! 383 | Missing character: There is no . in font nullfont! 384 | Missing character: There is no D in font nullfont! 385 | Missing character: There is no i in font nullfont! 386 | Missing character: There is no a in font nullfont! 387 | Missing character: There is no g in font nullfont! 388 | Missing character: There is no r in font nullfont! 389 | Missing character: There is no a in font nullfont! 390 | Missing character: There is no m in font nullfont! 391 | Missing character: There is no S in font nullfont! 392 | Missing character: There is no t in font nullfont! 393 | Missing character: There is no r in font nullfont! 394 | Missing character: There is no u in font nullfont! 395 | Missing character: There is no c in font nullfont! 396 | Missing character: There is no t in font nullfont! 397 | Missing character: There is no u in font nullfont! 398 | Missing character: There is no r in font nullfont! 399 | Missing character: There is no e in font nullfont! 400 | Missing character: There is no T in font nullfont! 401 | Missing character: There is no e in font nullfont! 402 | Missing character: There is no s in font nullfont! 403 | Missing character: There is no t in font nullfont! 404 | Missing character: There is no s in font nullfont! 405 | Missing character: There is no i in font nullfont! 406 | Missing character: There is no m in font nullfont! 407 | Missing character: There is no p in font nullfont! 408 | Missing character: There is no l in font nullfont! 409 | Missing character: There is no e in font nullfont! 410 | Missing character: There is no S in font nullfont! 411 | Missing character: There is no t in font nullfont! 412 | Missing character: There is no r in font nullfont! 413 | Missing character: There is no u in font nullfont! 414 | Missing character: There is no c in font nullfont! 415 | Missing character: There is no t in font nullfont! 416 | Missing character: There is no u in font nullfont! 417 | Missing character: There is no r in font nullfont! 418 | Missing character: There is no e in font nullfont! 419 | Missing character: There is no T in font nullfont! 420 | Missing character: There is no e in font nullfont! 421 | Missing character: There is no s in font nullfont! 422 | Missing character: There is no t in font nullfont! 423 | 424 | ! LaTeX Error: \begin{document} ended by \end{figure}. 425 | 426 | See the LaTeX manual or LaTeX Companion for explanation. 427 | Type H for immediate help. 428 | ... 429 | 430 | l.19 \end{figure} 431 | 432 | Your command was ignored. 433 | Type I to replace it with another command, 434 | or to continue without it. 435 | 436 | ) 437 | ! Emergency stop. 438 | <*> ...iagramStructureTest.simpleStructureTest.tex 439 | 440 | *** (job aborted, no legal \end found) 441 | 442 | 443 | Here is how much of TeX's memory you used: 444 | 11 strings out of 494985 445 | 344 string characters out of 6180356 446 | 46109 words of memory out of 5000000 447 | 3328 multiletter control sequences out of 15000+600000 448 | 3640 words of font info for 14 fonts, out of 8000000 for 9000 449 | 36 hyphenation exceptions out of 8191 450 | 9i,1n,6p,127b,78s stack positions out of 5000i,500n,10000p,200000b,80000s 451 | ! ==> Fatal error occurred, no output PDF file produced! 452 | -------------------------------------------------------------------------------- /SDTEST/doc/test.DiagramStructureTest.simpleStructureTest.tex: -------------------------------------------------------------------------------- 1 | \begin{figure} 2 | \begin{center} 3 | \begin{sequencediagram} 4 | \newthread{testDiagramStructureTest}{DiagramStructureTest} 5 | \newinst{testController}{Controller} 6 | \newinst{testModel}{Model} 7 | \newinst{testBean}{Bean} 8 | \newinst{testPersistor}{Persistor} 9 | \begin{call}{testDiagramStructureTest}{init}{testController}{void 0ms} 10 | \begin{call}{testController}{newInstance}{testBean}{Bean 0ms} 11 | \end{call} 12 | \begin{call}{testController}{setBean}{testModel}{void 0ms} 13 | \end{call} 14 | \begin{call}{testController}{persist}{testModel}{boolean 0ms} 15 | \begin{call}{testModel}{persist}{testPersistor}{void 0ms} 16 | \end{call} 17 | \end{call} 18 | \end{call} 19 | \begin{call}{testDiagramStructureTest}{simpleBeanOperation}{testController}{void 0ms} 20 | \begin{call}{testController}{getBean}{testModel}{Bean 0ms} 21 | \end{call} 22 | \begin{call}{testController}{simpleBeanOperation}{testBean}{void 0ms} 23 | \end{call} 24 | \begin{call}{testController}{setBean}{testModel}{void 0ms} 25 | \end{call} 26 | \begin{call}{testController}{persist}{testModel}{boolean 0ms} 27 | \begin{call}{testModel}{persist}{testPersistor}{void 0ms} 28 | \end{call} 29 | \end{call} 30 | \end{call} 31 | \end{sequencediagram} 32 | \caption{test.DiagramStructureTest simpleStructureTest} 33 | \label{test.DiagramStructureTest.simpleStructureTest} 34 | \end{center} 35 | \end{figure} 36 | -------------------------------------------------------------------------------- /SDTEST/doc/test.aux: -------------------------------------------------------------------------------- 1 | \relax 2 | \@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces test.DiagramStructureTest simpleStructureTest}}{1}} 3 | \newlabel{test.DiagramStructureTest.simpleStructureTest}{{1}{1}} 4 | \@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces test.DiagramStructureTest recursiveBeanOperation}}{2}} 5 | \newlabel{test.DiagramStructureTest.recursiveBeanOperation}{{2}{2}} 6 | \@writefile{lof}{\contentsline {figure}{\numberline {3}{\ignorespaces test.DiagramStructureTest forBeanOperation}}{3}} 7 | \newlabel{test.DiagramStructureTest.forBeanOperation}{{3}{3}} 8 | \@writefile{lof}{\contentsline {figure}{\numberline {4}{\ignorespaces test.DiagramStructureTest longBeanOperation}}{4}} 9 | \newlabel{test.DiagramStructureTest.longBeanOperation}{{4}{4}} 10 | -------------------------------------------------------------------------------- /SDTEST/doc/test.log: -------------------------------------------------------------------------------- 1 | This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian) (format=pdflatex 2014.4.11) 30 APR 2014 17:53 2 | entering extended mode 3 | restricted \write18 enabled. 4 | %&-line parsing enabled. 5 | **test.tex 6 | (./test.tex 7 | LaTeX2e <2011/06/27> 8 | Babel <3.9k> and hyphenation patterns for 4 languages loaded. 9 | (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls 10 | Document Class: article 2007/10/19 v1.4h Standard LaTeX document class 11 | (/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo 12 | File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option) 13 | ) 14 | \c@part=\count79 15 | \c@section=\count80 16 | \c@subsection=\count81 17 | \c@subsubsection=\count82 18 | \c@paragraph=\count83 19 | \c@subparagraph=\count84 20 | \c@figure=\count85 21 | \c@table=\count86 22 | \abovecaptionskip=\skip41 23 | \belowcaptionskip=\skip42 24 | \bibindent=\dimen102 25 | ) 26 | (/usr/share/texlive/texmf-dist/tex/latex/pgf/frontendlayer/tikz.sty 27 | (/usr/share/texlive/texmf-dist/tex/latex/pgf/basiclayer/pgf.sty 28 | (/usr/share/texlive/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty 29 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex 30 | \pgfutil@everybye=\toks14 31 | \pgfutil@tempdima=\dimen103 32 | \pgfutil@tempdimb=\dimen104 33 | 34 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-lists.t 35 | ex)) (/usr/share/texlive/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def 36 | \pgfutil@abb=\box26 37 | (/usr/share/texlive/texmf-dist/tex/latex/ms/everyshi.sty 38 | Package: everyshi 2001/05/15 v3.00 EveryShipout Package (MS) 39 | )) 40 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex 41 | Package: pgfrcs 2013/12/20 v3.0.0 (rcs-revision 1.28) 42 | )) 43 | Package: pgf 2013/12/18 v3.0.0 (rcs-revision 1.14) 44 | 45 | (/usr/share/texlive/texmf-dist/tex/latex/pgf/basiclayer/pgfcore.sty 46 | (/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty 47 | Package: graphicx 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR) 48 | 49 | (/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty 50 | Package: keyval 1999/03/16 v1.13 key=value parser (DPC) 51 | \KV@toks@=\toks15 52 | ) 53 | (/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty 54 | Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR) 55 | 56 | (/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty 57 | Package: trig 1999/03/16 v1.09 sin cos tan (DPC) 58 | ) 59 | (/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg 60 | File: graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live 61 | ) 62 | Package graphics Info: Driver file: pdftex.def on input line 91. 63 | 64 | (/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def 65 | File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX 66 | 67 | (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty 68 | Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO) 69 | ) 70 | (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty 71 | Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO) 72 | ) 73 | \Gread@gobject=\count87 74 | )) 75 | \Gin@req@height=\dimen105 76 | \Gin@req@width=\dimen106 77 | ) 78 | (/usr/share/texlive/texmf-dist/tex/latex/pgf/systemlayer/pgfsys.sty 79 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex 80 | Package: pgfsys 2013/11/30 v3.0.0 (rcs-revision 1.47) 81 | 82 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex 83 | \pgfkeys@pathtoks=\toks16 84 | \pgfkeys@temptoks=\toks17 85 | 86 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.t 87 | ex 88 | \pgfkeys@tmptoks=\toks18 89 | )) 90 | \pgf@x=\dimen107 91 | \pgf@y=\dimen108 92 | \pgf@xa=\dimen109 93 | \pgf@ya=\dimen110 94 | \pgf@xb=\dimen111 95 | \pgf@yb=\dimen112 96 | \pgf@xc=\dimen113 97 | \pgf@yc=\dimen114 98 | \w@pgf@writea=\write3 99 | \r@pgf@reada=\read1 100 | \c@pgf@counta=\count88 101 | \c@pgf@countb=\count89 102 | \c@pgf@countc=\count90 103 | \c@pgf@countd=\count91 104 | \t@pgf@toka=\toks19 105 | \t@pgf@tokb=\toks20 106 | \t@pgf@tokc=\toks21 107 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg 108 | File: pgf.cfg 2008/05/14 (rcs-revision 1.7) 109 | ) 110 | Driver file for pgf: pgfsys-pdftex.def 111 | 112 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def 113 | File: pgfsys-pdftex.def 2013/07/18 (rcs-revision 1.33) 114 | 115 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.de 116 | f 117 | File: pgfsys-common-pdf.def 2013/10/10 (rcs-revision 1.13) 118 | ))) 119 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code. 120 | tex 121 | File: pgfsyssoftpath.code.tex 2013/09/09 (rcs-revision 1.9) 122 | \pgfsyssoftpath@smallbuffer@items=\count92 123 | \pgfsyssoftpath@bigbuffer@items=\count93 124 | ) 125 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code. 126 | tex 127 | File: pgfsysprotocol.code.tex 2006/10/16 (rcs-revision 1.4) 128 | )) (/usr/share/texlive/texmf-dist/tex/latex/xcolor/xcolor.sty 129 | Package: xcolor 2007/01/21 v2.11 LaTeX color extensions (UK) 130 | 131 | (/usr/share/texlive/texmf-dist/tex/latex/latexconfig/color.cfg 132 | File: color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive 133 | ) 134 | Package xcolor Info: Driver file: pdftex.def on input line 225. 135 | Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1337. 136 | Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1341. 137 | Package xcolor Info: Model `RGB' extended on input line 1353. 138 | Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1355. 139 | Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1356. 140 | Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1357. 141 | Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1358. 142 | Package xcolor Info: Model `Gray' substituted by `gray' on input line 1359. 143 | Package xcolor Info: Model `wave' substituted by `hsb' on input line 1360. 144 | ) 145 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex 146 | Package: pgfcore 2010/04/11 v3.0.0 (rcs-revision 1.7) 147 | 148 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex 149 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex 150 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex) 151 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex 152 | \pgfmath@dimen=\dimen115 153 | \pgfmath@count=\count94 154 | \pgfmath@box=\box27 155 | \pgfmath@toks=\toks22 156 | \pgfmath@stack@operand=\toks23 157 | \pgfmath@stack@operation=\toks24 158 | ) 159 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex 160 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code 161 | .tex) 162 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonomet 163 | ric.code.tex) 164 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.cod 165 | e.tex) 166 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison 167 | .code.tex) 168 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code. 169 | tex) 170 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code 171 | .tex) 172 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code. 173 | tex) 174 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integerari 175 | thmetics.code.tex))) 176 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex 177 | \c@pgfmathroundto@lastzeros=\count95 178 | )) 179 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.te 180 | x 181 | File: pgfcorepoints.code.tex 2013/10/07 (rcs-revision 1.27) 182 | \pgf@picminx=\dimen116 183 | \pgf@picmaxx=\dimen117 184 | \pgf@picminy=\dimen118 185 | \pgf@picmaxy=\dimen119 186 | \pgf@pathminx=\dimen120 187 | \pgf@pathmaxx=\dimen121 188 | \pgf@pathminy=\dimen122 189 | \pgf@pathmaxy=\dimen123 190 | \pgf@xx=\dimen124 191 | \pgf@xy=\dimen125 192 | \pgf@yx=\dimen126 193 | \pgf@yy=\dimen127 194 | \pgf@zx=\dimen128 195 | \pgf@zy=\dimen129 196 | ) 197 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct. 198 | code.tex 199 | File: pgfcorepathconstruct.code.tex 2013/10/07 (rcs-revision 1.29) 200 | \pgf@path@lastx=\dimen130 201 | \pgf@path@lasty=\dimen131 202 | ) 203 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code 204 | .tex 205 | File: pgfcorepathusage.code.tex 2013/12/13 (rcs-revision 1.23) 206 | \pgf@shorten@end@additional=\dimen132 207 | \pgf@shorten@start@additional=\dimen133 208 | ) 209 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.te 210 | x 211 | File: pgfcorescopes.code.tex 2013/10/09 (rcs-revision 1.44) 212 | \pgfpic=\box28 213 | \pgf@hbox=\box29 214 | \pgf@layerbox@main=\box30 215 | \pgf@picture@serial@count=\count96 216 | ) 217 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.c 218 | ode.tex 219 | File: pgfcoregraphicstate.code.tex 2013/09/19 (rcs-revision 1.11) 220 | \pgflinewidth=\dimen134 221 | ) 222 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformation 223 | s.code.tex 224 | File: pgfcoretransformations.code.tex 2013/10/10 (rcs-revision 1.17) 225 | \pgf@pt@x=\dimen135 226 | \pgf@pt@y=\dimen136 227 | \pgf@pt@temp=\dimen137 228 | ) 229 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex 230 | File: pgfcorequick.code.tex 2008/10/09 (rcs-revision 1.3) 231 | ) 232 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreobjects.code.t 233 | ex 234 | File: pgfcoreobjects.code.tex 2006/10/11 (rcs-revision 1.2) 235 | ) 236 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathprocessing 237 | .code.tex 238 | File: pgfcorepathprocessing.code.tex 2013/09/09 (rcs-revision 1.9) 239 | ) 240 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.te 241 | x 242 | File: pgfcorearrows.code.tex 2013/11/07 (rcs-revision 1.40) 243 | \pgfarrowsep=\dimen138 244 | ) 245 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex 246 | File: pgfcoreshade.code.tex 2013/07/15 (rcs-revision 1.15) 247 | \pgf@max=\dimen139 248 | \pgf@sys@shading@range@num=\count97 249 | ) 250 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex 251 | File: pgfcoreimage.code.tex 2013/07/15 (rcs-revision 1.18) 252 | 253 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.code. 254 | tex 255 | File: pgfcoreexternal.code.tex 2013/07/15 (rcs-revision 1.20) 256 | \pgfexternal@startupbox=\box31 257 | )) 258 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/basiclayer/pgfcorelayers.code.te 259 | x 260 | File: pgfcorelayers.code.tex 2013/07/18 (rcs-revision 1.7) 261 | ) 262 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransparency.c 263 | ode.tex 264 | File: pgfcoretransparency.code.tex 2013/09/30 (rcs-revision 1.5) 265 | ) 266 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepatterns.code. 267 | tex 268 | File: pgfcorepatterns.code.tex 2013/11/07 (rcs-revision 1.5) 269 | ))) 270 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/modules/pgfmoduleshapes.code.tex 271 | File: pgfmoduleshapes.code.tex 2013/10/31 (rcs-revision 1.34) 272 | \pgfnodeparttextbox=\box32 273 | ) (/usr/share/texlive/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex 274 | File: pgfmoduleplot.code.tex 2013/07/31 (rcs-revision 1.12) 275 | ) 276 | (/usr/share/texlive/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-0-65 277 | .sty 278 | Package: pgfcomp-version-0-65 2007/07/03 v3.0.0 (rcs-revision 1.7) 279 | \pgf@nodesepstart=\dimen140 280 | \pgf@nodesepend=\dimen141 281 | ) 282 | (/usr/share/texlive/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-1-18 283 | .sty 284 | Package: pgfcomp-version-1-18 2007/07/23 v3.0.0 (rcs-revision 1.1) 285 | )) (/usr/share/texlive/texmf-dist/tex/latex/pgf/utilities/pgffor.sty 286 | (/usr/share/texlive/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty 287 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex)) 288 | (/usr/share/texlive/texmf-dist/tex/latex/pgf/math/pgfmath.sty 289 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex)) 290 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex 291 | Package: pgffor 2013/12/13 v3.0.0 (rcs-revision 1.25) 292 | 293 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex) 294 | \pgffor@iter=\dimen142 295 | \pgffor@skip=\dimen143 296 | \pgffor@stack=\toks25 297 | \pgffor@toks=\toks26 298 | )) 299 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex 300 | Package: tikz 2013/12/13 v3.0.0 (rcs-revision 1.142) 301 | 302 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers 303 | .code.tex 304 | File: pgflibraryplothandlers.code.tex 2013/08/31 v3.0.0 (rcs-revision 1.20) 305 | \pgf@plot@mark@count=\count98 306 | \pgfplotmarksize=\dimen144 307 | ) 308 | \tikz@lastx=\dimen145 309 | \tikz@lasty=\dimen146 310 | \tikz@lastxsaved=\dimen147 311 | \tikz@lastysaved=\dimen148 312 | \tikzleveldistance=\dimen149 313 | \tikzsiblingdistance=\dimen150 314 | \tikz@figbox=\box33 315 | \tikz@figbox@bg=\box34 316 | \tikz@tempbox=\box35 317 | \tikz@tempbox@bg=\box36 318 | \tikztreelevel=\count99 319 | \tikznumberofchildren=\count100 320 | \tikznumberofcurrentchild=\count101 321 | \tikz@fig@count=\count102 322 | 323 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/modules/pgfmodulematrix.code.tex 324 | File: pgfmodulematrix.code.tex 2013/09/17 (rcs-revision 1.8) 325 | \pgfmatrixcurrentrow=\count103 326 | \pgfmatrixcurrentcolumn=\count104 327 | \pgf@matrix@numberofcolumns=\count105 328 | ) 329 | \tikz@expandcount=\count106 330 | 331 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tik 332 | zlibrarytopaths.code.tex 333 | File: tikzlibrarytopaths.code.tex 2008/06/17 v3.0.0 (rcs-revision 1.2) 334 | ))) 335 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tik 336 | zlibraryarrows.code.tex 337 | File: tikzlibraryarrows.code.tex 2008/01/09 v3.0.0 (rcs-revision 1.1) 338 | 339 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.code. 340 | tex 341 | File: pgflibraryarrows.code.tex 2013/09/23 v3.0.0 (rcs-revision 1.16) 342 | \arrowsize=\dimen151 343 | )) 344 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tik 345 | zlibraryshadows.code.tex 346 | File: tikzlibraryshadows.code.tex 2008/01/13 v3.0.0 (rcs-revision 1.3) 347 | 348 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tik 349 | zlibraryfadings.code.tex 350 | File: tikzlibraryfadings.code.tex 2009/11/15 v3.0.0 (rcs-revision 1.2) 351 | 352 | (/usr/share/texlive/texmf-dist/tex/generic/pgf/libraries/pgflibraryfadings.code 353 | .tex 354 | File: pgflibraryfadings.code.tex 2008/02/07 v3.0.0 (rcs-revision 1.3) 355 | ))) (/usr/share/texlive/texmf-dist/tex/latex/pgf-umlsd/pgf-umlsd.sty 356 | Package: pgf-umlsd 2011/07/27 v0.6 Some LaTeX macros for UML Sequence Diagrams. 357 | 358 | 359 | (/usr/share/texlive/texmf-dist/tex/latex/base/ifthen.sty 360 | Package: ifthen 2001/05/26 v1.1c Standard LaTeX ifthen package (DPC) 361 | ) 362 | \c@preinst=\count107 363 | \c@instnum=\count108 364 | \c@threadnum=\count109 365 | \c@seqlevel=\count110 366 | \c@callevel=\count111 367 | \c@callselflevel=\count112 368 | \c@blocklevel=\count113 369 | ) (./test.aux) 370 | \openout1 = `test.aux'. 371 | 372 | LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 7. 373 | LaTeX Font Info: ... okay on input line 7. 374 | LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 7. 375 | LaTeX Font Info: ... okay on input line 7. 376 | LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 7. 377 | LaTeX Font Info: ... okay on input line 7. 378 | LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 7. 379 | LaTeX Font Info: ... okay on input line 7. 380 | LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 7. 381 | LaTeX Font Info: ... okay on input line 7. 382 | LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 7. 383 | LaTeX Font Info: ... okay on input line 7. 384 | 385 | ABD: EveryShipout initializing macros 386 | (/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii 387 | [Loading MPS to PDF converter (version 2006.09.02).] 388 | \scratchcounter=\count114 389 | \scratchdimen=\dimen152 390 | \scratchbox=\box37 391 | \nofMPsegments=\count115 392 | \nofMParguments=\count116 393 | \everyMPshowfont=\toks27 394 | \MPscratchCnt=\count117 395 | \MPscratchDim=\dimen153 396 | \MPnumerator=\count118 397 | \makeMPintoPDFobject=\count119 398 | \everyMPtoPDFconversion=\toks28 399 | ) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty 400 | Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO 401 | ) 402 | 403 | (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty 404 | Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO) 405 | Package ifluatex Info: LuaTeX not detected. 406 | ) 407 | (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty 408 | Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO) 409 | Package ifpdf Info: pdfTeX in PDF mode is detected. 410 | ) 411 | Package pdftexcmds Info: LuaTeX not detected. 412 | Package pdftexcmds Info: \pdf@primitive is available. 413 | Package pdftexcmds Info: \pdf@ifprimitive is available. 414 | Package pdftexcmds Info: \pdfdraftmode found. 415 | ) 416 | (/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty 417 | Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf 418 | 419 | (/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty 420 | Package: grfext 2010/08/19 v1.1 Manage graphics extensions (HO) 421 | 422 | (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty 423 | Package: kvdefinekeys 2011/04/07 v1.3 Define keys (HO) 424 | )) 425 | (/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty 426 | Package: kvoptions 2011/06/30 v3.11 Key value format for package options (HO) 427 | 428 | (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty 429 | Package: kvsetkeys 2012/04/25 v1.16 Key value parser (HO) 430 | 431 | (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty 432 | Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO) 433 | Package etexcmds Info: Could not find \expanded. 434 | (etexcmds) That can mean that you are not using pdfTeX 1.50 or 435 | (etexcmds) that some package has redefined \expanded. 436 | (etexcmds) In the latter case, load this package earlier. 437 | ))) 438 | Package grfext Info: Graphics extension search list: 439 | (grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE 440 | G,.JBIG2,.JB2,.eps] 441 | (grfext) \AppendGraphicsExtensions on input line 452. 442 | 443 | (/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg 444 | File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv 445 | e 446 | )) 447 | (./test.DiagramStructureTest.simpleStructureTest.tex 448 | \pgf@layerbox@umlsd@background=\box38 449 | \pgf@layerboxsaved@umlsd@background=\box39 450 | \pgf@layerbox@umlsd@threadlayer=\box40 451 | \pgf@layerboxsaved@umlsd@threadlayer=\box41 452 | LaTeX Font Info: External font `cmex10' loaded for size 453 | (Font) <7> on input line 4. 454 | LaTeX Font Info: External font `cmex10' loaded for size 455 | (Font) <5> on input line 4. 456 | ) 457 | (./test.DiagramStructureTest.recursiveBeanOperation.tex 458 | 459 | LaTeX Warning: Float too large for page by 113.72527pt on input line 47. 460 | 461 | ) (./test.DiagramStructureTest.forBeanOperation.tex 462 | Overfull \hbox (21.9273pt too wide) in paragraph at lines 31--32 463 | [] 464 | [] 465 | 466 | ) (./test.DiagramStructureTest.longBeanOperation.tex 467 | Overfull \hbox (12.70387pt too wide) in paragraph at lines 33--34 468 | [] 469 | [] 470 | 471 | ) [1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] [2] [3] [4] 472 | (./test.aux) ) 473 | Here is how much of TeX's memory you used: 474 | 12492 strings out of 494985 475 | 257855 string characters out of 6180356 476 | 398069 words of memory out of 5000000 477 | 15488 multiletter control sequences out of 15000+600000 478 | 3939 words of font info for 15 fonts, out of 8000000 for 9000 479 | 36 hyphenation exceptions out of 8191 480 | 55i,9n,78p,416b,1505s stack positions out of 5000i,500n,10000p,200000b,80000s 481 | 483 | Output written on test.pdf (4 pages, 33572 bytes). 484 | PDF statistics: 485 | 48 PDF objects out of 1000 (max. 8388607) 486 | 24 compressed objects within 1 object stream 487 | 0 named destinations out of 1000 (max. 500000) 488 | 109 words of extra memory for PDF output out of 10000 (max. 10000000) 489 | 490 | -------------------------------------------------------------------------------- /SDTEST/doc/test.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sherif181/java-sequence-diagram-generator/c2493f2c51ac3f66b4be8abc1683410066ab7a64/SDTEST/doc/test.pdf -------------------------------------------------------------------------------- /SDTEST/doc/test.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | \usepackage{tikz} 3 | \usetikzlibrary{arrows,shadows} 4 | \usepackage{pgf-umlsd} 5 | 6 | 7 | \begin{document} 8 | 9 | 10 | \input{test.DiagramStructureTest.simpleStructureTest.tex} 11 | \input{test.DiagramStructureTest.recursiveBeanOperation.tex} 12 | \input{test.DiagramStructureTest.forBeanOperation.tex} 13 | \input{test.DiagramStructureTest.longBeanOperation.tex} 14 | \end{document} -------------------------------------------------------------------------------- /SDTEST/src/main/java/test/AbstractSuperClass.java: -------------------------------------------------------------------------------- 1 | package test; 2 | 3 | public class AbstractSuperClass { 4 | public void test() { 5 | 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /SDTEST/src/main/java/test/Bean.java: -------------------------------------------------------------------------------- 1 | package test; 2 | 3 | import java.util.Random; 4 | 5 | public class Bean { 6 | private int val=new Random().nextInt(); 7 | 8 | public static Bean newInstance() { 9 | 10 | return new Bean(); 11 | } 12 | 13 | 14 | public void simpleBeanOperation() { 15 | val++; 16 | 17 | } 18 | 19 | 20 | public void longBeanOperation() { 21 | simpleBeanOperation(); 22 | try { 23 | Thread.sleep(1020); 24 | } catch (InterruptedException e) { 25 | // TODO Auto-generated catch block 26 | e.printStackTrace(); 27 | } 28 | 29 | } 30 | 31 | 32 | public void recursiveBeanOperation() { 33 | val=0; 34 | recurse(5); 35 | 36 | } 37 | 38 | 39 | private void recurse(int i) { 40 | val++; 41 | if(i>0){ 42 | recurse(i-1); 43 | } 44 | 45 | } 46 | 47 | 48 | public void forBeanOperation() { 49 | for (int i = 0; i < 10; i++) { 50 | simpleBeanOperation(); 51 | } 52 | 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /SDTEST/src/main/java/test/Controller.java: -------------------------------------------------------------------------------- 1 | package test; 2 | 3 | public class Controller { 4 | 5 | private Model model; 6 | public Controller(Model model) { 7 | this.model = model; 8 | 9 | } 10 | public void init() { 11 | Bean b=Bean.newInstance(); 12 | 13 | model.setBean(b); 14 | model.persist(); 15 | } 16 | public void simpleBeanOperation() { 17 | Bean b = model.getBean(); 18 | b.simpleBeanOperation(); 19 | model.setBean(b); 20 | 21 | model.persist(); 22 | } 23 | 24 | public void longBeanOperation() { 25 | Bean b = model.getBean(); 26 | b.longBeanOperation(); 27 | model.setBean(b); 28 | 29 | model.persist(); 30 | } 31 | 32 | public void recursiveBeanOperation(){ 33 | Bean b = model.getBean(); 34 | b.recursiveBeanOperation(); 35 | model.setBean(b); 36 | 37 | model.persist(); 38 | } 39 | public void forBeanOperation(){ 40 | Bean b = model.getBean(); 41 | b.forBeanOperation(); 42 | model.setBean(b); 43 | 44 | } 45 | 46 | 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /SDTEST/src/main/java/test/Model.java: -------------------------------------------------------------------------------- 1 | package test; 2 | 3 | public class Model { 4 | 5 | private Bean bean; 6 | 7 | public void setBean(Bean b) { 8 | this.bean = b; 9 | 10 | 11 | } 12 | 13 | public boolean persist() { 14 | Persistor.persist(bean); 15 | return true; 16 | 17 | } 18 | 19 | public Bean getBean() { 20 | return bean; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SDTEST/src/main/java/test/Persistor.java: -------------------------------------------------------------------------------- 1 | package test; 2 | 3 | public class Persistor { 4 | 5 | public static void persist(Bean bean) { 6 | 7 | 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /SDTEST/src/main/java/test/RealSubClass.java: -------------------------------------------------------------------------------- 1 | package test; 2 | 3 | public class RealSubClass extends AbstractSuperClass{ 4 | public void sub(){ 5 | test(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /SDTEST/src/test/java/test/AnnotationTest.java: -------------------------------------------------------------------------------- 1 | package test; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import java.util.ArrayList; 6 | 7 | import javassist.ClassPool; 8 | import javassist.CtClass; 9 | 10 | import org.junit.After; 11 | import org.junit.Before; 12 | import org.junit.Test; 13 | 14 | import sk.anivit.stacktracegen.annotations.Caption; 15 | import sk.anivit.stacktracegen.annotations.FileName; 16 | import sk.anivit.stacktracegen.annotations.Label; 17 | import sk.anivit.stacktracegen.annotations.OutputDirectory; 18 | import sk.anivit.stacktracegen.annotations.SequenceDiagram; 19 | import sk.anivit.stacktracegen.recording.DiagramBean; 20 | import sk.anivit.stacktracegen.recording.DiagramRecorder; 21 | 22 | public class AnnotationTest { 23 | 24 | 25 | private int test; 26 | private static final int NO_ANNOTATIONS=0; 27 | private static final int FILE_NAME=1; 28 | private static final int OUTPUT_DIR = 2; 29 | private static final int LABEL = 3; 30 | private static final int CAPTION = 4; 31 | 32 | @Before 33 | public void setUp() { 34 | 35 | DiagramRecorder.getRecords().clear(); 36 | } 37 | 38 | @Test 39 | @SequenceDiagram({ Controller.class, Model.class }) 40 | public void noAnnotationsTest() { 41 | test = NO_ANNOTATIONS; 42 | Controller c = new Controller(new Model()); 43 | c.init(); 44 | c.simpleBeanOperation(); 45 | } 46 | @Test 47 | @FileName("test") 48 | @SequenceDiagram({ Controller.class, Model.class }) 49 | public void fileNameTest() { 50 | test = FILE_NAME; 51 | Controller c = new Controller(new Model()); 52 | c.init(); 53 | c.simpleBeanOperation(); 54 | } 55 | 56 | @Test 57 | @OutputDirectory("test1/test2/test3") 58 | @SequenceDiagram({ Controller.class, Model.class }) 59 | public void outputDirTest() { 60 | test = OUTPUT_DIR; 61 | Controller c = new Controller(new Model()); 62 | c.init(); 63 | c.simpleBeanOperation(); 64 | } 65 | 66 | @Test 67 | @Label("LABEL") 68 | @SequenceDiagram({ Controller.class, Model.class }) 69 | public void labelTest() { 70 | test = LABEL; 71 | Controller c = new Controller(new Model()); 72 | c.init(); 73 | c.simpleBeanOperation(); 74 | } 75 | @Test 76 | @Caption("CAPTION") 77 | @SequenceDiagram({ Controller.class, Model.class }) 78 | public void captionTest() { 79 | test = CAPTION; 80 | Controller c = new Controller(new Model()); 81 | c.init(); 82 | c.simpleBeanOperation(); 83 | } 84 | @After 85 | public void tearDown() throws Exception { 86 | DiagramBean rec = DiagramRecorder.getRecords().get(0); 87 | 88 | if(test==NO_ANNOTATIONS){ 89 | checkNoAnnotations(rec); 90 | } 91 | if(test==FILE_NAME){ 92 | checkFileName(rec); 93 | } 94 | if(test==OUTPUT_DIR){ 95 | checkOutputDir(rec); 96 | } 97 | 98 | 99 | if(test==CAPTION){ 100 | checkCaption(rec); 101 | } 102 | if(test==LABEL){ 103 | checkLabel(rec); 104 | } 105 | } 106 | 107 | private void checkLabel(DiagramBean rec) { 108 | assertEquals("LABEL", rec.getLabel()); 109 | } 110 | 111 | private void checkCaption(DiagramBean rec) { 112 | assertEquals("CAPTION", rec.getCaption()); 113 | } 114 | 115 | private void checkOutputDir(DiagramBean rec) { 116 | assertEquals("test1/test2/test3", rec.getOutputDir()); 117 | } 118 | 119 | private void checkFileName(DiagramBean rec) { 120 | assertEquals("test", rec.getFileName()); 121 | 122 | } 123 | 124 | private void checkNoAnnotations(DiagramBean rec) throws Exception { 125 | ClassPool pool = ClassPool.getDefault(); 126 | ArrayList c = rec.getRecordedClasses(); 127 | for (CtClass cl : c) { 128 | System.out.println(cl.getName()); 129 | } 130 | assertEquals(2, rec.getDiagramClasses().size()); 131 | assertEquals(pool.get(Controller.class.getName()), rec.getDiagramClasses().get(0)); 132 | assertEquals(pool.get(Model.class.getName()), rec.getDiagramClasses().get(1)); 133 | assertEquals("test.AnnotationTest.noAnnotationsTest.tex", rec.getFileName()); 134 | assertEquals("test.AnnotationTest.noAnnotationsTest", rec.getLabel()); 135 | assertEquals("test.AnnotationTest noAnnotationsTest", rec.getCaption()); 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /SDTEST/src/test/java/test/DiagramStructureTest.java: -------------------------------------------------------------------------------- 1 | package test; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import java.util.ArrayList; 6 | 7 | import org.junit.After; 8 | import org.junit.Before; 9 | import org.junit.Test; 10 | 11 | import sk.anivit.stacktracegen.annotations.SequenceDiagram; 12 | import sk.anivit.stacktracegen.recording.CalledMethod; 13 | import sk.anivit.stacktracegen.recording.DiagramBean; 14 | import sk.anivit.stacktracegen.recording.DiagramRecorder; 15 | import static org.junit.Assert.fail; 16 | 17 | public class DiagramStructureTest { 18 | private static final int SIMPLE = 0; 19 | private static final int RECURSIVE = 1; 20 | private static final int FOR = 2; 21 | private static final int LONG = 3; 22 | private static final int ABSTRACT = 4; 23 | private int test; 24 | 25 | 26 | @Test 27 | @SequenceDiagram({ AbstractSuperClass.class }) 28 | public void abstractSuperClassTest() { 29 | test = ABSTRACT; 30 | new RealSubClass().sub(); 31 | } 32 | 33 | @Test 34 | @SequenceDiagram({ Controller.class, Model.class, Bean.class, 35 | Persistor.class }) 36 | public void simpleStructureTest() { 37 | test = SIMPLE; 38 | Controller c = new Controller(new Model()); 39 | c.init(); 40 | c.simpleBeanOperation(); 41 | } 42 | 43 | @Test 44 | @SequenceDiagram({ Controller.class, Model.class, Bean.class, 45 | Persistor.class }) 46 | public void longBeanOperation() { 47 | test = LONG; 48 | Controller c = new Controller(new Model()); 49 | c.init(); 50 | c.longBeanOperation(); 51 | } 52 | 53 | @Test 54 | @SequenceDiagram({ Controller.class, Model.class, Bean.class, 55 | Persistor.class }) 56 | public void recursiveBeanOperation() { 57 | test = RECURSIVE; 58 | Controller c = new Controller(new Model()); 59 | c.init(); 60 | c.recursiveBeanOperation(); 61 | } 62 | 63 | @Test 64 | @SequenceDiagram({ Controller.class, Model.class, Bean.class, 65 | Persistor.class }) 66 | public void forBeanOperation() { 67 | test = FOR; 68 | Controller c = new Controller(new Model()); 69 | c.init(); 70 | c.forBeanOperation(); 71 | } 72 | 73 | @Before 74 | public void setUp() { 75 | 76 | DiagramRecorder.getRecords().clear(); 77 | } 78 | 79 | @After 80 | public void tearDown() { 81 | 82 | assertEquals(1, DiagramRecorder.getRecords().size()); 83 | DiagramBean rec = DiagramRecorder.getRecords().get(0); 84 | CalledMethod root = rec.getRoot(); 85 | if (test == SIMPLE) { 86 | checkSimple(root); 87 | 88 | } 89 | 90 | if (test == LONG) { 91 | long actual = rec.getStopTime() - rec.getStartTime(); 92 | 93 | assertEquals(actual, root.getRunTime()); 94 | if(actual<1000){ 95 | fail(); 96 | } 97 | if(actual>1100){ 98 | fail(); 99 | } 100 | 101 | } 102 | 103 | } 104 | 105 | 106 | 107 | 108 | 109 | private void checkSimple(CalledMethod root) { 110 | 111 | ArrayList cRoot = root.getChildren(); 112 | CalledMethod cRInit = cRoot.get(0); 113 | assertEquals("init", cRInit.getMethod().getName()); 114 | CalledMethod cRINewInstance = cRInit.getChildren().get(0); 115 | CalledMethod cRSetBean = cRInit.getChildren().get(1); 116 | CalledMethod cRPersist = cRInit.getChildren().get(2); 117 | assertEquals("newInstance", cRINewInstance.getMethod().getName()); 118 | assertEquals("setBean", cRSetBean.getMethod().getName()); 119 | assertEquals("persist", cRPersist.getMethod().getName()); 120 | 121 | CalledMethod cRSimpleOp = cRoot.get(1); 122 | assertEquals("simpleBeanOperation", cRSimpleOp.getMethod().getName()); 123 | assertEquals("getBean", cRSimpleOp.getChildren().get(0).getMethod() 124 | .getName()); 125 | assertEquals("simpleBeanOperation", cRSimpleOp.getChildren().get(1) 126 | .getMethod().getName()); 127 | assertEquals("setBean", cRSimpleOp.getChildren().get(2).getMethod() 128 | .getName()); 129 | assertEquals("persist", cRSimpleOp.getChildren().get(3).getMethod() 130 | .getName()); 131 | assertEquals("persist", cRSimpleOp.getChildren().get(3).getChildren() 132 | .get(0).getMethod().getName()); 133 | 134 | assertEquals(2, cRoot.size()); 135 | 136 | assertEquals(3, cRInit.getChildren().size()); 137 | assertEquals(4, cRSimpleOp.getChildren().size()); 138 | 139 | } 140 | 141 | } 142 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java' 2 | description = "Simple latex sequence diagram generator. This project uses annotated junit tests to generate latex sequence diagrams." 3 | version = '1.0' 4 | 5 | 6 | repositories { 7 | mavenCentral() 8 | maven { 9 | url "http://repo1.maven.org/maven2/" 10 | } 11 | 12 | } 13 | jar{ 14 | manifest { 15 | attributes 'Main-Class': 'sk.anivit.stacktracegen.SDGeneratorMain','Agent-Class': 'sk.anivit.stacktracegen.InjectorAgent' 16 | } 17 | } 18 | 19 | 20 | dependencies { 21 | compile "org.javassist:javassist:3.18.1-GA" 22 | compile "org.reflections:reflections:0.9.10" 23 | compile "junit:junit:4.12" 24 | 25 | runtime "org.javassist:javassist:3.18.1-GA" 26 | runtime "org.reflections:reflections:0.9.10" 27 | runtime "junit:junit:4.12" 28 | //test '' 29 | 30 | } 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sherif181/java-sequence-diagram-generator/c2493f2c51ac3f66b4be8abc1683410066ab7a64/example.png -------------------------------------------------------------------------------- /src/main/java/sk/anivit/stacktracegen/InjectorTranslator.java: -------------------------------------------------------------------------------- 1 | package sk.anivit.stacktracegen; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.lang.reflect.Method; 6 | import java.util.HashSet; 7 | import java.util.Set; 8 | 9 | import javassist.CannotCompileException; 10 | import javassist.ClassPool; 11 | import javassist.CtClass; 12 | import javassist.CtMethod; 13 | import javassist.NotFoundException; 14 | import javassist.Translator; 15 | 16 | import org.reflections.Reflections; 17 | import org.reflections.scanners.MethodAnnotationsScanner; 18 | import org.reflections.util.ClasspathHelper; 19 | import org.reflections.util.ConfigurationBuilder; 20 | 21 | import sk.anivit.stacktracegen.annotations.OutputDirectory; 22 | import sk.anivit.stacktracegen.annotations.SequenceDiagram; 23 | 24 | class InjectorTranslator implements Translator { 25 | 26 | private static SDInjector injector = new SDInjector(); 27 | public InjectorTranslator() throws NotFoundException { 28 | 29 | 30 | Reflections reflections = new Reflections(new ConfigurationBuilder() 31 | .setUrls(ClasspathHelper.forJavaClassPath()) 32 | .setScanners(new MethodAnnotationsScanner())); 33 | 34 | for ( Method m : reflections.getMethodsAnnotatedWith(SequenceDiagram.class)) { 35 | for (Class c : m.getAnnotation(SequenceDiagram.class).value()) { 36 | 37 | injector.addDiagramClass(c); 38 | 39 | } 40 | 41 | } 42 | 43 | 44 | 45 | 46 | } 47 | 48 | 49 | 50 | @Override 51 | public void onLoad(ClassPool pool, String classname) 52 | throws NotFoundException, CannotCompileException { 53 | 54 | 55 | 56 | CtClass ct = pool.getCtClass(classname); 57 | 58 | for (CtMethod m : ct.getMethods()) { 59 | if(m.hasAnnotation(SequenceDiagram.class)){ 60 | injector.entryMethod(m); 61 | } 62 | 63 | } 64 | if(injector.isDiagramClass(ct)){ 65 | injector.diagramClass(ct); 66 | 67 | 68 | } 69 | 70 | } 71 | 72 | @Override 73 | public void start(ClassPool pool) throws NotFoundException, 74 | CannotCompileException { 75 | } 76 | 77 | } -------------------------------------------------------------------------------- /src/main/java/sk/anivit/stacktracegen/SDGeneratorMain.java: -------------------------------------------------------------------------------- 1 | package sk.anivit.stacktracegen; 2 | 3 | import java.lang.reflect.Method; 4 | import java.util.ArrayList; 5 | 6 | import org.junit.runner.JUnitCore; 7 | 8 | import sk.anivit.stacktracegen.annotations.SequenceDiagram; 9 | import sk.anivit.stacktracegen.finder.ClassFinder; 10 | import sk.anivit.stacktracegen.finder.Visitor; 11 | import sk.anivit.stacktracegen.recording.DiagramRecorder; 12 | import javassist.ClassPool; 13 | import javassist.CtClass; 14 | import javassist.CtMethod; 15 | import javassist.Loader; 16 | import javassist.NotFoundException; 17 | import javassist.Translator; 18 | 19 | public class SDGeneratorMain { 20 | public static void main(String[] args) throws Throwable { 21 | final ArrayList classnames = new ArrayList(); 22 | final ClassPool pool = ClassPool.getDefault(); 23 | ClassFinder.findClasses(new Visitor() { 24 | 25 | @Override 26 | public boolean visit(String t) { 27 | 28 | 29 | try { 30 | CtClass c = pool.get(t); 31 | for (CtMethod m : c.getMethods()) { 32 | if (m.hasAnnotation(SequenceDiagram.class)) { 33 | classnames.add(t); 34 | System.out.println("Generating diagram for "+t); 35 | break; 36 | } 37 | } 38 | 39 | } catch (NotFoundException e) { 40 | 41 | } 42 | return true; 43 | } 44 | }); 45 | Translator xlat = new InjectorTranslator(); 46 | 47 | Loader loader = new Loader(); 48 | loader.addTranslator(pool, xlat); 49 | 50 | Class[] classes = new Class[classnames.size()]; 51 | for (int i = 0; i < classnames.size(); i++) { 52 | classes[i] = loader.loadClass(classnames.get(i)); 53 | } 54 | 55 | Class jucore = loader.loadClass(JUnitCore.class.getName()); 56 | 57 | Object[] param = { classes }; 58 | 59 | Method runClasses = jucore.getMethod("runClasses", classes.getClass()); 60 | runClasses.invoke(null, param); 61 | 62 | // loader.run(JUnitCore.class.getName(), 63 | // (String[]) al.toArray(new String[al.size()])); 64 | 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/sk/anivit/stacktracegen/SDInjector.java: -------------------------------------------------------------------------------- 1 | package sk.anivit.stacktracegen; 2 | 3 | import java.lang.reflect.Method; 4 | import java.util.ArrayList; 5 | 6 | import javassist.CannotCompileException; 7 | import javassist.CtClass; 8 | import javassist.CtMethod; 9 | import javassist.Modifier; 10 | import javassist.NotFoundException; 11 | import sk.anivit.stacktracegen.annotations.Caption; 12 | import sk.anivit.stacktracegen.annotations.FileName; 13 | import sk.anivit.stacktracegen.annotations.Label; 14 | import sk.anivit.stacktracegen.annotations.OutputDirectory; 15 | import sk.anivit.stacktracegen.annotations.SequenceDiagram; 16 | import sk.anivit.stacktracegen.recording.DiagramRecorder; 17 | 18 | public class SDInjector { 19 | private ArrayList> clsInDiagrams = new ArrayList>();// contains 20 | // all 21 | // classes 22 | // which 23 | // have 24 | // been 25 | // modified 26 | // to 27 | // call 28 | // the 29 | // record 30 | // methods 31 | java.util.logging.Logger log = java.util.logging.Logger 32 | .getLogger(SDInjector.class.toString()); 33 | 34 | public void entryMethod(CtMethod m) throws CannotCompileException { 35 | CtClass dClass = m.getDeclaringClass(); 36 | String entryPointName = dClass.getName() + ":" + m.getName(); 37 | String caption = null; 38 | String label = null; 39 | try { 40 | if (m.hasAnnotation(Caption.class)) { 41 | 42 | caption = ((Caption) m.getAnnotation(Caption.class)).value(); 43 | log.info("caption: " + caption); 44 | } 45 | String fileName; 46 | if (m.hasAnnotation(FileName.class)) { 47 | fileName = ((FileName) m.getAnnotation(FileName.class)).value(); 48 | } else { 49 | fileName = entryPointName.replace(":", ".") + ".tex"; 50 | log.info("fileName: " + fileName); 51 | } 52 | 53 | String outDir = null; 54 | if (dClass.hasAnnotation(OutputDirectory.class)) { 55 | outDir = ((OutputDirectory) dClass 56 | .getAnnotation(OutputDirectory.class)).value(); 57 | 58 | } 59 | 60 | if (m.hasAnnotation(OutputDirectory.class)) { 61 | outDir = ((OutputDirectory) m 62 | .getAnnotation(OutputDirectory.class)).value(); 63 | } 64 | if (m.hasAnnotation(Label.class)) { 65 | label = ((Label) m.getAnnotation(Label.class)).value(); 66 | } 67 | 68 | if (outDir == null) { 69 | outDir = "doc"; 70 | } 71 | if (caption == null) { 72 | caption = entryPointName.replace(":", " "); 73 | } 74 | 75 | if (label == null) { 76 | label = entryPointName.replace(":", "."); 77 | } 78 | log.info("outDir: " + outDir); 79 | log.info("Entry method " + entryPointName); 80 | log.info("caption: " + caption); 81 | ArrayList> diagramsToRender = new ArrayList>(); 82 | 83 | for (Class c : ((SequenceDiagram) m 84 | .getAnnotation(SequenceDiagram.class)).value()) { 85 | diagramsToRender.add(c); 86 | } 87 | m.insertBefore(DiagramRecorder.class.getName() 88 | + ".startRecording(\"" + entryPointName + "\",\"" + caption 89 | + "\",\"" + fileName + "\",\"" + outDir + "\",\"" 90 | + diagramsToRender + "\",\"" + label + "\");"); 91 | m.insertAfter(DiagramRecorder.class.getName() + ".stopRecording();"); 92 | 93 | } catch (ClassNotFoundException e) { 94 | 95 | e.printStackTrace(); 96 | } 97 | 98 | } 99 | 100 | public void addDiagramClass(Class c) { 101 | if (!clsInDiagrams.contains(c)) { 102 | clsInDiagrams.add(c); 103 | } 104 | 105 | } 106 | 107 | public void diagramClass(CtClass ct) throws CannotCompileException, 108 | NotFoundException { 109 | 110 | for (CtMethod m : ct.getDeclaredMethods()) { 111 | 112 | if (!m.getDeclaringClass().getName().equals(Object.class.getName())) { 113 | if (!Modifier.isAbstract(m.getModifiers())) {//no abstract methods 114 | m.insertBefore(DiagramRecorder.class.getName() 115 | + ".methodCalled(\"" + ct.getName() + ":" 116 | + m.getName() + "\");"); 117 | m.insertAfter(DiagramRecorder.class.getName() 118 | + ".methodReturned();"); 119 | log.fine("Method listener " + m.getDeclaringClass() + ":" 120 | + m.getName()); 121 | 122 | 123 | } 124 | } 125 | 126 | } 127 | } 128 | 129 | public boolean isDiagramClass(CtClass ct) { 130 | for (Class c : clsInDiagrams) { 131 | 132 | if (c.getName().equals(ct.getName())) { 133 | 134 | return true; 135 | } 136 | } 137 | return false; 138 | } 139 | 140 | } 141 | -------------------------------------------------------------------------------- /src/main/java/sk/anivit/stacktracegen/annotations/Caption.java: -------------------------------------------------------------------------------- 1 | package sk.anivit.stacktracegen.annotations; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target(ElementType.METHOD) 10 | public @interface Caption { 11 | 12 | String value(); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/sk/anivit/stacktracegen/annotations/FileName.java: -------------------------------------------------------------------------------- 1 | package sk.anivit.stacktracegen.annotations; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target(ElementType.METHOD) 10 | public @interface FileName { 11 | String value(); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/sk/anivit/stacktracegen/annotations/Label.java: -------------------------------------------------------------------------------- 1 | package sk.anivit.stacktracegen.annotations; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target(ElementType.METHOD) 10 | public @interface Label { 11 | String value(); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/sk/anivit/stacktracegen/annotations/OutputDirectory.java: -------------------------------------------------------------------------------- 1 | package sk.anivit.stacktracegen.annotations; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target({ElementType.TYPE,ElementType.METHOD}) 10 | public @interface OutputDirectory { 11 | 12 | String value(); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/sk/anivit/stacktracegen/annotations/SequenceDiagram.java: -------------------------------------------------------------------------------- 1 | package sk.anivit.stacktracegen.annotations; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target(ElementType.METHOD) 10 | public @interface SequenceDiagram { 11 | 12 | Class[] value(); 13 | 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/sk/anivit/stacktracegen/finder/ClassFinder.java: -------------------------------------------------------------------------------- 1 | package sk.anivit.stacktracegen.finder; 2 | import java.io.File; 3 | import java.util.Enumeration; 4 | import java.util.jar.JarEntry; 5 | import java.util.jar.JarFile; 6 | 7 | public class ClassFinder { 8 | public static void findClasses(Visitor visitor) { 9 | String classpath = System.getProperty("java.class.path"); 10 | String[] paths = classpath.split( System.getProperty("path.separator") ); 11 | 12 | String javaHome = System.getProperty("java.home"); 13 | File file = new File(javaHome + File.separator + "lib"); 14 | if (file.exists()) { 15 | findClasses(file, file, true, visitor); 16 | } 17 | 18 | for (String path : paths) { 19 | file = new File(path); 20 | if (file.exists()) { 21 | findClasses(file, file, false, visitor); 22 | } 23 | } 24 | } 25 | 26 | private static boolean findClasses(File root, File file, boolean includeJars, Visitor visitor) { 27 | if (file.isDirectory()) { 28 | for (File child : file.listFiles()) { 29 | if (!findClasses(root, child, includeJars, visitor)) { 30 | return false; 31 | } 32 | } 33 | } else { 34 | if (file.getName().toLowerCase().endsWith(".jar") && includeJars) { 35 | JarFile jar = null; 36 | try { 37 | jar = new JarFile(file); 38 | } catch (Exception ex) { 39 | 40 | } 41 | if (jar != null) { 42 | Enumeration entries = jar.entries(); 43 | while (entries.hasMoreElements()) { 44 | JarEntry entry = entries.nextElement(); 45 | String name = entry.getName(); 46 | int extIndex = name.lastIndexOf(".class"); 47 | if (extIndex > 0) { 48 | if (!visitor.visit(name.substring(0, extIndex).replace("/", "."))) { 49 | return false; 50 | } 51 | } 52 | } 53 | } 54 | } 55 | else if (file.getName().toLowerCase().endsWith(".class")) { 56 | if (!visitor.visit(createClassName(root, file))) { 57 | return false; 58 | } 59 | } 60 | } 61 | 62 | return true; 63 | } 64 | 65 | private static String createClassName(File root, File file) { 66 | StringBuffer sb = new StringBuffer(); 67 | String fileName = file.getName(); 68 | sb.append(fileName.substring(0, fileName.lastIndexOf(".class"))); 69 | file = file.getParentFile(); 70 | while (file != null && !file.equals(root)) { 71 | sb.insert(0, '.').insert(0, file.getName()); 72 | file = file.getParentFile(); 73 | } 74 | return sb.toString(); 75 | } 76 | } -------------------------------------------------------------------------------- /src/main/java/sk/anivit/stacktracegen/finder/Visitor.java: -------------------------------------------------------------------------------- 1 | package sk.anivit.stacktracegen.finder; 2 | public interface Visitor { 3 | /** 4 | * @return {@code true} if the algorithm should visit more results, 5 | * {@code false} if it should terminate now. 6 | */ 7 | public boolean visit(T t); 8 | } -------------------------------------------------------------------------------- /src/main/java/sk/anivit/stacktracegen/recording/CalledMethod.java: -------------------------------------------------------------------------------- 1 | package sk.anivit.stacktracegen.recording; 2 | 3 | import java.util.ArrayList; 4 | 5 | import javassist.CtClass; 6 | import javassist.CtMethod; 7 | 8 | public class CalledMethod { 9 | ArrayList children = new ArrayList(); 10 | private CtMethod method; 11 | private CalledMethod parrent = null; 12 | private long start; 13 | private long stop; 14 | private CtClass containingClass; 15 | 16 | public CalledMethod(CtClass containingClass, CtMethod method) { 17 | this.containingClass = containingClass; 18 | this.method = method; 19 | this.start = System.currentTimeMillis(); 20 | 21 | } 22 | 23 | public CtClass getContainingClass() { 24 | return containingClass; 25 | } 26 | 27 | public CtMethod getMethod() { 28 | return method; 29 | } 30 | 31 | public ArrayList getChildren() { 32 | return children; 33 | } 34 | 35 | public void addChild(CalledMethod m) { 36 | children.add(m); 37 | m.setParrent(this); 38 | } 39 | 40 | public void setParrent(CalledMethod parrent) { 41 | this.parrent = parrent; 42 | } 43 | 44 | public CalledMethod getParrent() { 45 | return parrent; 46 | } 47 | 48 | public void methodReturned() { 49 | stop = System.currentTimeMillis(); 50 | 51 | } 52 | 53 | public long getRunTime() { 54 | 55 | return stop-start; 56 | } 57 | @Override 58 | public String toString() { 59 | String r = containingClass.getName()+":"+method.getName()+"["+getRunTime()+"]"+"\n"; 60 | for ( CalledMethod c : children) { 61 | r+=" "+c.toString(); 62 | } 63 | return r; 64 | 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/sk/anivit/stacktracegen/recording/DiagramBean.java: -------------------------------------------------------------------------------- 1 | package sk.anivit.stacktracegen.recording; 2 | 3 | import java.util.ArrayList; 4 | 5 | import sk.anivit.stacktracegen.annotations.SequenceDiagram; 6 | import javassist.CtClass; 7 | import javassist.CtMethod; 8 | 9 | public class DiagramBean { 10 | 11 | private String fileName; 12 | 13 | private String caption; 14 | 15 | private String outputDir; 16 | private CalledMethod root = null; 17 | private CalledMethod lastMethod = null; 18 | private long startTime; 19 | private long stopTime; 20 | 21 | private CtMethod entryPoint; 22 | 23 | private ArrayList recordedDiagramClasses = new ArrayList(); 24 | private ArrayList diagramClasses; 25 | private String label; 26 | 27 | public DiagramBean(CtMethod entryPoint, String caption, String fileName, 28 | String outputDir, ArrayList dClasses, String label) { 29 | this.entryPoint = entryPoint; 30 | root = new CalledMethod(entryPoint.getDeclaringClass(), entryPoint); 31 | diagramClasses = dClasses; 32 | this.caption = caption; 33 | this.fileName = fileName; 34 | this.outputDir = outputDir; 35 | this.label = label; 36 | 37 | } 38 | 39 | /** 40 | * 41 | * @return classes which should be rendered in the sequence diagram 42 | */ 43 | public ArrayList getDiagramClasses() { 44 | return diagramClasses; 45 | } 46 | 47 | /** 48 | * 49 | * @return all classes which called the method called method 50 | */ 51 | public ArrayList getRecordedClasses() { 52 | return recordedDiagramClasses; 53 | } 54 | 55 | public static DiagramBean newInstance(CtMethod entryPoint, String caption, 56 | String fileName, String outputDir, ArrayList dClasses, 57 | String label) { 58 | 59 | return new DiagramBean(entryPoint, caption, fileName, outputDir, 60 | dClasses, label); 61 | } 62 | 63 | public void setOutputFileName(String fileName) { 64 | this.fileName = fileName; 65 | 66 | } 67 | 68 | public void setCaption(String caption) { 69 | this.caption = caption; 70 | 71 | } 72 | 73 | public String getLabel() { 74 | return label; 75 | } 76 | 77 | public String getCaption() { 78 | return caption; 79 | } 80 | 81 | public String getFileName() { 82 | return fileName; 83 | } 84 | 85 | public void setStartTime(long startTime) { 86 | this.startTime = startTime; 87 | 88 | } 89 | 90 | public void setStopTime(long stopTime) { 91 | this.stopTime = stopTime; 92 | 93 | } 94 | 95 | public String getOutputDir() { 96 | return outputDir; 97 | } 98 | 99 | public long getStartTime() { 100 | return startTime; 101 | } 102 | 103 | public long getStopTime() { 104 | return stopTime; 105 | } 106 | 107 | public void methodCalled(CalledMethod m) { 108 | 109 | if (!recordedDiagramClasses.contains(m.getMethod().getDeclaringClass())) { 110 | recordedDiagramClasses.add(m.getMethod().getDeclaringClass()); 111 | } 112 | 113 | if (lastMethod == null) { 114 | root.addChild(m); 115 | lastMethod = m; 116 | 117 | } else { 118 | lastMethod.addChild(m); 119 | lastMethod = m; 120 | } 121 | } 122 | 123 | public void methodReturned() { 124 | lastMethod.methodReturned(); 125 | 126 | lastMethod = lastMethod.getParrent(); 127 | 128 | } 129 | 130 | public CalledMethod getRoot() { 131 | return root; 132 | } 133 | 134 | public CtMethod getEntryPoint() { 135 | return entryPoint; 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /src/main/java/sk/anivit/stacktracegen/recording/DiagramRecorder.java: -------------------------------------------------------------------------------- 1 | package sk.anivit.stacktracegen.recording; 2 | 3 | import java.io.IOException; 4 | import java.util.ArrayList; 5 | 6 | import javassist.ClassPool; 7 | import javassist.CtClass; 8 | import javassist.CtMethod; 9 | import sk.anivit.stacktracegen.writer.LatexWriter; 10 | import sk.anivit.stacktracegen.writer.WriterI; 11 | 12 | public class DiagramRecorder { 13 | static ClassPool pool = ClassPool.getDefault(); 14 | protected static DiagramBean currentDiagramBean; 15 | private static ArrayList records = new ArrayList(); 16 | private static WriterI writer = new LatexWriter(); 17 | static java.util.logging.Logger log = java.util.logging.Logger 18 | .getLogger(DiagramBean.class.toString()); 19 | 20 | public static void startRecording(String entryPointName, String caption, 21 | String FileName, String outputDir, String diaClasses, String label) { 22 | String[] l = diaClasses.replace("[", "").replace("class", "") 23 | .replace("]", "").replace(" ", "").split(","); 24 | try { 25 | ArrayList dClasses = new ArrayList(); 26 | for (String s : l) { 27 | dClasses.add(pool.get(s)); 28 | } 29 | String[] ms = entryPointName.split(":"); 30 | 31 | CtClass cls = pool.get(ms[0]); 32 | 33 | CtMethod entryPoint = cls.getDeclaredMethod(ms[1]); 34 | currentDiagramBean = DiagramBean.newInstance(entryPoint, caption, 35 | FileName, outputDir, dClasses, label); 36 | currentDiagramBean.setStartTime(System.currentTimeMillis()); 37 | log.info("Recording started " + entryPointName); 38 | } catch (Exception e) { 39 | e.printStackTrace(); 40 | throw new RuntimeException(e); 41 | } 42 | 43 | } 44 | 45 | 46 | public static void methodCalled(String m) { 47 | if(currentDiagramBean==null){ 48 | return; 49 | } 50 | log.fine("Method called " + m); 51 | String[] ms = m.split(":"); 52 | try { 53 | CtClass cls = pool.get(ms[0]); 54 | CtMethod method = cls.getDeclaredMethod(ms[1]); 55 | 56 | currentDiagramBean.methodCalled(new CalledMethod(cls, method)); 57 | 58 | } catch (Exception e) { 59 | log.severe("Method called error " + e.getMessage()); 60 | } 61 | } 62 | 63 | public static void stopRecording() { 64 | currentDiagramBean.getRoot().methodReturned(); 65 | currentDiagramBean.setStopTime(System.currentTimeMillis()); 66 | records.add(currentDiagramBean); 67 | log.info("Recording stoped " 68 | + currentDiagramBean.getEntryPoint().getLongName()); 69 | 70 | try { 71 | writer.write(currentDiagramBean); 72 | } catch (IOException e) { 73 | 74 | e.printStackTrace(); 75 | throw new RuntimeException(e); 76 | } 77 | currentDiagramBean=null; 78 | } 79 | 80 | public static ArrayList getRecords() { 81 | return records; 82 | } 83 | 84 | public static void methodReturned() { 85 | if(currentDiagramBean==null){ 86 | return; 87 | } 88 | try { 89 | 90 | currentDiagramBean.methodReturned(); 91 | 92 | } catch (Exception e) { 93 | log.severe("Method called error " + e.getMessage()); 94 | 95 | } 96 | } 97 | 98 | public static void setWriter(WriterI writer) { 99 | DiagramRecorder.writer = writer; 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/sk/anivit/stacktracegen/test/T.java: -------------------------------------------------------------------------------- 1 | package sk.anivit.stacktracegen.test; 2 | 3 | import org.junit.Test; 4 | 5 | import sk.anivit.stacktracegen.annotations.Caption; 6 | import sk.anivit.stacktracegen.annotations.FileName; 7 | import sk.anivit.stacktracegen.annotations.Label; 8 | import sk.anivit.stacktracegen.annotations.OutputDirectory; 9 | import sk.anivit.stacktracegen.annotations.SequenceDiagram; 10 | 11 | @OutputDirectory("build/test") 12 | 13 | 14 | public class T { 15 | 16 | 17 | @Test 18 | @FileName("TestFile.tex") 19 | @Label("Tsdiagram") 20 | @Caption("This is a nice sequence diagram`") 21 | @SequenceDiagram({ ExapleClass1.class ,ExapleClass2.class, ExapleClass3.class}) 22 | public void testModifyClasses() { 23 | 24 | new ExapleClass1().exampleMethod11(); 25 | } 26 | 27 | public class ExapleClass1 { 28 | 29 | public void exampleMethod11() { 30 | exampleMethod12(); 31 | exampleMethod12(); 32 | new ExapleClass2().exampleMethod21(); 33 | new ExapleClass2().exampleMethod21(); 34 | exampleMethod12(); 35 | } 36 | 37 | public void exampleMethod12() { 38 | try { 39 | Thread.sleep(19); 40 | } catch (InterruptedException e) { 41 | // TODO Auto-generated catch block 42 | e.printStackTrace(); 43 | } 44 | } 45 | 46 | } 47 | 48 | public class ExapleClass2 { 49 | 50 | public void exampleMethod21() { 51 | for (int i = 0; i < 10; i++) { 52 | new ExapleClass3().exampleMethod31(); 53 | } 54 | try { 55 | Thread.sleep(1100); 56 | } catch (InterruptedException e) { 57 | // TODO Auto-generated catch block 58 | e.printStackTrace(); 59 | } 60 | } 61 | 62 | } 63 | 64 | public class ExapleClass3 { 65 | 66 | public void exampleMethod31() { 67 | try { 68 | Thread.sleep(20); 69 | } catch (InterruptedException e) { 70 | // TODO Auto-generated catch block 71 | e.printStackTrace(); 72 | } 73 | } 74 | 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/sk/anivit/stacktracegen/writer/LatexWriter.java: -------------------------------------------------------------------------------- 1 | package sk.anivit.stacktracegen.writer; 2 | 3 | import java.io.BufferedOutputStream; 4 | import java.io.File; 5 | import java.io.FileOutputStream; 6 | import java.io.IOException; 7 | import java.text.DecimalFormat; 8 | import java.util.ArrayList; 9 | 10 | import javassist.CtClass; 11 | import javassist.NotFoundException; 12 | import sk.anivit.stacktracegen.recording.CalledMethod; 13 | import sk.anivit.stacktracegen.recording.DiagramBean; 14 | 15 | public class LatexWriter implements WriterI { 16 | DecimalFormat df = new DecimalFormat("#.##"); 17 | private File outputDir; 18 | private File outputFile; 19 | private BufferedOutputStream writeBuffer; 20 | 21 | 22 | @Override 23 | public void write(DiagramBean bean) throws IOException { 24 | try { 25 | initOutput(bean); 26 | write(" \\begin{figure}"); 27 | write(" \\begin{center}"); 28 | 29 | ArrayList> mListList = new ArrayList>(); 30 | ArrayList mList = null; 31 | 32 | write(" \\begin{sequencediagram}"); 33 | 34 | 35 | write("\\newthread{" + bean.getEntryPoint().getDeclaringClass().getName().replace("$", "").replace(".", "") + "}{" 36 | + bean.getEntryPoint().getDeclaringClass().getSimpleName().replace("$", "-") + "}"); 37 | 38 | for (CtClass c : bean.getDiagramClasses()) { 39 | if(bean.getRecordedClasses().contains(c)){ 40 | write("\\newinst{" + c.getName().replace("$", "").replace(".", "") + "}{" 41 | + c.getSimpleName().replace("$", "-") + "}"); 42 | } 43 | 44 | } 45 | 46 | 47 | CalledMethod r = bean.getRoot(); 48 | 49 | writeMethods(r); 50 | write(" \\end{sequencediagram}"); 51 | 52 | if(bean.getCaption()!=null){ 53 | write("\\caption{"+bean.getCaption()+"}"); 54 | } 55 | if(bean.getLabel()!=null){ 56 | write("\\label{"+bean.getLabel()+"}"); 57 | } 58 | write("\\end{center}"); 59 | write("\\end{figure}"); 60 | writeBuffer.flush(); 61 | } catch (Exception e) { 62 | e.printStackTrace(); 63 | throw new RuntimeException(e); 64 | } 65 | } 66 | 67 | private void initOutput(DiagramBean bean) throws IOException { 68 | outputDir=new File(bean.getOutputDir()); 69 | if(!outputDir.exists()){ 70 | outputDir.mkdirs(); 71 | }else{ 72 | if(!outputDir.isDirectory()){ 73 | throw new IOException("Output dir is not a directory"); 74 | } 75 | } 76 | 77 | outputFile=new File(outputDir.getAbsolutePath()+File.separator+bean.getFileName()); 78 | System.out.println(outputFile.getAbsolutePath()); 79 | writeBuffer=new BufferedOutputStream(new FileOutputStream(outputFile)); 80 | } 81 | 82 | private void writeMethods(CalledMethod r) throws NotFoundException, IOException { 83 | String callerClass; 84 | if (r.getParrent() == null) { 85 | 86 | 87 | for ( CalledMethod c : r.getChildren()) { 88 | writeMethods(c); 89 | 90 | } 91 | 92 | return; 93 | } else { 94 | callerClass = r.getParrent().getContainingClass().getName(); 95 | } 96 | 97 | write("\\begin{call}{" + callerClass.replace(".", "") + "}{" + r.getMethod().getName().replace(".", "") 98 | + "}{" + r.getContainingClass().getName().replace(".", "") + "}{" 99 | + r.getMethod().getReturnType().getSimpleName() + " " 100 | + formatTime(r.getRunTime()) + "}"); 101 | 102 | ArrayList ch = r.getChildren(); 103 | boolean looping = false; 104 | for (int i = 0; i < ch.size(); i++) { 105 | if (i + 1 < ch.size()) { 106 | CalledMethod next = ch.get(i + 1); 107 | CalledMethod cur = ch.get(i); 108 | if (next.getMethod().equals(cur.getMethod())) { 109 | write("\\begin{sdblock}{Loop/multiple}{}"); 110 | writeMethods(ch.get(i)); 111 | while ((i + 1 < ch.size())) { 112 | if (!cur.getMethod().equals(ch.get(i + 1).getMethod())) { 113 | break; 114 | } 115 | i++; 116 | } 117 | write("\\end{sdblock}"); 118 | } else { 119 | writeMethods(ch.get(i)); 120 | } 121 | } else { 122 | writeMethods(ch.get(i)); 123 | } 124 | 125 | } 126 | write("\\end{call}"); 127 | } 128 | 129 | private void write(String s) throws IOException { 130 | 131 | writeBuffer.write((s+"\n").replace("$", "").getBytes()); 132 | 133 | } 134 | 135 | protected String formatTime(long d) { 136 | if(d>=3600000){//more then hour 137 | return df.format(d/3600000.0)+"h"; 138 | } 139 | if(d>=60000){//more then minute 140 | return df.format(d/60000.0)+"m"; 141 | } 142 | if(d>=1000){//more then second 143 | 144 | return df.format(d/1000.0)+"s"; 145 | } 146 | return df.format(d)+"ms"; 147 | 148 | 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /src/main/java/sk/anivit/stacktracegen/writer/WriterI.java: -------------------------------------------------------------------------------- 1 | package sk.anivit.stacktracegen.writer; 2 | 3 | import java.io.IOException; 4 | 5 | import sk.anivit.stacktracegen.recording.DiagramBean; 6 | 7 | public interface WriterI { 8 | public void write(DiagramBean bean) throws IOException; 9 | } 10 | -------------------------------------------------------------------------------- /src/test/java/sk/anivit/stacktracegen/recording/DiagramRecorderTest.java: -------------------------------------------------------------------------------- 1 | package sk.anivit.stacktracegen.recording; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | import static org.junit.Assert.assertTrue; 5 | import static org.junit.Assert.fail; 6 | 7 | import java.io.IOException; 8 | 9 | import javassist.ClassPool; 10 | import javassist.CtClass; 11 | import javassist.CtMethod; 12 | import javassist.CtNewMethod; 13 | import javassist.NotFoundException; 14 | 15 | import org.junit.Test; 16 | 17 | import sk.anivit.stacktracegen.SDInjector; 18 | import sk.anivit.stacktracegen.writer.WriterI; 19 | 20 | public class DiagramRecorderTest { 21 | 22 | @Test 23 | public void testStartRecording() throws Exception { 24 | ClassPool pool = ClassPool.getDefault(); 25 | 26 | String entryPointName = sk.anivit.stacktracegen.recording.Test.class 27 | .getName() + ":testik"; 28 | String caption = "caption"; 29 | String fileName = "fn"; 30 | String outputDir = "od"; 31 | String diaClasses = sk.anivit.stacktracegen.recording.Test.class 32 | .getName(); 33 | DiagramRecorder.startRecording(entryPointName, caption, fileName, 34 | outputDir, diaClasses, "label"); 35 | assertEquals(DiagramRecorder.currentDiagramBean.getEntryPoint(), pool 36 | .get(sk.anivit.stacktracegen.recording.Test.class.getName()) 37 | .getDeclaredMethod("testik")); 38 | assertEquals(DiagramRecorder.currentDiagramBean.getCaption(), caption); 39 | assertEquals(DiagramRecorder.currentDiagramBean.getFileName(), fileName); 40 | 41 | assertEquals(DiagramRecorder.currentDiagramBean.getOutputDir(), 42 | outputDir); 43 | assertEquals(DiagramRecorder.currentDiagramBean.getDiagramClasses() 44 | .size(), 1); 45 | assertTrue(DiagramRecorder.currentDiagramBean.getDiagramClasses() 46 | .contains( 47 | pool.get(sk.anivit.stacktracegen.recording.Test.class 48 | .getName()))); 49 | 50 | } 51 | 52 | @Test 53 | public void testMethodCalled() throws Exception { 54 | ClassPool pool = ClassPool.getDefault(); 55 | 56 | String entryPointName = sk.anivit.stacktracegen.recording.Test.class 57 | .getName() + ":testik"; 58 | String caption = "caption"; 59 | String fileName = "fn"; 60 | String outputDir = "od"; 61 | String diaClasses = sk.anivit.stacktracegen.recording.Test.class 62 | .getName(); 63 | DiagramRecorder.startRecording(entryPointName, caption, fileName, 64 | outputDir, diaClasses, ""); 65 | 66 | DiagramRecorder 67 | .methodCalled(sk.anivit.stacktracegen.recording.Test.class 68 | .getName() + ":testik"); 69 | 70 | DiagramRecorder 71 | .methodCalled(sk.anivit.stacktracegen.recording.Test.class 72 | .getName() + ":testik"); 73 | DiagramRecorder.methodReturned(); 74 | DiagramRecorder.methodReturned(); 75 | CalledMethod r = DiagramRecorder.currentDiagramBean.getRoot(); 76 | assertEquals(1, r.getChildren().size()); 77 | assertEquals( 78 | pool.get(sk.anivit.stacktracegen.recording.Test.class.getName()) 79 | .getDeclaredMethod("testik"), r.getMethod()); 80 | 81 | } 82 | 83 | @Test 84 | public void testStopRecording() throws Exception { 85 | final ClassPool pool = ClassPool.getDefault(); 86 | 87 | String entryPointName = sk.anivit.stacktracegen.recording.Test.class 88 | .getName() + ":testik"; 89 | String caption = "caption"; 90 | String fileName = "fn"; 91 | String outputDir = "od"; 92 | String diaClasses = sk.anivit.stacktracegen.recording.Test.class 93 | .getName(); 94 | DiagramRecorder.startRecording(entryPointName, caption, fileName, 95 | outputDir, diaClasses, ""); 96 | 97 | DiagramRecorder 98 | .methodCalled(sk.anivit.stacktracegen.recording.Test.class 99 | .getName() + ":testik"); 100 | 101 | DiagramRecorder 102 | .methodCalled(sk.anivit.stacktracegen.recording.Test.class 103 | .getName() + ":testik"); 104 | DiagramRecorder.methodReturned(); 105 | DiagramRecorder.methodReturned(); 106 | 107 | DiagramRecorder.setWriter(new WriterI() { 108 | 109 | @Override 110 | public void write(DiagramBean bean) throws IOException { 111 | CalledMethod r = DiagramRecorder.currentDiagramBean.getRoot(); 112 | assertEquals(1, r.getChildren().size()); 113 | try { 114 | assertEquals( 115 | pool.get( 116 | sk.anivit.stacktracegen.recording.Test.class 117 | .getName()).getDeclaredMethod( 118 | "testik"), r.getMethod()); 119 | } catch (NotFoundException e) { 120 | fail(e.getMessage()); 121 | e.printStackTrace(); 122 | } 123 | bean.setStopTime(-10); 124 | 125 | } 126 | }); 127 | DiagramBean b = DiagramRecorder.currentDiagramBean; 128 | DiagramRecorder.stopRecording(); 129 | assertEquals(-10, b.getStopTime()); 130 | 131 | } 132 | 133 | @Test 134 | public void testAbstractMethodRecording() throws Exception { 135 | SDInjector i = new SDInjector(); 136 | 137 | CtClass t = ClassPool.getDefault().makeClass("test"); 138 | CtClass sup = ClassPool.getDefault().makeClass("test"); 139 | t.setSuperclass(sup); 140 | 141 | CtMethod m = CtNewMethod.make( 142 | "public void test() { System.out.println(\"test ok\"); }", 143 | sup); 144 | sup.addMethod(m); 145 | 146 | i.diagramClass(t); 147 | System.out.println(m.getMethodInfo().getDescriptor()); 148 | 149 | } 150 | 151 | } 152 | -------------------------------------------------------------------------------- /src/test/java/sk/anivit/stacktracegen/recording/Test.java: -------------------------------------------------------------------------------- 1 | package sk.anivit.stacktracegen.recording; 2 | 3 | public class Test { 4 | public void testik(){ 5 | 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/test/java/sk/anivit/stacktracegen/writer/LatexWriterTest.java: -------------------------------------------------------------------------------- 1 | package sk.anivit.stacktracegen.writer; 2 | 3 | import static org.junit.Assert.*; 4 | 5 | import org.junit.Test; 6 | 7 | 8 | public class LatexWriterTest { 9 | 10 | @Test 11 | public void testFormatTime() throws Exception { 12 | LatexWriter w=new LatexWriter(); 13 | assertEquals("500ms",w.formatTime(500)); 14 | assertEquals("1.65s",w.formatTime(1650)); 15 | assertEquals("1.03h",w.formatTime(3700000)); 16 | 17 | } 18 | 19 | } 20 | --------------------------------------------------------------------------------