Commit fbb2a21c authored by Raj Shah's avatar Raj Shah
Browse files

Release 3.2.51

parent 7f5e9d2c
<policy id="urn:policy:cs4:anonymizeTasksOfOthers" name="at IESE" description="Foremen can only see their own tasks in full detail. " xmlns="http://www.iese.fraunhofer.de/ind2uce/3.2.46/ind2uceLanguage"
xmlns:tns="http://www.iese.fraunhofer.de/ind2uce/3.2.46/ind2uceLanguage" xmlns:parameter="http://www.iese.fraunhofer.de/ind2uce/3.2.46/parameter" xmlns:pip="http://www.iese.fraunhofer.de/ind2uce/3.2.46/pip"
xmlns:function="http://www.iese.fraunhofer.de/ind2uce/3.2.46/function" xmlns:event="http://www.iese.fraunhofer.de/ind2uce/3.2.46/event" xmlns:constant="http://www.iese.fraunhofer.de/ind2uce/3.2.46/constant"
xmlns:variable="http://www.iese.fraunhofer.de/ind2uce/3.2.46/variable" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<mechanism event="urn:action:cs4:show-project">
<if>
<not>
<equals>
<pip:string method="urn:info:cs4:getRoleByUsername" default="">
<parameter:string name="userId">
<event:string eventParameter="user" jsonPathQuery="$.userId" default="" />
</parameter:string>
</pip:string>
<constant:string value="ROLE_MANAGER" />
</equals>
</not>
<then>
<modify eventParameter="project" jsonPathQuery="$.name" method="append">
<parameter:string name="suffix" value=" (Information partially hidden)" />
</modify>
<modify eventParameter="project" jsonPathQuery="$.budget" method="delete" />
<execute action="urn:action:cs4:logNotification">
<parameter:string name="message">
<concat>
<event:string eventParameter="user" jsonPathQuery="$.firstName" default="" />
<constant:string value=" " />
<event:string eventParameter="user" jsonPathQuery="$.lastName" default="" />
<constant:string value=" accessed the project list." />
</concat>
</parameter:string>
</execute>
</then>
</if>
</mechanism>
</policy>
\ No newline at end of file
<policy id='urn:policy:ind2uce-local:atIESE' description='' xmlns='http://www.iese.fraunhofer.de/ind2uce/3.0.25/enforcementLanguage' xmlns:tns='http://www.iese.fraunhofer.de/ind2uce/3.0.25/enforcementLanguage'
xmlns:param='http://www.iese.fraunhofer.de/ind2uce/3.0.25/param' xmlns:pip='http://www.iese.fraunhofer.de/ind2uce/3.0.25/pip' xmlns:function='http://www.iese.fraunhofer.de/ind2uce/3.0.25/function'
xmlns:constant='http://www.iese.fraunhofer.de/ind2uce/3.0.25/constant' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<detectiveMechanism>
<event action='urn:action:ind2uce-local:evaluate' />
<condition>
<and>
<or>
<pip:boolean method='urn:info:ind2uce-local:wificonnected' default='false'>
<param:string name='ssid' value='WLAN-mab' />
</pip:boolean>
<pip:boolean method='urn:info:ind2uce-local:wificonnected' default='false'>
<param:string name='ssid' value='wlan-extern' />
</pip:boolean>
<pip:boolean method='urn:info:ind2uce-local:networkconnected' default='false'>
<param:string name='description' value='AnyConnect' />
<param:string name='dns' value='iese.fhg.de' />
</pip:boolean>
</or>
<not>
<function:equals>
<pip:string method='urn:info:ind2uce-local:keyvalue' default=''>
<param:string name='key' value='location' />
</pip:string>
<constant:string value='IESE' />
</function:equals>
</not>
</and>
</condition>
<executeAction name='urn:action:ind2uce-local:keyvalue'>
<param:string name='key' value='location' />
<param:string name='value' value='IESE' />
</executeAction>
<executeAction name='urn:action:ind2uce-local:notification'>
<param:string name='message' value='You are now at IESE!' />
</executeAction>
</detectiveMechanism>
<detectiveMechanism>
<event action='urn:action:ind2uce-local:evaluate' />
<condition>
<and>
<not>
<or>
<pip:boolean method='urn:info:ind2uce-local:wificonnected' default='false'>
<param:string name='ssid' value='WLAN-mab' />
</pip:boolean>
<pip:boolean method='urn:info:ind2uce-local:wificonnected' default='false'>
<param:string name='ssid' value='wlan-extern' />
</pip:boolean>
<pip:boolean method='urn:info:ind2uce-local:networkconnected' default='false'>
<param:string name='description' value='AnyConnect' />
<param:string name='dns' value='iese.fhg.de' />
</pip:boolean>
</or>
</not>
<function:equals>
<pip:string method='urn:info:ind2uce-local:keyvalue' default=''>
<param:string name='key' value='location' />
</pip:string>
<constant:string value='IESE' />
</function:equals>
</and>
</condition>
<executeAction name='urn:action:ind2uce-local:notification'>
<param:string name='message' value='You are not IESE anymore!' />
</executeAction>
<executeAction name='urn:action:ind2uce-local:keyvalue'>
<param:string name='key' value='location' />
<param:string name='value' value='somewhere' />
</executeAction>
</detectiveMechanism>
</policy>
\ No newline at end of file
<policy id='urn:policy:ind2uce-local:atIESE' name="at IESE" description='switches IESE' xmlns='http://www.iese.fraunhofer.de/ind2uce/3.2.46/ind2uceLanguage' xmlns:tns='http://www.iese.fraunhofer.de/ind2uce/3.2.46/ind2uceLanguage'
xmlns:parameter='http://www.iese.fraunhofer.de/ind2uce/3.2.46/parameter' xmlns:pip='http://www.iese.fraunhofer.de/ind2uce/3.2.46/pip' xmlns:function='http://www.iese.fraunhofer.de/ind2uce/3.2.46/function'
xmlns:constant='http://www.iese.fraunhofer.de/ind2uce/3.2.46/constant'
xmlns:event='http://www.iese.fraunhofer.de/ind2uce/3.2.46/event' xmlns:variableDeclaration="http://www.iese.fraunhofer.de/ind2uce/3.2.46/variableDeclaration" xmlns:variable='http://www.iese.fraunhofer.de/ind2uce/3.2.46/variable'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<variableDeclaration:boolean name="atIESE">
<or>
<pip:boolean method='urn:info:ind2uce-local:wificonnected' default='false'>
<parameter:string name='ssid' value='WLAN-mab' />
</pip:boolean>
<pip:boolean method='urn:info:ind2uce-local:wificonnected' default='false'>
<parameter:string name='ssid' value='wlan-extern' />
</pip:boolean>
<pip:boolean method='urn:info:ind2uce-local:networkconnected' default='false'>
<parameter:string name='description' value='AnyConnect' />
<parameter:string name='dns' value='iese.fhg.de' />
</pip:boolean>
</or>
</variableDeclaration:boolean>
<!-- <timer cron="*/30 * * * * *"> -->
<!-- <fireEvent action="urn:action:ind2uce-local:evaluate" /> -->
<!-- </timer> -->
<mechanism event='urn:action:ind2uce-local:evaluate'>
<if>
<valueChanged to="true">
<variable:boolean reference="atIESE" />
</valueChanged>
<then>
<modify method="bla" eventParameter="blubb" />
<modify method="bla" eventParameter="blubb" />
<execute action='urn:action:ind2uce-local:notification'>
<parameter:string name='message' value='You are now at IESE!' />
</execute>
</then>
</if>
<elseif>
<valueChanged to="false">
<variable:boolean reference="atIESE" />
</valueChanged>
<then>
<execute action='urn:action:ind2uce-local:notification'>
<parameter:string name='message' value='You are now NOT at IESE!' />
</execute>
</then>
</elseif>
<else>
<execute action='urn:action:ind2uce-local:notification'>
<parameter:string name='message' value='Nothing changed!' />
</execute>
</else>
</mechanism>
</policy>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<policy xmlns="http://www.iese.fhg.de/ind2uce/1.2/enforcementLanguage" xmlns:tns="http://www.iese.fhg.de/ind2uce/1.2/enforcementLanguage" xmlns:param="http://www.iese.fhg.de/ind2uce/1.2/param"
xmlns:pip="http://www.iese.fhg.de/ind2uce/1.2/pip" xmlns:function="http://www.iese.fhg.de/ind2uce/1.2/function" xmlns:constant="http://www.iese.fhg.de/ind2uce/1.2/constant" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
id="fleet-uc1" description="Policy for Fleet PoC Use Case 1">
<preventiveMechanism id="decideOnStorageOfPositionUpdates">
<description>Decides whether to store a position update coming from a
vehicle.
</description>
<trigger action="urn:event:ppe:cr:writeData" isTry="false">
<function:exists>
<param:string name="attribute/longitude" />
</function:exists>
</trigger>
<condition>
<not>
<pip:boolean urn="urn:pip:fleet:currentTripEqualsType" default="false" ttl="30">
<param:string name="vehicleId">
<param:event name="thingId" />
</param:string>
<param:string name="tripType" value="BUSINESS" />
</pip:boolean>
</not>
</condition>
<authorizationAction name="default_writeData">
<allow>
<modify>
<param:event name="latitude">
<function:engine name="delete" />
</param:event>
<param:event name="longitude">
<function:engine name="delete" />
</param:event>
</modify>
</allow>
</authorizationAction>
</preventiveMechanism>
<preventiveMechanism id="aggregatePrivateTrips">
<description>Decide whether to read private trips in detail or
aggregated only.
</description>
<trigger action="urn:event:ppe:fleet:readTripData" isTry="false">
</trigger>
<condition>
<and>
<not>
<pip:boolean urn="urn:pip:local:isAssignedDriver" default="false">
<param:string name="userId">
<pip:string urn="urn:pip:im:getUserName" default="UNKNOWN">
<param:string name="contextId">
<param:event name="contextId" />
</param:string>
</pip:string>
</param:string>
</pip:boolean>
</not>
<and>
<pip:boolean urn="urn:pip:im:hasRole" default="false">
<param:string name="contextId">
<param:event name="contextId" />
</param:string>
<param:string name="roleName" value="FleetManager" /><!-- FleetManager, Driver -->
</pip:boolean>
<and>
<pip:boolean urn="urn:pip:local:isShowPrivateTripsAggregated" default="false">
<param:string name="userName">
<pip:string urn="urn:pip:im:getUserName" default="UNKNOWN">
<param:string name="contextId">
<param:event name="contextId" />
</param:string>
</pip:string>
</param:string>
</pip:boolean>
<pip:boolean urn="urn:pip:local:isVehicleStolen" default="false">
<param:string name="vehicleId">
<param:event name="vehicleId" />
</param:string>
</pip:boolean>
</and>
</and>
</and>
</condition>
<authorizationAction name="default_readTripData">
<allow>
<modify>
<param:event name="trips">
<function:engine name="aggregate">
<param:string name="carStolenDate">
<pip:string urn="urn:pip:local:getVehicleStolenDate" default="">
<param:string name="vehicleId">
<param:event name="vehicleId" />
</param:string>
</pip:string>
</param:string>
</function:engine>
</param:event>
</modify>
</allow>
</authorizationAction>
</preventiveMechanism>
</policy>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<policy id='urn:policy:ppe:fleet-uc1' name="Fleet Management UC1" description='switches IESE' xmlns='http://www.iese.fraunhofer.de/ind2uce/3.2.46/ind2uceLanguage' xmlns:tns='http://www.iese.fraunhofer.de/ind2uce/3.2.46/ind2uceLanguage'
xmlns:parameter='http://www.iese.fraunhofer.de/ind2uce/3.2.46/parameter' xmlns:pip='http://www.iese.fraunhofer.de/ind2uce/3.2.46/pip' xmlns:function='http://www.iese.fraunhofer.de/ind2uce/3.2.46/function'
xmlns:constant='http://www.iese.fraunhofer.de/ind2uce/3.2.46/constant' xmlns:variable='http://www.iese.fraunhofer.de/ind2uce/3.2.46/variable' xmlns:event='http://www.iese.fraunhofer.de/ind2uce/3.2.46/event'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<mechanism event="urn:action:ppe:writeData">
<if>
<and>
<eventHasParameter>
<constant:string value="longitude" />
</eventHasParameter>
<not>
<pip:boolean method="urn:pip:fleet:currentTripEqualsType" default="false">
<parameter:string name="vehicleId">
<event:string eventParameter="thingId" default="" />
</parameter:string>
<parameter:string name="tripType" value="BUSINESS" />
</pip:boolean>
</not>
</and>
<then>
<modify method="delete" eventParameter="latitude" />
<modify method="delete" eventParameter="longitude" />
</then>
</if>
</mechanism>
<mechanism event="urn:action:ppe:readTripData">
<if>
<and>
<not>
<pip:boolean method="urn:pip:local:isAssignedDriver" default="false">
<parameter:string name="userId">
<pip:string method="urn:pip:im:getUserName" default="UNKNOWN">
<parameter:string name="contextId">
<event:string eventParameter="contextId" default="" />
</parameter:string>
</pip:string>
</parameter:string>
</pip:boolean>
</not>
<and>
<pip:boolean method="urn:pip:im:hasRole" default="false">
<parameter:string name="contextId">
<event:string eventParameter="contextId" default="" />
</parameter:string>
<parameter:string name="roleName" value="FleetManager" /><!-- FleetManager, Driver -->
</pip:boolean>
<and>
<pip:boolean method="urn:pip:local:isShowPrivateTripsAggregated" default="false">
<parameter:string name="userName">
<pip:string method="urn:pip:im:getUserName" default="UNKNOWN">
<parameter:string name="contextId">
<event:string eventParameter="contextId" default="" />
</parameter:string>
</pip:string>
</parameter:string>
</pip:boolean>
<pip:boolean method="urn:pip:local:isVehicleStolen" default="false">
<parameter:string name="vehicleId">
<event:string eventParameter="vehicleId" default="" />
</parameter:string>
</pip:boolean>
</and>
</and>
</and>
<then>
<modify eventParameter="trips" method="aggregate">
<parameter:string name="carStolenDate">
<pip:string method="urn:pip:local:getVehicleStolenDate" default="">
<parameter:string name="vehicleId">
<event:string eventParameter="vehicleId" default="" />
</parameter:string>
</pip:string>
</parameter:string>
</modify>
</then>
</if>
</mechanism>
</policy>
\ No newline at end of file
......@@ -45,7 +45,7 @@ public class ConnectorsPDPTest {
comp.addUrl(URI.create("http://test.de/pdp"));
comp.addUrl(URI.create("rmi://test.de/pdp"));
final IPolicyDecisionPoint pdp = (IPolicyDecisionPoint) ConnectorFactory.getComponent(comp,"http");
final IPolicyDecisionPoint pdp = (IPolicyDecisionPoint) ConnectorFactory.getComponent(comp,"http",null);
assertTrue(pdp instanceof TestPdpHttpConnector);
}
......@@ -60,7 +60,7 @@ public class ConnectorsPDPTest {
final Component comp = new Component(new ComponentId("urn:component:ind2uce:pdp:123"));
comp.addUrl(URI.create("http://test.de/pdp"));
final IPolicyDecisionPoint pdp = ConnectorFactory.getPdp(comp, null);
final IPolicyDecisionPoint pdp = ConnectorFactory.getPdp(comp, null,null);
assertTrue(pdp instanceof TestPdpHttpConnector);
}
......@@ -70,7 +70,7 @@ public class ConnectorsPDPTest {
comp.addUrl(URI.create("http://test.de/pdp"));
comp.addUrl(URI.create("rmi://test.de/pdp"));
final IPolicyDecisionPoint pdp = ConnectorFactory.getPdp(comp, null);
final IPolicyDecisionPoint pdp = ConnectorFactory.getPdp(comp, null,null);
assertTrue(pdp instanceof TestPdpRmiConnector);
}
......@@ -80,7 +80,7 @@ public class ConnectorsPDPTest {
comp.addUrl(URI.create("http://test.de/pdp"));
comp.addUrl(URI.create("rmi://test.de/pdp"));
final IPolicyDecisionPoint pdp = ConnectorFactory.getPdp(comp, "http");
final IPolicyDecisionPoint pdp = ConnectorFactory.getPdp(comp, "http",null);
assertTrue(pdp instanceof TestPdpHttpConnector);
}
......@@ -89,7 +89,7 @@ public class ConnectorsPDPTest {
final Component comp = new Component(new ComponentId("urn:component:ind2uce:pdp:123"));
comp.addUrl(URI.create("tcp://test.de/pdp"));
final IPolicyDecisionPoint pdp = ConnectorFactory.getPdp(comp, null);
final IPolicyDecisionPoint pdp = ConnectorFactory.getPdp(comp, null,null);
assertNull(pdp);
}
......
......@@ -45,7 +45,7 @@ public class ConnectorsPIPTest {
comp.addUrl(URI.create("http://test.de/pip"));
comp.addUrl(URI.create("rmi://test.de/pip"));
final IPolicyInformationPoint pip = (IPolicyInformationPoint) ConnectorFactory.getComponent(comp,"http");
final IPolicyInformationPoint pip = (IPolicyInformationPoint) ConnectorFactory.getComponent(comp,"http",null);
assertTrue(pip instanceof TestPipHttpConnector);
}
......
......@@ -45,7 +45,7 @@ public class ConnectorsPMPTest {
comp.addUrl(URI.create("http://test.de/pmp"));
comp.addUrl(URI.create("rmi://test.de/pmp"));
final IPolicyManagementPoint pmp = (IPolicyManagementPoint) ConnectorFactory.getComponent(comp,"http");
final IPolicyManagementPoint pmp = (IPolicyManagementPoint) ConnectorFactory.getComponent(comp,"http",null);
assertTrue(pmp instanceof TestPmpHttpConnector);
}
......
......@@ -39,7 +39,7 @@ import java.util.List;
@XmlRootElement
@Connector(protocol = {
"test"
}, version = "3.0.21", type = ComponentType.PIP)
}, type = ComponentType.PIP)
public class CorruptedTestPipTestConnector implements IPolicyInformationPoint {
......
......@@ -31,10 +31,12 @@ import de.fraunhofer.iese.ind2uce.api.policy.AuthorizationDecision;
import de.fraunhofer.iese.ind2uce.api.policy.Event;
import de.fraunhofer.iese.ind2uce.api.policy.identifier.PolicyId;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.IOException;
import java.net.URI;
import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlRootElement;
/**
* @author Fraunhofer IESE
......@@ -42,7 +44,7 @@ import java.util.List;
@XmlRootElement
@Connector(protocol = {
"http", "https"
}, version = "3.0.21", type = ComponentType.PDP)
}, type = ComponentType.PDP)
public class TestPdpHttpConnector implements IPolicyDecisionPoint {
public TestPdpHttpConnector(URI uri) {
......@@ -157,4 +159,10 @@ public class TestPdpHttpConnector implements IPolicyDecisionPoint {
public String getHealth() throws IOException {
return "true";
}
@Override
public Map<Event, AuthorizationDecision> timerDecisionRequest(List<Event> events) throws IOException, EvaluationUndecidableException {
// TODO Auto-generated method stub
return null;
}
}
......@@ -31,10 +31,12 @@ import de.fraunhofer.iese.ind2uce.api.policy.AuthorizationDecision;
import de.fraunhofer.iese.ind2uce.api.policy.Event;
import de.fraunhofer.iese.ind2uce.api.policy.identifier.PolicyId;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.IOException;
import java.net.URI;
import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlRootElement;
/**
* @author Fraunhofer IESE
......@@ -42,7 +44,7 @@ import java.util.List;
@XmlRootElement
@Connector(protocol = {
"rmi"
}, version = "3.0.21", type = ComponentType.PDP)
}, type = ComponentType.PDP)
public class TestPdpRmiConnector implements IPolicyDecisionPoint {
public TestPdpRmiConnector(URI uri) {
......@@ -158,4 +160,10 @@ public class TestPdpRmiConnector implements IPolicyDecisionPoint {
return false;
}
@Override
public Map<Event, AuthorizationDecision> timerDecisionRequest(List<Event> events) throws IOException, EvaluationUndecidableException {
// TODO Auto-generated method stub
return null;
}
}
......@@ -40,7 +40,7 @@ import java.util.List;
@XmlRootElement
@Connector(protocol = {
"http", "https"
}, version = "3.0.21", type = ComponentType.PIP)
}, type = ComponentType.PIP)
public class TestPipHttpConnector implements IPolicyInformationPoint {
......
......@@ -40,7 +40,7 @@ import java.util.List;
@XmlRootElement
@Connector(protocol = {
"rmi"
}, version = "3.0.21", type = ComponentType.PIP)
}, type = ComponentType.PIP)
public class TestPipRMIConnector implements IPolicyInformationPoint {
......
......@@ -47,7 +47,7 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
@Connector(protocol = {
"http", "https"
}, version = "3.0.21", type = ComponentType.PMP)
}, type = ComponentType.PMP)
public class TestPmpHttpConnector implements IPolicyManagementPoint {
public TestPmpHttpConnector(URI uri) {
......@@ -61,7 +61,13 @@ public class TestPmpHttpConnector implements IPolicyManagementPoint {
}
@Override
public boolean addPolicy(String policy) throws IOException {
public boolean addPolicyString(String policy) throws IOException {
return false;
}
@Override
public boolean addPolicy(Policy policy) throws IOException {
return false;
}
......@@ -235,4 +241,9 @@ public class TestPmpHttpConnector implements IPolicyManagementPoint {
public List<EnforcementScopeId> getBlackListedSolutions() throws IOException {
return null;
}
@Override
public Integer getPmpHashcode() throws IOException {
return null;
}
}
......@@ -24,6 +24,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import de.fraunhofer.iese.ind2uce.api.component.exception.EvaluationUndecidableException;
import de.fraunhofer.iese.ind2uce.api.policy.InvalidPolicyException;
import de.fraunhofer.iese.ind2uce.api.policy.PolicyValidator;
import org.junit.BeforeClass;
......@@ -34,7 +35,6 @@ import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import java.io.IOException;
import java.net.URISyntaxException;
......@@ -66,13 +66,13 @@ public class PolicySchemaTest {
/** The expected. */
@Rule
public ExpectedException expected = ExpectedException.none();
/**
* Required because this test-class expects error-texts in englisch.
*/
@BeforeClass
public static void forceLanguageEN() {
Locale.setDefault(Locale.ENGLISH);
Locale.setDefault(Locale.ENGLISH);
}
/**
......@@ -82,20 +82,21 @@ public class PolicySchemaTest {
* @throws SAXException the SAX exception
* @throws IOException Signals that an I/O exception has occurred.
* @throws URISyntaxException the URI syntax exception
* @throws InvalidPolicyException
*/
@SuppressWarnings({
"unchecked", "rawtypes"
})
@Test
public void parameterBasicTests() throws EvaluationUndecidableException, SAXException, IOException, URISyntaxException {