Commit b3f49dfc authored by Paff's avatar Paff
Browse files

bug fixing with running example

parent f62afdc9
...@@ -2,6 +2,7 @@ package secarc.ets.cocos.role; ...@@ -2,6 +2,7 @@ package secarc.ets.cocos.role;
import java.util.List; import java.util.List;
import org.jgrapht.traverse.BreadthFirstIterator;
import org.jgrapht.traverse.DepthFirstIterator; import org.jgrapht.traverse.DepthFirstIterator;
import org.jgrapht.traverse.GraphIterator; import org.jgrapht.traverse.GraphIterator;
...@@ -53,19 +54,25 @@ public class RoleWithIdentity extends ContextCondition implements ...@@ -53,19 +54,25 @@ public class RoleWithIdentity extends ContextCondition implements
Vertex<ComponentEntry> componentVertex = Vertex.of(entry); Vertex<ComponentEntry> componentVertex = Vertex.of(entry);
//Look for paths with port as beginning //Look for paths with port as beginning
GraphIterator<Vertex<? extends STEntry>, Edge> iterator = new DepthFirstIterator<Vertex<? extends STEntry>, Edge>(graph.getReversedRawGraph(), componentVertex); GraphIterator<Vertex<? extends STEntry>, Edge> iterator = new BreadthFirstIterator<Vertex<? extends STEntry>, Edge>(graph.getReversedRawGraph(), componentVertex);
STEntry element = null; STEntry element = null;
boolean identityExistence = false;
//first element is not needed //first element is not needed
iterator.next(); iterator.next();
if(iterator.hasNext()) { while(iterator.hasNext()) {
element = iterator.next().getArchitectureElement(); element = iterator.next().getArchitectureElement();
if(element instanceof IdentityEntry) {
identityExistence = true;
}
} }
//First element is not needed //First element is not needed
if(!(element instanceof IdentityEntry)) { if(!identityExistence) {
addReport("For the component " + entry.getName() + " are roles defined. These roles must be authenticated by an identity link.", node.get_SourcePositionStart()); addReport("For the component " + entry.getName() + " are roles defined. These roles must be authenticated by an identity link.", node.get_SourcePositionStart());
} }
......
...@@ -21,25 +21,6 @@ public class ConfigurationEntry extends AbstractSTEntry<ConfigurationEntry>{ ...@@ -21,25 +21,6 @@ public class ConfigurationEntry extends AbstractSTEntry<ConfigurationEntry>{
* Entry kind of configuration. * Entry kind of configuration.
*/ */
public static final String KIND = "SecArcConfiguration"; public static final String KIND = "SecArcConfiguration";
/**
* name of configuration
*/
private String name;
/**
* Name of configuration
*/
public void setName(String name) {
this.name = name;
}
/**
* Name of configuration
*/
public String getName() {
return name;
}
/** /**
* Default constructor. Creates a new {@link ConfigurationEntry} * Default constructor. Creates a new {@link ConfigurationEntry}
......
...@@ -18,25 +18,6 @@ import mc.umlp.arcd.ets.entries.AbstractSTEntry; ...@@ -18,25 +18,6 @@ import mc.umlp.arcd.ets.entries.AbstractSTEntry;
*/ */
public class FilterEntry extends AbstractSTEntry<FilterEntry>{ public class FilterEntry extends AbstractSTEntry<FilterEntry>{
/**
* filter name
*/
@Serialized
private String name;
/**
* filter name
*/
public String getName() {
return name;
}
/**
* filter name
*/
public void setName(String name) {
this.name = name;
}
/** /**
* Entry kind of filter. * Entry kind of filter.
*/ */
......
...@@ -76,5 +76,14 @@ public class RoleEntry extends AbstractSTEntry<FilterEntry>{ ...@@ -76,5 +76,14 @@ public class RoleEntry extends AbstractSTEntry<FilterEntry>{
public String getName() { public String getName() {
return getRole(); return getRole();
} }
/*
* (non-Javadoc)
* @see mc.umlp.arcd.ets.entries.AbstractSTEntry#setName(java.lang.String)
*/
@Override
public void setName(String name) {
this.role = name;
}
} }
...@@ -344,7 +344,7 @@ public class MontiSecArcSymtabVisitor extends MontiArcSymtabVisitor { ...@@ -344,7 +344,7 @@ public class MontiSecArcSymtabVisitor extends MontiArcSymtabVisitor {
if(node instanceof PrototypeASTSecArcPort && !storage.getEntryStack().isEmpty() && ((PrototypeASTSecArcPort) node).isCritical()) { if(node instanceof PrototypeASTSecArcPort && !storage.getEntryStack().isEmpty() && ((PrototypeASTSecArcPort) node).isCritical()) {
SecComponentEntry comp = (SecComponentEntry) storage.getEntryStack().peek(); SecComponentEntry comp = (SecComponentEntry) storage.getEntryStack().peek();
Optional<PortEntry> port = comp.getPort(node.getName()); Optional<PortEntry> port = comp.getPort(node.printName());
if(port.isPresent()) { if(port.isPresent()) {
((SecPortEntry) port.get()).setCritical(true); ((SecPortEntry) port.get()).setCritical(true);
} }
...@@ -353,7 +353,7 @@ public class MontiSecArcSymtabVisitor extends MontiArcSymtabVisitor { ...@@ -353,7 +353,7 @@ public class MontiSecArcSymtabVisitor extends MontiArcSymtabVisitor {
ASTSecArcFilter filterNode = ((PrototypeASTSecArcPort) node).getSecArcFilter(); ASTSecArcFilter filterNode = ((PrototypeASTSecArcPort) node).getSecArcFilter();
FilterEntry filterEntry = createFilterEntry(filterNode); FilterEntry filterEntry = createFilterEntry(filterNode);
SecComponentEntry comp = (SecComponentEntry) storage.getEntryStack().peek(); SecComponentEntry comp = (SecComponentEntry) storage.getEntryStack().peek();
Optional<PortEntry> port = comp.getPort(node.getName()); Optional<PortEntry> port = comp.getPort(node.printName());
if(port.isPresent()) { if(port.isPresent()) {
((SecPortEntry) port.get()).setFilter(filterEntry); ((SecPortEntry) port.get()).setFilter(filterEntry);
} }
......
...@@ -20,7 +20,7 @@ public class MontiSecArcRunningExampleTest extends TestWithSymbolTableSec<MontiS ...@@ -20,7 +20,7 @@ public class MontiSecArcRunningExampleTest extends TestWithSymbolTableSec<MontiS
*/ */
@Test @Test
public void testRunningExample() throws CircluarDependencyException, AmbigousException { public void testRunningExample() throws CircluarDependencyException, AmbigousException {
MontiSecArcTool tool = createTestToolWithAdditionalParameters(new String[] {"src/test/resources/secarc/cds/CashDeskSystem.secarc"}, new String[] {"src/test/resources"}); MontiSecArcTool tool = createTestToolWithAdditionalParameters(new String[] {"src/test/resources/secarc/cds/"}, new String[] {"src/test/resources"});
tool.init(); tool.init();
assertTrue(tool.run()); assertTrue(tool.run());
......
...@@ -32,8 +32,8 @@ component CashDeskSystem { ...@@ -32,8 +32,8 @@ component CashDeskSystem {
component Store { component Store {
port port
in String identifier, in String inIdentifier,
out ProductData, out ProductData outProductData,
out PaymentAck; out PaymentAck;
port port
...@@ -50,6 +50,10 @@ component CashDeskSystem { ...@@ -50,6 +50,10 @@ component CashDeskSystem {
connect cashDesk -> store; connect cashDesk -> store;
connect cashDesk.productData -> productData; connect cashDesk.outProductData -> productData;
connect store.outProductData -> cashDesk.inProductData;
connect identifier -> cashDesk.inIdentifier;
} }
\ No newline at end of file
...@@ -9,12 +9,12 @@ component CashDesk { ...@@ -9,12 +9,12 @@ component CashDesk {
port port
in Event newSale, in Event newSale,
in Image barcode, in Image barcode,
in String identifier, in String inIdentifier,
out String identifier, out String outIdentifier,
in Event endSale, in Event endSale,
in ProductData, in ProductData inProductData,
in PaymentAck, in PaymentAck paymentAck,
out ProductData; out ProductData outProductData;
port port
in Event cardPay, in Event cardPay,
......
...@@ -46,8 +46,10 @@ component CashDeskSystem { ...@@ -46,8 +46,10 @@ component CashDeskSystem {
connect cashDesk -> store; connect cashDesk -> store;
connect cashDesk.productData -> productData; connect cashDesk.outProductData -> productData;
identity weak bank -> store; connect store.outProductData -> cashDesk.inProductData;
connect identifier -> cashDesk.inIdentifier;
} }
\ No newline at end of file
...@@ -12,5 +12,7 @@ component Bank { ...@@ -12,5 +12,7 @@ component Bank {
out PaymentAck; out PaymentAck;
access customer; access customer;
identity weak cashDesk -> bank;
} }
\ No newline at end of file
...@@ -13,18 +13,18 @@ component CashDesk { ...@@ -13,18 +13,18 @@ component CashDesk {
port port
in Event newSale, in Event newSale,
in Image barcode, in Image barcode,
in String identifier, in String inIdentifier,
out String identifier, out String outIdentifier,
in Event endSale, in Event endSale,
in ProductData, in ProductData inProductData,
in PaymentAck, in PaymentAck paymentAck,
out ProductData; out ProductData outProductData;
port port
in Event cardPay, in Event cardPay,
critical in CardData, in CardData,
critical in Integer pin, in Integer pin,
critical out BankData bdOut, out BankData bdOut,
in PaymentAck paIn, in PaymentAck paIn,
out Boolean validation; out Boolean validation;
......
...@@ -9,11 +9,15 @@ component Store { ...@@ -9,11 +9,15 @@ component Store {
access stockManager, storeManager, cashier; access stockManager, storeManager, cashier;
connect store -> storeServer, data; autoconnect port;
connect saleInformation -> data.filterInfo;
identity weak cashDesk -> store;
port port
in String identifier, in String intIdentifier,
out ProductData, out ProductData outProductData,
out PaymentAck; out PaymentAck;
port port
...@@ -25,7 +29,7 @@ component Store { ...@@ -25,7 +29,7 @@ component Store {
cpe "cpeName"; cpe "cpeName";
port port
in String identifier, in String inIdentifier,
out Identifier; out Identifier;
} }
......
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