Skip to content

Commit

Permalink
Renaming KnowledgePathUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
Michał Kit committed Nov 6, 2013
1 parent c5276d9 commit ad175fd
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void setUp() {
public void testUpdateIntegerField() throws Exception {
// WHEN the update method is called on the KnowledgeManager
// and as a ChangeSet, the update for the 'number' field is passed
KnowledgePath kp = KnowledgePathUtils.createKnowledgePath("number");
KnowledgePath kp = RuntimeModelHelper.createKnowledgePath("number");
List<KnowledgePath> knowledgePaths = new LinkedList<>();
knowledgePaths.add(kp);

Expand All @@ -60,7 +60,7 @@ public void testUpdateIntegerField() throws Exception {
public void testInnerKnowledgeUpdate() throws Exception {
// WHEN the update method is called on the KnowledgeManager
// and as a ChangeSet, the update for some nested inner field is passed
KnowledgePath kp = KnowledgePathUtils.createKnowledgePath(
KnowledgePath kp = RuntimeModelHelper.createKnowledgePath(
"innerKnowledge", "a");
List<KnowledgePath> knowledgePaths = new LinkedList<>();
knowledgePaths.add(kp);
Expand All @@ -79,7 +79,7 @@ public void testInnerKnowledgeUpdate() throws Exception {
public void testUpdateListField() throws Exception {
// WHEN the update method is called on the KnowledgeManager
// and as a ChangeSet, the update for one of the 'list' items is passed
KnowledgePath kp = KnowledgePathUtils.createKnowledgePath("list", "2");
KnowledgePath kp = RuntimeModelHelper.createKnowledgePath("list", "2");
List<KnowledgePath> knowledgePaths = new LinkedList<>();
knowledgePaths.add(kp);

Expand All @@ -97,7 +97,7 @@ public void testUpdateListField() throws Exception {
public void testUpdateMapField() throws Exception {
// WHEN the update method is called on the KnowledgeManager
// and as a ChangeSet, the update for one of the 'map' items is passed
KnowledgePath kp = KnowledgePathUtils.createKnowledgePath("map", "a");
KnowledgePath kp = RuntimeModelHelper.createKnowledgePath("map", "a");
List<KnowledgePath> knowledgePaths = new LinkedList<>();
knowledgePaths.add(kp);

Expand All @@ -115,11 +115,11 @@ public void testUpdateMapField() throws Exception {
public void testRemovalFromList() throws Exception {
// WHEN the update method is called on the KnowledgeManager
// and as a ChangeSet, the removal of one of the 'list' items is passed
KnowledgePath kp = KnowledgePathUtils.createKnowledgePath("list", "2");
KnowledgePath kp = RuntimeModelHelper.createKnowledgePath("list", "2");
List<KnowledgePath> knowledgePaths = new LinkedList<>();
knowledgePaths.add(kp);
Object nextItemValue = toBeTested.get(knowledgePaths).getValue(kp);
kp = KnowledgePathUtils.createKnowledgePath("list", "1");
kp = RuntimeModelHelper.createKnowledgePath("list", "1");
knowledgePaths.clear();
knowledgePaths.add(kp);

Expand All @@ -138,7 +138,7 @@ public void testDeleteFromMap() throws Exception {
// WHEN the update method is called on the KnowledgeManager
// and as a ChangeSet, the removal of one of the 'map' elements is
// passed
KnowledgePath kp = KnowledgePathUtils.createKnowledgePath("map", "a");
KnowledgePath kp = RuntimeModelHelper.createKnowledgePath("map", "a");
List<KnowledgePath> knowledgePaths = new LinkedList<>();
knowledgePaths.add(kp);

Expand All @@ -154,7 +154,7 @@ public void testDeleteFromMap() throws Exception {
@Test
public void testGetIntegerField() throws Exception {
// WHEN a field is accessed from the ReadOnlyKnowledgeManager
KnowledgePath kp = KnowledgePathUtils.createKnowledgePath("number");
KnowledgePath kp = RuntimeModelHelper.createKnowledgePath("number");
List<KnowledgePath> knowledgePaths = new LinkedList<>();
knowledgePaths.add(kp);

Expand All @@ -166,7 +166,7 @@ public void testGetIntegerField() throws Exception {
@Test
public void testInnerKnowledgeGet() throws Exception {
// WHEN inner knowledge is accessed from the ReadOnlyKnowledgeManager
KnowledgePath kp = KnowledgePathUtils.createKnowledgePath(
KnowledgePath kp = RuntimeModelHelper.createKnowledgePath(
"innerKnowledge", "a");

List<KnowledgePath> knowledgePaths = new LinkedList<>();
Expand All @@ -182,7 +182,7 @@ public void testNullBaseKnowledgeAccess() throws Exception {
toBeTested = new BaseKnowledgeManager();
// WHEN a field is accessed from the knowledge manager initialized with
// null base knowledge
KnowledgePath kp = KnowledgePathUtils.createKnowledgePath("number");
KnowledgePath kp = RuntimeModelHelper.createKnowledgePath("number");
List<KnowledgePath> knowledgePaths = new LinkedList<>();
knowledgePaths.add(kp);
// THEN exception is thrown.
Expand All @@ -192,7 +192,7 @@ public void testNullBaseKnowledgeAccess() throws Exception {
@Test
public void testGetListField() throws Exception {
// WHEN an item of a list is accessed from the ReadOnlyKnowledgeManager
KnowledgePath kp = KnowledgePathUtils.createKnowledgePath("list", "2");
KnowledgePath kp = RuntimeModelHelper.createKnowledgePath("list", "2");
List<KnowledgePath> knowledgePaths = new LinkedList<>();
knowledgePaths.add(kp);

Expand All @@ -205,7 +205,7 @@ public void testGetListField() throws Exception {
public void testGetMapField() throws Exception {
// WHEN an element of a map is accessed from the
// ReadOnlyKnowledgeManager
KnowledgePath kp = KnowledgePathUtils.createKnowledgePath("map", "a");
KnowledgePath kp = RuntimeModelHelper.createKnowledgePath("map", "a");
List<KnowledgePath> knowledgePaths = new LinkedList<>();
knowledgePaths.add(kp);

Expand All @@ -218,7 +218,7 @@ public void testGetMapField() throws Exception {
public void testNotExsistentAccess() throws Exception {
// WHEN a not existent entry is accessed from the
// ReadOnlyKnowledgeManager
KnowledgePath kp = KnowledgePathUtils.createKnowledgePath("dummy");
KnowledgePath kp = RuntimeModelHelper.createKnowledgePath("dummy");
List<KnowledgePath> knowledgePaths = new LinkedList<>();
knowledgePaths.add(kp);

Expand All @@ -230,8 +230,8 @@ public void testNotExsistentAccess() throws Exception {
@Test
public void testRegisterListener() {
// WHEN a listener is registered at the KnowledgeManager
KnowledgePath kp = KnowledgePathUtils.createKnowledgePath("number");
KnowledgeChangeTrigger trigger = KnowledgePathUtils
KnowledgePath kp = RuntimeModelHelper.createKnowledgePath("number");
KnowledgeChangeTrigger trigger = RuntimeModelHelper
.createKnowledgeChangeTrigger();
trigger.setKnowledgePath(kp);
toBeTested.register(trigger, triggerListener);
Expand All @@ -247,8 +247,8 @@ public void testRegisterListener() {
@Test
public void testUnregisterListener() {
// WHEN a previously registered listener
KnowledgePath kp = KnowledgePathUtils.createKnowledgePath("number");
KnowledgeChangeTrigger trigger = KnowledgePathUtils
KnowledgePath kp = RuntimeModelHelper.createKnowledgePath("number");
KnowledgeChangeTrigger trigger = RuntimeModelHelper
.createKnowledgeChangeTrigger();
trigger.setKnowledgePath(kp);
toBeTested.register(trigger, triggerListener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void setUp() {
@Test
public void testImmutabilityOfGet() throws Exception {
// WHEN a list is accessed from the ClonningKnowledgeManager
KnowledgePath kp = KnowledgePathUtils.createKnowledgePath("list");
KnowledgePath kp = RuntimeModelHelper.createKnowledgePath("list");
List<KnowledgePath> knowledgePaths = new LinkedList<>();
knowledgePaths.add(kp);
ValueSet result = toBeTested.get(knowledgePaths);
Expand All @@ -46,7 +46,7 @@ public void testImmutabilityOfGet() throws Exception {
@Test
public void testImmutabilityOfUpdate() throws Exception {
// WHEN a list is inserted into the ClonningKnowledgeManager
KnowledgePath kp = KnowledgePathUtils.createKnowledgePath("list");
KnowledgePath kp = RuntimeModelHelper.createKnowledgePath("list");
List<KnowledgePath> knowledgePaths = new LinkedList<>();
knowledgePaths.add(kp);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @author Michal Kit <kit@d3s.mff.cuni.cz>
*
*/
public class KnowledgePathUtils {
public class RuntimeModelHelper {

public static KnowledgePath createKnowledgePath(
String... knowledgePathNodes) {
Expand Down Expand Up @@ -44,7 +44,7 @@ public static KnowledgeChangeTrigger createKnowledgeChangeTrigger(
RuntimeMetadataFactory factory = RuntimeMetadataFactory.eINSTANCE;
KnowledgeChangeTrigger trigger = factory.createKnowledgeChangeTrigger();

trigger.setKnowledgePath(KnowledgePathUtils
trigger.setKnowledgePath(RuntimeModelHelper
.createKnowledgePath(knowledgePathNodes));

return trigger;
Expand All @@ -56,7 +56,7 @@ public static Parameter createParameter(ParameterDirection direction,
Parameter param = factory.createParameter();

param.setDirection(direction);
param.setKnowledgePath(KnowledgePathUtils
param.setKnowledgePath(RuntimeModelHelper
.createKnowledgePath(knowledgePathNodes));

return param;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package cz.cuni.mff.d3s.deeco.model.runtime;

import static cz.cuni.mff.d3s.deeco.knowledge.KnowledgePathUtils.createKnowledgeChangeTrigger;
import static cz.cuni.mff.d3s.deeco.knowledge.KnowledgePathUtils.createParameter;
import static cz.cuni.mff.d3s.deeco.knowledge.KnowledgePathUtils.createPeriodicTrigger;
import static cz.cuni.mff.d3s.deeco.knowledge.RuntimeModelHelper.createKnowledgeChangeTrigger;
import static cz.cuni.mff.d3s.deeco.knowledge.RuntimeModelHelper.createParameter;
import static cz.cuni.mff.d3s.deeco.knowledge.RuntimeModelHelper.createPeriodicTrigger;
import cz.cuni.mff.d3s.deeco.knowledge.KnowledgeManager;
import cz.cuni.mff.d3s.deeco.knowledge.KnowledgeManagersView;
import cz.cuni.mff.d3s.deeco.model.runtime.api.ComponentInstance;
Expand Down

0 comments on commit ad175fd

Please sign in to comment.