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;
import java.util.List;
import org.jgrapht.traverse.BreadthFirstIterator;
import org.jgrapht.traverse.DepthFirstIterator;
import org.jgrapht.traverse.GraphIterator;
......@@ -53,19 +54,25 @@ public class RoleWithIdentity extends ContextCondition implements
Vertex<ComponentEntry> componentVertex = Vertex.of(entry);
//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;
boolean identityExistence = false;
//first element is not needed
iterator.next();
if(iterator.hasNext()) {
while(iterator.hasNext()) {
element = iterator.next().getArchitectureElement();
if(element instanceof IdentityEntry) {
identityExistence = true;
}
}
//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());
}
......
......@@ -22,25 +22,6 @@ public class ConfigurationEntry extends AbstractSTEntry<ConfigurationEntry>{
*/
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}
* with {@link ArcdConstants.ST_KIND_PROTECTED} visability.
......
......@@ -18,25 +18,6 @@ import mc.umlp.arcd.ets.entries.AbstractSTEntry;
*/
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.
*/
......
......@@ -77,4 +77,13 @@ public class RoleEntry extends AbstractSTEntry<FilterEntry>{
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 {
if(node instanceof PrototypeASTSecArcPort && !storage.getEntryStack().isEmpty() && ((PrototypeASTSecArcPort) node).isCritical()) {
SecComponentEntry comp = (SecComponentEntry) storage.getEntryStack().peek();
Optional<PortEntry> port = comp.getPort(node.getName());
Optional<PortEntry> port = comp.getPort(node.printName());
if(port.isPresent()) {
((SecPortEntry) port.get()).setCritical(true);
}
......@@ -353,7 +353,7 @@ public class MontiSecArcSymtabVisitor extends MontiArcSymtabVisitor {
ASTSecArcFilter filterNode = ((PrototypeASTSecArcPort) node).getSecArcFilter();
FilterEntry filterEntry = createFilterEntry(filterNode);
SecComponentEntry comp = (SecComponentEntry) storage.getEntryStack().peek();
Optional<PortEntry> port = comp.getPort(node.getName());
Optional<PortEntry> port = comp.getPort(node.printName());
if(port.isPresent()) {
((SecPortEntry) port.get()).setFilter(filterEntry);
}
......
......@@ -20,7 +20,7 @@ public class MontiSecArcRunningExampleTest extends TestWithSymbolTableSec<MontiS
*/
@Test
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();
assertTrue(tool.run());
......
......@@ -32,8 +32,8 @@ component CashDeskSystem {
component Store {
port
in String identifier,
out ProductData,
in String inIdentifier,
out ProductData outProductData,
out PaymentAck;
port
......@@ -50,6 +50,10 @@ component CashDeskSystem {
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 {
port
in Event newSale,
in Image barcode,
in String identifier,
out String identifier,
in String inIdentifier,
out String outIdentifier,
in Event endSale,
in ProductData,
in PaymentAck,
out ProductData;
in ProductData inProductData,
in PaymentAck paymentAck,
out ProductData outProductData;
port
in Event cardPay,
......
......@@ -46,8 +46,10 @@ component CashDeskSystem {
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
......@@ -13,4 +13,6 @@ component Bank {
access customer;
identity weak cashDesk -> bank;
}
\ No newline at end of file
......@@ -13,18 +13,18 @@ component CashDesk {
port
in Event newSale,
in Image barcode,
in String identifier,
out String identifier,
in String inIdentifier,
out String outIdentifier,
in Event endSale,
in ProductData,
in PaymentAck,
out ProductData;
in ProductData inProductData,
in PaymentAck paymentAck,
out ProductData outProductData;
port
in Event cardPay,
critical in CardData,
critical in Integer pin,
critical out BankData bdOut,
in CardData,
in Integer pin,
out BankData bdOut,
in PaymentAck paIn,
out Boolean validation;
......
......@@ -9,11 +9,15 @@ component Store {
access stockManager, storeManager, cashier;
connect store -> storeServer, data;
autoconnect port;
connect saleInformation -> data.filterInfo;
identity weak cashDesk -> store;
port
in String identifier,
out ProductData,
in String intIdentifier,
out ProductData outProductData,
out PaymentAck;
port
......@@ -25,7 +29,7 @@ component Store {
cpe "cpeName";
port
in String identifier,
in String inIdentifier,
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