/******************************************************************************* | |
* <copyright> | |
* | |
* Copyright (c) 2013, 2013 SAP AG. | |
* All rights reserved. This program and the accompanying materials | |
* are made available under the terms of the Eclipse Public License v1.0 | |
* which accompanies this distribution, and is available at | |
* http://www.eclipse.org/legal/epl-v10.html | |
* | |
* Contributors: | |
* SAP AG - initial API, implementation and documentation | |
* | |
* </copyright> | |
* | |
*******************************************************************************/ | |
package org.eclipse.fmc; | |
import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_BI_ACCESS_FF; | |
import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_BI_ACCESS_MH; | |
import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_BI_COMM_CH_FF; | |
import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_BI_COMM_CH_MH; | |
import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_DOTS_FF; | |
import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_DOTS_MH; | |
import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_MODIFY_ACCESS; | |
import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_REQRESP_COMM_CH_FF; | |
import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_REQRESP_COMM_CH_MH; | |
import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_UNI_ACCESS_FF; | |
import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_UNI_ACCESS_MH; | |
import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_UNI_COMM_CH_FF; | |
import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_CON_UNI_COMM_CH_MH; | |
import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_AGENT; | |
import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_STORAGE; | |
import static org.eclipse.fmc.blockdiagram.editor.diagram.BlockDiagramFeatureProvider.CREATE_FEATURE_STRUCTURE_VARIANCE; | |
import static org.junit.Assert.assertEquals; | |
import static org.junit.Assert.assertNotNull; | |
import org.eclipse.graphiti.mm.pictograms.Connection; | |
import org.eclipse.graphiti.mm.pictograms.ContainerShape; | |
import org.eclipse.graphiti.mm.pictograms.Shape; | |
import org.junit.Test; | |
public class ConnectionTest extends FMCTestCase { | |
@Test | |
public void testUnidirectionalAccessMH() { | |
Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10); | |
Shape storage = createShape(CREATE_FEATURE_STORAGE, 100, 100, 200, 10); | |
Connection connection = createConnection(CREATE_CON_UNI_ACCESS_MH, | |
agent, storage); | |
assertNotNull(connection); | |
} | |
@Test | |
public void testUnidirectionalAccessFF() { | |
Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10); | |
Shape storage = createShape(CREATE_FEATURE_STORAGE, 100, 100, 200, 10); | |
Connection connection = createConnection(CREATE_CON_UNI_ACCESS_FF, | |
agent, storage); | |
assertNotNull(connection); | |
} | |
@Test | |
public void testBidirectionalAccessMH() { | |
Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10); | |
Shape storage = createShape(CREATE_FEATURE_STORAGE, 100, 100, 200, 10); | |
Connection connection = createConnection(CREATE_CON_BI_ACCESS_MH, | |
agent, storage); | |
assertNotNull(connection); | |
} | |
@Test | |
public void testBidirectionalAccessFF() { | |
Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10); | |
Shape storage = createShape(CREATE_FEATURE_STORAGE, 100, 100, 200, 10); | |
Connection connection = createConnection(CREATE_CON_BI_ACCESS_FF, | |
agent, storage); | |
assertNotNull(connection); | |
} | |
@Test | |
public void testModifyAccess() { | |
Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10); | |
Shape storage = createShape(CREATE_FEATURE_STORAGE, 100, 100, 200, 10); | |
Connection connection = createConnection(CREATE_CON_MODIFY_ACCESS, | |
agent, storage); | |
assertNotNull(connection); | |
} | |
@Test | |
public void testBidirectionalComChannelMH() { | |
Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10); | |
Shape agent2 = createShape(CREATE_FEATURE_AGENT, 100, 100, 200, 10); | |
Connection connection = createConnection(CREATE_CON_BI_COMM_CH_MH, | |
agent, agent2); | |
assertNotNull(connection); | |
} | |
@Test | |
public void testBidirectionalComChannelFF() { | |
Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10); | |
Shape agent2 = createShape(CREATE_FEATURE_AGENT, 100, 100, 200, 10); | |
Connection connection = createConnection(CREATE_CON_BI_COMM_CH_FF, | |
agent, agent2); | |
assertNotNull(connection); | |
} | |
@Test | |
public void testUnidirectionalComChannelMH() { | |
Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10); | |
Shape agent2 = createShape(CREATE_FEATURE_AGENT, 100, 100, 200, 10); | |
Connection connection = createConnection(CREATE_CON_UNI_COMM_CH_MH, | |
agent, agent2); | |
assertNotNull(connection); | |
} | |
@Test | |
public void testUnidirectionalComChannelFF() { | |
Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10); | |
Shape agent2 = createShape(CREATE_FEATURE_AGENT, 100, 100, 200, 10); | |
Connection connection = createConnection(CREATE_CON_UNI_COMM_CH_FF, | |
agent, agent2); | |
assertNotNull(connection); | |
} | |
@Test | |
public void testReqResComChannelMH() { | |
Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10); | |
Shape agent2 = createShape(CREATE_FEATURE_AGENT, 100, 100, 200, 10); | |
Connection connection = createConnection(CREATE_CON_REQRESP_COMM_CH_MH, | |
agent, agent2); | |
assertNotNull(connection); | |
} | |
@Test | |
public void testReqResComChannelFF() { | |
Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10); | |
Shape agent2 = createShape(CREATE_FEATURE_AGENT, 100, 100, 200, 10); | |
Connection connection = createConnection(CREATE_CON_REQRESP_COMM_CH_FF, | |
agent, agent2); | |
assertNotNull(connection); | |
} | |
@Test | |
public void testDotsMH() { | |
Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10); | |
Shape agent2 = createShape(CREATE_FEATURE_AGENT, 100, 100, 200, 10); | |
Connection connection = createConnection(CREATE_CON_DOTS_MH, agent, | |
agent2); | |
assertNotNull(connection); | |
} | |
@Test | |
public void testDotsMHWithoutTarget() { | |
Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10); | |
Connection connection = createConnection(CREATE_CON_DOTS_MH, agent, | |
getDiagram()); | |
assertEquals("Source Agent and invisible shape expected", 2, | |
getDiagram().getChildren().size()); | |
assertNotNull(connection); | |
remove(connection); | |
} | |
@Test | |
public void testDotsFF() { | |
Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10); | |
Shape agent2 = createShape(CREATE_FEATURE_AGENT, 100, 100, 200, 10); | |
Connection connection = createConnection(CREATE_CON_DOTS_FF, agent, | |
agent2); | |
assertNotNull(connection); | |
} | |
@Test | |
public void testDotsFFWithoutTarget() { | |
Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10); | |
Connection connection = createConnection(CREATE_CON_DOTS_FF, agent, | |
getDiagram()); | |
assertEquals("Source Agent and invisible shape expected", 2, | |
getDiagram().getChildren().size()); | |
assertNotNull(connection); | |
remove(connection); | |
} | |
@Test | |
public void testContainerRemove() { | |
ContainerShape container = (ContainerShape) createShape( | |
CREATE_FEATURE_AGENT, 400, 400, 10, 10); | |
Shape anotherShape = createShape(CREATE_FEATURE_AGENT, 400, 400, 10, 10); | |
ContainerShape container2 = (ContainerShape) createShapeInShape( | |
CREATE_FEATURE_AGENT, 200, 200, 110, 110, container); | |
Shape child = createShapeInShape(CREATE_FEATURE_AGENT, 50, 50, 130, | |
130, container2); | |
Connection connection = createConnection(CREATE_CON_BI_COMM_CH_MH, | |
child, anotherShape); | |
assertNotNull(connection); | |
remove(container); | |
} | |
@Test | |
public void testConnectToStructureVariance() { | |
Shape agent = createShape(CREATE_FEATURE_AGENT, 100, 100, 10, 10); | |
Shape strv = createShape(CREATE_FEATURE_STRUCTURE_VARIANCE, 100, 100, | |
200, 10); | |
Connection connection = createConnection(CREATE_CON_UNI_ACCESS_FF, | |
agent, strv); | |
assertNotNull(connection); | |
} | |
} |