Commit 0a24958b authored by Daniel Ratiu's avatar Daniel Ratiu
Browse files

different improvements and fixes in the library

refs 694
parent 2b95d868
......@@ -15,12 +15,6 @@
provider="org.fortiss.af3.component.ui.prototypes.PrototypeProvider">
</modelPrototypeProvider>
</extension>
<extension
point="org.fortiss.tooling.kernel.modelPrototypeProvider">
<modelPrototypeProvider
provider="org.fortiss.af3.component.ui.prototypes.ComponentLibraryPrototypeProvider">
</modelPrototypeProvider>
</extension>
<extension
point="org.fortiss.tooling.kernel.ui.modelElementHandler">
......
......@@ -18,7 +18,6 @@ $Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $
package org.fortiss.af3.component.ui.library;
import static org.fortiss.af3.component.ui.utils.ComponentLibraryUIUtils.openLibraryComponentPackageDialog;
import static org.fortiss.af3.component.utils.ComponentLibraryUtils.addComponent;
import java.util.ArrayList;
import java.util.Collections;
......@@ -28,13 +27,11 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IContributionItem;
import org.fortiss.af3.component.library.ComponentLibraryManager;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.model.ComponentRef;
import org.fortiss.af3.component.model.LibraryComponentPackage;
import org.fortiss.af3.component.ui.AF3ComponentUIActivator;
import org.fortiss.af3.component.ui.prototypes.ComponentLibraryPrototypeProvider;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
import org.fortiss.tooling.kernel.service.IPersistencyService;
import org.fortiss.tooling.kernel.ui.extension.IContextMenuContributor;
import org.fortiss.tooling.kernel.ui.extension.data.ContextMenuContextProvider;
import org.fortiss.tooling.kernel.ui.service.IContextMenuService;
......@@ -93,15 +90,7 @@ public class AddComponentToLibrary implements IContextMenuContributor {
final LibraryComponentPackage pack = openLibraryComponentPackageDialog();
if(pack != null) {
final ITopLevelElement topLevel =
IPersistencyService.INSTANCE.getTopLevelElementFor(pack);
topLevel.runAsCommand(new Runnable() {
@Override
public void run() {
addComponent(pack, selectedComponent);
ComponentLibraryPrototypeProvider.refreshPrototypes();
}
});
ComponentLibraryManager.INSTANCE.addComponentToLibrary(pack, selectedComponent);
}
}
}
......
<!--
$Id: package.html 894 2011-07-07 07:36:03Z ratiu $
@version $Rev: 894 $
@ConQAT.Rating YELLOW Hash: 288761756EFB3C69A61AFACCA3019506
-->
<body>
This package contains actions for the components library.
</body>
......@@ -15,6 +15,7 @@ Export-Package: org.fortiss.af3.component,
org.fortiss.af3.component.generator.c,
org.fortiss.af3.component.generator.component,
org.fortiss.af3.component.library,
org.fortiss.af3.component.library.prototypes,
org.fortiss.af3.component.model,
org.fortiss.af3.component.model.behavior,
org.fortiss.af3.component.model.behavior.code,
......
......@@ -9,6 +9,13 @@
-->
<plugin>
<extension
point="org.fortiss.tooling.kernel.modelPrototypeProvider">
<modelPrototypeProvider
provider="org.fortiss.af3.component.library.prototypes.ComponentLibraryPrototypeProvider">
</modelPrototypeProvider>
</extension>
<extension point="org.eclipse.emf.ecore.generated_package">
<package
class="org.fortiss.af3.component.model.AF3ComponentPackage"
......
......@@ -19,28 +19,39 @@ package org.fortiss.af3.component.library;
import static org.eclipse.core.resources.ResourcesPlugin.getWorkspace;
import static org.fortiss.af3.component.utils.ComponentLibraryModelElementFactory.createLibraryComponentPackage;
import static org.fortiss.af3.component.utils.ComponentLibraryUtils.addComponent;
import static org.fortiss.af3.component.utils.ComponentLibraryUtils.findAllLibraryComponentPackagess;
import static org.fortiss.af3.project.utils.LibraryModelElementFactory.createFileLibrary;
import static org.fortiss.tooling.kernel.utils.EMFResourceUtils.createNewEclipseWorkspaceProject;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.util.EContentAdapter;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.fortiss.af3.component.library.prototypes.ComponentLibraryPrototypeProvider;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.model.ComponentRef;
import org.fortiss.af3.component.model.LibraryComponent;
import org.fortiss.af3.component.model.LibraryComponentPackage;
import org.fortiss.af3.component.utils.ComponentLibraryUtils;
import org.fortiss.af3.project.model.FileLibrary;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
import org.fortiss.tooling.kernel.model.ILibraryElementReference;
import org.fortiss.tooling.kernel.service.IPersistencyService;
/**
* The manager for components library.
......@@ -48,10 +59,16 @@ import org.fortiss.tooling.kernel.model.ILibraryElementReference;
* @author ratiu
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating RED Hash:
* @ConQAT.Rating YELLOW Hash: BAE7E12D7DC9E60D3C13B59FA50A851E
*/
public class ComponentLibraryManager {
/** The project location. */
public final static String PROJECT_LOCATION = "AF3-Project-Directory" + File.separator;
/** The library location. */
public final static String LIBRARY_LOCATION = "AF3-Lib";
/** The unique instance. */
public static ComponentLibraryManager INSTANCE = new ComponentLibraryManager();
......@@ -59,6 +76,13 @@ public class ComponentLibraryManager {
private HashMap<ILibraryElementReference, Boolean> componentRef2Dirty =
new HashMap<ILibraryElementReference, Boolean>();
/**
* The set of component references for which change adapters on the corresponding library
* objects were set.
*/
private HashSet<ComponentRef> componentReferencesWithRegisteredAdapters =
new HashSet<ComponentRef>();
/** Private constructor. */
private ComponentLibraryManager() {
createDefaultLibIfNoneExists();
......@@ -67,8 +91,24 @@ public class ComponentLibraryManager {
/** Creates the default library if it does not already exist. */
private void createDefaultLibIfNoneExists() {
IWorkspaceRoot workspaceRoot = getWorkspace().getRoot();
try {
IProject project = workspaceRoot.getProject(PROJECT_LOCATION);
IFolder folder = project.getFolder(LIBRARY_LOCATION);
if(!project.exists())
project.create(null);
if(!project.isOpen())
project.open(null);
if(!folder.exists()) {
folder.create(IResource.NONE, true, null);
}
} catch(CoreException e) {
e.printStackTrace();
}
IFile file =
workspaceRoot.getFile(new Path("AF3-Project-Directory/AF3-Lib/default.af3_lib"));
workspaceRoot.getFile(new Path(PROJECT_LOCATION + File.separator +
LIBRARY_LOCATION + File.separator + "default.af3_lib"));
if(!file.exists()) {
FileLibrary library = createFileLibrary("default-lib");
......@@ -86,34 +126,51 @@ public class ComponentLibraryManager {
/** Reinitializes the proxy of the component reference. */
public void reinitializeProxyOfComponentRef(final ComponentRef ref) {
LibraryComponent lc = findComponentInLibrary(ref.getProxyComponent().getName());
final LibraryComponent lc = findComponentInLibrary(ref.getUri());
if(lc == null) {
return;
}
Component c = lc.getComponent();
final ITopLevelElement topLevel = IPersistencyService.INSTANCE.getTopLevelElementFor(ref);
topLevel.runAsCommand(new Runnable() {
ref.getProxyComponent().getContainedElementsList().clear();
ref.getProxyComponent().getContainedElementsList().addAll(c.getContainedElementsList());
@Override
public void run() {
setDirty(ref, false);
Component copy = EcoreUtil.copy(lc.getComponent());
ref.setProxyComponent(copy);
// ref.getProxyComponent().getContainedElementsList().clear();
// ref.getProxyComponent().getContainedElementsList()
// .addAll(c.getContainedElementsList());
//
// ref.getProxyComponent().getSpecificationsList().clear();
// ref.getProxyComponent().getSpecificationsList().addAll(c.getSpecificationsList());
}
});
ref.getProxyComponent().getSpecificationsList().clear();
ref.getProxyComponent().getSpecificationsList().addAll(c.getSpecificationsList());
if(!componentReferencesWithRegisteredAdapters.contains(ref)) {
registerChangeObserverOnLibraryComponent(ref, lc);
componentReferencesWithRegisteredAdapters.add(ref);
}
}
/** Registers a changes observer on the library component. */
private void registerChangeObserverOnLibraryComponent(final ComponentRef ref,
final LibraryComponent lc) {
EContentAdapter adapter = new EContentAdapter() {
@Override
public void notifyChanged(Notification notification) {
super.notifyChanged(notification);
setDirty(ref, true);
}
};
ref.getProxyComponent().eAdapters().add(adapter);
lc.eAdapters().add(adapter);
}
/** Finds a component in the library. */
private LibraryComponent findComponentInLibrary(String uri) {
for(LibraryComponent c : getComponentsFromLibrary()) {
if(c.getName() != null && c.getName().equals(uri)) {
if(c.getUri().equals(uri)) {
return c;
}
}
......@@ -133,13 +190,26 @@ public class ComponentLibraryManager {
return libraryComponents;
}
/** Adds a component to the library. */
public void
addComponentToLibrary(final LibraryComponentPackage pack, final Component aComponent) {
final ITopLevelElement topLevel = IPersistencyService.INSTANCE.getTopLevelElementFor(pack);
topLevel.runAsCommand(new Runnable() {
@Override
public void run() {
addComponent(pack, aComponent);
ComponentLibraryPrototypeProvider.refreshPrototypes();
}
});
}
/** Returns true if the library reference is dirty. */
public boolean isDirty(ILibraryElementReference libRef) {
if(componentRef2Dirty.keySet().contains(libRef)) {
return componentRef2Dirty.get(libRef);
}
componentRef2Dirty.put(libRef, false);
return false;
componentRef2Dirty.put(libRef, true);
return true;
}
/** Sets the dirty flag for a library reference. */
......
<!--
$Id: package.html 2715 2012-01-09 16:50:31Z becker $
@version $Rev: 2715 $
@ConQAT.Rating YELLOW Hash: 174DA013B2F0AEB9F1E13B23B17532F7
-->
<body>
Package contains classes for dealing with the components library.
</body>
......@@ -15,7 +15,7 @@ $Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.component.library;
package org.fortiss.af3.component.library.prototypes;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.fortiss.af3.component.model.ComponentRef;
......@@ -27,7 +27,7 @@ import org.fortiss.tooling.kernel.extension.data.LibraryPrototype;
* @author ratiu
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating RED Hash:
* @ConQAT.Rating YELLOW Hash: 4E699EF6BFE4969D7F11BA6B3E6C8D1A
*/
public class ComponentLibraryPrototype extends LibraryPrototype {
......
......@@ -15,14 +15,13 @@ $Id: PrototypeProvider.java 5132 2012-07-26 09:28:45Z hoelzl $
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.component.ui.prototypes;
package org.fortiss.af3.component.library.prototypes;
import static org.fortiss.af3.component.utils.ComponentLibraryModelElementFactory.createComponentRef;
import static org.fortiss.af3.component.utils.ComponentLibraryModelElementFactory.createLibraryComponentPackage;
import org.eclipse.core.runtime.Assert;
import org.fortiss.af3.component.library.ComponentLibraryManager;
import org.fortiss.af3.component.library.ComponentLibraryPrototype;
import org.fortiss.af3.component.model.ComponentRef;
import org.fortiss.af3.component.model.LibraryComponent;
import org.fortiss.tooling.kernel.extension.IPrototypeProvider;
......@@ -34,7 +33,7 @@ import org.fortiss.tooling.kernel.extension.base.PrototypeProviderBase;
* @author hoelzl
* @author $Author: hoelzl $
* @version $Rev: 5132 $
* @ConQAT.Rating GREEN Hash: DBE43E48E67CBCA36DB5072711DB620C
* @ConQAT.Rating YELLOW Hash: 00965D354BA81868A382375097358C72
*/
public final class ComponentLibraryPrototypeProvider extends PrototypeProviderBase {
......
<!--
$Id: package.html 894 2011-07-07 07:36:03Z ratiu $
@version $Rev: 894 $
@ConQAT.Rating YELLOW Hash: 288761756EFB3C69A61AFACCA3019506
-->
<body>
This package contains prototypes for the components library.
</body>
......@@ -19,7 +19,6 @@ package org.fortiss.af3.component.utils;
import static org.eclipse.emf.ecore.util.EcoreUtil.copyAll;
import static org.fortiss.af3.component.utils.ComponentLibraryModelElementFactory.createLibraryComponent;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickFirstInstanceOf;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickInstanceOf;
import java.util.LinkedList;
......@@ -44,13 +43,13 @@ import org.fortiss.tooling.kernel.service.IPersistencyService;
* @author ratiu
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating RED Hash:
* @ConQAT.Rating YELLOW Hash: 30DFD168F433F6B0864FF1F97EE34AED
*/
public class ComponentLibraryUtils {
/** Returns the {@link LibraryComponentPackage} object from library. */
public static LibraryComponentPackage findLibraryComponentRoot(FileLibrary lib) {
return pickFirstInstanceOf(LibraryComponentPackage.class, lib.getRootElementsList());
public static List<LibraryComponentPackage> getLibraryComponentPackages(FileLibrary lib) {
return pickInstanceOf(LibraryComponentPackage.class, lib.getRootElementsList());
}
/** Returns all {@link LibraryComponentPackage} objects from library. */
......@@ -108,4 +107,25 @@ public class ComponentLibraryUtils {
return libs;
}
/** Returns a {@link FileLibrary} with a given name or null if it does not exist. */
public static FileLibrary findLibrary(String libraryName) {
for(FileLibrary lib : getAllLibrariesFromWorkspace()) {
if(lib.getName().equals(libraryName)) {
return lib;
}
}
return null;
}
/** Returns a {@link LibraryComponentPackage} with a given name or null if it does not exist. */
public static LibraryComponentPackage findLibraryComponentPackage(FileLibrary lib,
String packName) {
for(LibraryComponentPackage pack : getLibraryComponentPackages(lib)) {
if(pack.getName().equals(packName)) {
return pack;
}
}
return null;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<org-fortiss-af3-project:FileProject xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:org-fortiss-af3-component="http://www.fortiss.org/af3/component" xmlns:org-fortiss-af3-component-behavior-code="http://www.fortiss.org/af3/component/behavior/code" xmlns:org-fortiss-af3-expression="http://www.fortiss.org/af3/expression" xmlns:org-fortiss-af3-expression-terms="http://www.fortiss.org/af3/expression/terms" xmlns:org-fortiss-af3-expression-terms-imperative="http://www.fortiss.org/af3/expression/terms/imperative" xmlns:org-fortiss-af3-expression-types="http://www.fortiss.org/af3/expression/types" xmlns:org-fortiss-af3-mira="http://www.fortiss.org/af3/mira" xmlns:org-fortiss-af3-project="http://www.fortiss.org/af3/project" xmlns:org-fortiss-af3-project-configuration="http://www.fortiss.org/af3/project/configuration" xmlns:org-fortiss-af3-project-development="http://www.fortiss.org/af3/project/development" xmlns:org-fortiss-af3-sil="http://www.fortiss.org/af3/sil" xmlns:org-fortiss-tooling-base-model-layout="http://www.fortiss.org/tooling/base/model/layout" name="LibraryTests">
<rootElements xsi:type="org-fortiss-af3-project:ProjectConfiguration" id="1">
<configurationElements xsi:type="org-fortiss-af3-project-configuration:TypeSystemConfiguration" id="2">
<typesystem xsi:type="org-fortiss-af3-expression:MicroTypeSystem"/>
</configurationElements>
<configurationElements xsi:type="org-fortiss-af3-project-configuration:DevelopmentProcessConfiguration" id="3">
<development xsi:type="org-fortiss-af3-project-development:DummyDevelopmentProcess"/>
</configurationElements>
</rootElements>
<rootElements xsi:type="org-fortiss-af3-expression:DataDictionary" id="4"/>
<rootElements xsi:type="org-fortiss-af3-component:ComponentArchitecture" id="5" name="Component Architecture">
<containedElements xsi:type="org-fortiss-af3-component:Component" id="6" name="Component Architecture Root" comment="">
<containedElements xsi:type="org-fortiss-af3-component:Component" id="8" name="Div" comment="">
<specifications xsi:type="org-fortiss-af3-component:CausalityComponentSpecification"/>
<specifications xsi:type="org-fortiss-af3-sil:SILLevel"/>
<specifications xsi:type="org-fortiss-af3-component-behavior-code:CodeSpecification">
<body>
<statements xsi:type="org-fortiss-af3-expression-terms-imperative:Assignment">
<variable identifier="Out"/>
<value xsi:type="org-fortiss-af3-expression-terms:FunctionCall">
<function xsi:type="org-fortiss-af3-expression-terms:PredefinedFunction" operator="Divide"/>
<arguments xsi:type="org-fortiss-af3-expression-terms:Var" identifier="In1"/>
<arguments xsi:type="org-fortiss-af3-expression-terms:Var" identifier="In2"/>
</value>
</statements>
</body>
</specifications>
<connectors xsi:type="org-fortiss-af3-component:InputPort" id="9" name="In1" comment="">
<specifications xsi:type="org-fortiss-af3-component:PortSpecification">
<type xsi:type="org-fortiss-af3-expression-types:TInt"/>
<initialValue xsi:type="org-fortiss-af3-expression-terms:IntConst"/>
</specifications>
<layoutData xsi:type="org-fortiss-tooling-base-model-layout:Point" key="pos"/>
<layoutData xsi:type="org-fortiss-tooling-base-model-layout:Dimension" key="dim" width="108" height="72"/>
<layoutData xsi:type="org-fortiss-tooling-base-model-layout:Point" key="cpos"/>
<layoutData xsi:type="org-fortiss-tooling-base-model-layout:Dimension" key="cdim" width="0" height="0"/>
<layoutData xsi:type="org-fortiss-tooling-base-model-layout:OffsetOrientation" key="coffsetorient" offset="24" orientation="WEST"/>
</connectors>
<connectors xsi:type="org-fortiss-af3-component:InputPort" id="10" name="In2" comment="">
<specifications xsi:type="org-fortiss-af3-component:PortSpecification">
<type xsi:type="org-fortiss-af3-expression-types:TInt"/>
<initialValue xsi:type="org-fortiss-af3-expression-terms:IntConst"/>
</specifications>
<layoutData xsi:type="org-fortiss-tooling-base-model-layout:Point" key="pos"/>
<layoutData xsi:type="org-fortiss-tooling-base-model-layout:Dimension" key="dim" width="108" height="72"/>
<layoutData xsi:type="org-fortiss-tooling-base-model-layout:Point" key="cpos"/>
<layoutData xsi:type="org-fortiss-tooling-base-model-layout:Dimension" key="cdim" width="0" height="0"/>
<layoutData xsi:type="org-fortiss-tooling-base-model-layout:OffsetOrientation" key="coffsetorient" offset="60" orientation="WEST"/>
</connectors>
<connectors xsi:type="org-fortiss-af3-component:OutputPort" id="11" name="Out" comment="">
<specifications xsi:type="org-fortiss-af3-component:PortSpecification">
<type xsi:type="org-fortiss-af3-expression-types:TInt"/>
<initialValue xsi:type="org-fortiss-af3-expression-terms:IntConst"/>
</specifications>
<layoutData xsi:type="org-fortiss-tooling-base-model-layout:Point" key="pos"/>
<layoutData xsi:type="org-fortiss-tooling-base-model-layout:Dimension" key="dim" width="108" height="72"/>
<layoutData xsi:type="org-fortiss-tooling-base-model-layout:Point" key="cpos"/>
<layoutData xsi:type="org-fortiss-tooling-base-model-layout:Dimension" key="cdim" width="0" height="0"/>
<layoutData xsi:type="org-fortiss-tooling-base-model-layout:OffsetOrientation" key="coffsetorient" offset="36" orientation="EAST"/>
</connectors>
<layoutData xsi:type="org-fortiss-tooling-base-model-layout:Point" key="pos" x="120" y="48"/>
<layoutData xsi:type="org-fortiss-tooling-base-model-layout:Dimension" key="dim" width="193" height="97"/>
</containedElements>
<specifications xsi:type="org-fortiss-af3-component:CausalityComponentSpecification"/>
<specifications xsi:type="org-fortiss-af3-sil:SILLevel"/>
<layoutData xsi:type="org-fortiss-tooling-base-model-layout:Point" key="pos"/>
<layoutData xsi:type="org-fortiss-tooling-base-model-layout:Dimension" key="dim" width="108" height="72"/>
</containedElements>
</rootElements>
<rootElements xsi:type="org-fortiss-af3-mira:Analysis" id="7"/>
</org-fortiss-af3-project:FileProject>
/*--------------------------------------------------------------------------+
$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $
| |
| Copyright 2012 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package test.org.fortiss.af3.component.library;
import java.io.IOException;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.fortiss.af3.project.model.FileLibrary;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
import org.fortiss.tooling.kernel.service.IPersistencyService;
/**
* Base class for library tests.
*
* @author ratiu
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating YELLOW Hash: ABC829606E12F6649A002DD511192311
*/
public class LibraryTestBase {
/** Saves the library. */
protected void saveLibrary(FileLibrary lib) {
final ITopLevelElement topLevel = IPersistencyService.INSTANCE.getTopLevelElementFor(lib);
try {
topLevel.doSave(new NullProgressMonitor());
} catch(CoreException e) {
e.printStackTrace();
} catch(IOException e) {
e.printStackTrace();
}
}
}
/*--------------------------------------------------------------------------+
$Id: SmokeSatisfiabilityCheckerTest.java 5720 2012-10-14 21:48:12Z ratiu $
| |
| Copyright 2011 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package test.org.fortiss.af3.component.library;
import static org.fortiss.af3.component.utils.BehaviorUtils.getCodeSpecification;
import static org.fortiss.af3.component.utils.ComponentArchitectureUtils.findComponentArchitecture;
import static org.fortiss.af3.component.utils.ComponentArchitectureUtils.findSubComponent;
import static org.fortiss.af3.component.utils.ComponentLibraryUtils.findLibrary;
import static org.fortiss.af3.component.utils.ComponentLibraryUtils.findLibraryComponentPackage;
import static org.fortiss.tooling.kernel.utils.PrototypesUtils.findPrototypeComposableWith;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.fortiss.af3.component.AF3ComponentActivator;
import org.fortiss.af3.component.library.ComponentLibraryManager;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.model.ComponentArchitecture;
import org.fortiss.af3.component.model.ComponentRef;
import org.fortiss.af3.component.model.LibraryComponent;
import org.fortiss.af3.component.model.LibraryComponentPackage;
import org.fortiss.af3.component.model.behavior.code.CodeSpecification;
import org.fortiss.af3.project.model.FileLibrary;
import org.fortiss.af3.project.model.FileProject;
import org.fortiss.af3.project.utils.ProjectUtils;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
import org.fortiss.tooling.kernel.extension.data.Prototype;
import org.fortiss.tooling.kernel.service.IPersistencyService;
import org.junit.Before;
import org.junit.Test;
/**
* Tests the components library management. Test data is taken from the model
* "test-data/SatisfiabilityCheckerTests.af3_20"
*
* @author ratiu