Commit bbaae350 authored by Paff's avatar Paff
Browse files

Test without tranformation vs. transformation

parent c88551cb
......@@ -220,14 +220,16 @@ public class MontiSecArcAnalysisVisitor extends CheckWorkflowClient {
}
//Check if analysis parameter existiert
for(String parameter : analysisParameter) {
try {
for (ISecAnalysisParameterChecker cc : analysisParameterChecker) {
cc.check(node, parameter);
if(analysisParameter != null) {
for(String parameter : analysisParameter) {
try {
for (ISecAnalysisParameterChecker cc : analysisParameterChecker) {
cc.check(node, parameter);
}
} catch (AmbigousException e) {
// not checked here
MCG.getLogger().info(e.getMessage());
}
} catch (AmbigousException e) {
// not checked here
MCG.getLogger().info(e.getMessage());
}
}
......
......@@ -13,7 +13,6 @@ import secarc._ast.ASTSecArcCPE;
import secarc._ast.ASTSecArcConfiguration;
import secarc._ast.ASTSecArcIdentity;
import secarc._ast.ASTSecArcPEP;
import secarc._ast.ASTSecArcRefRole;
import secarc._ast.ASTSecArcRole;
import secarc._ast.ASTSecArcTrustLevel;
import secarc._ast.ASTSecArcTrustlevelRelation;
......
......@@ -66,12 +66,14 @@ public class AnalysisCriticalPortTransformationWorkflow<T extends MontiSecArcRoo
InheritanceVisitor.run(preVisitor, dslroot.getAst());
//Delete Elements which are not needed
AnalysisCriticalPortTransformationVisitor visitorTransform = new AnalysisCriticalPortTransformationVisitor(dslroot);
visitorTransform.setResolver(resolver);
visitorTransform.setNodesToNameSpaces(nodesToNameSpaces);
visitorTransform.setEntries(preVisitor.getEntries());
InheritanceVisitor.run(visitorTransform, dslroot.getAst());
if(preVisitor.getEntries() != null) {
AnalysisCriticalPortTransformationVisitor visitorTransform = new AnalysisCriticalPortTransformationVisitor(dslroot);
visitorTransform.setResolver(resolver);
visitorTransform.setNodesToNameSpaces(nodesToNameSpaces);
visitorTransform.setEntries(preVisitor.getEntries());
InheritanceVisitor.run(visitorTransform, dslroot.getAst());
}
//Analysis for transformed Entries
......
package secarc;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import secarc._tool.MontiSecArcRoot;
public class MontiSecArcAnalysisTransformationCriticalPortTest extends TestWithSymtabAnalysis<MontiSecArcAnalysisTestTool> {
/**
......@@ -12,8 +18,55 @@ public class MontiSecArcAnalysisTransformationCriticalPortTest extends TestWithS
/**
* Test if the transformation for critical ports is correct
*/
public void testCriticalPortTransformation() {
@Test
public void testCriticalPortTransformationWithoutCriticalPort() {
//First file
System.out.println("EncryptedPathEndInLowTrustlevel.secarc");
//Without Transformation
MontiSecArcAnalysisTestTool tool = createTestToolWithoutJava(new String[] { "src/test/resources/secarc/analysis/connector/EncryptedPathEndInLowTrustlevel.secarc" });
tool.init();
assertTrue(tool.run());
MontiSecArcRoot root= (MontiSecArcRoot) initSymtabForRoot(tool, "secarc.analysis.connector.EncryptedPathEndInLowTrustlevel");
//With Transformation
MontiSecArcAnalysisTestTool toolTransformation = createTestToolWithoutJavaWhatIfCiritcalPort(new String[] { "src/test/resources/secarc/analysis/connector/EncryptedPathEndInLowTrustlevel.secarc" });
toolTransformation.init();
assertTrue(toolTransformation.run());
MontiSecArcRoot rootTransformed = (MontiSecArcRoot) initSymtabForRoot(toolTransformation, "secarc.analysis.connector.EncryptedPathEndInLowTrustlevel");
if(root.getAst().deepEquals(rootTransformed.getAst())){
assertTrue(true);
} else {
assertTrue(false);
}
}
/**
* Test if the transformation for critical ports is correct
*/
@Test
public void testCriticalPortTransformationWithCriticalPort() {
//First file
System.out.println("CriticalPort.secarc");
//Without Transformation
MontiSecArcAnalysisTestTool tool = createTestToolWithoutJava(new String[] { "src/test/resources/secarc/analysis/criticalport/CriticalPort.secarc" });
tool.init();
assertTrue(tool.run());
MontiSecArcRoot root= (MontiSecArcRoot) initSymtabForRoot(tool, "secarc.analysis.criticalport.CriticalPort");
//With Transformation
MontiSecArcAnalysisTestTool toolTransformation = createTestToolWithoutJavaWhatIfCiritcalPort(new String[] { "src/test/resources/secarc/analysis/criticalport/CriticalPort.secarc" });
toolTransformation.init();
assertTrue(toolTransformation.run());
MontiSecArcRoot rootTransformed = (MontiSecArcRoot) initSymtabForRoot(toolTransformation, "secarc.analysis.criticalport.CriticalPort");
if(root.getAst().deepEquals(rootTransformed.getAst())){
assertTrue(true);
} else {
assertTrue(false);
}
}
}
package secarc.analysis.criticalport;
component CriticalPort {
accesscontrol on;
trustlevel +1;
port
critical in String input;
identity weak help -> targetHelp;
component Help help {
trustlevel +1;
}
component TargetHelp targetHelp {
access user;
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment