wlu: updated
diff --git a/org.eclipse.epf.library.tests/Libraries/1.0.0/TestCommands/newMethodElements/newActivities.tc b/org.eclipse.epf.library.tests/Libraries/1.0.0/TestCommands/newMethodElements/newActivities.tc
index 052ed76..3230035 100644
--- a/org.eclipse.epf.library.tests/Libraries/1.0.0/TestCommands/newMethodElements/newActivities.tc
+++ b/org.eclipse.epf.library.tests/Libraries/1.0.0/TestCommands/newMethodElements/newActivities.tc
@@ -4,11 +4,12 @@
<OpenLibrary libFolderName="newLib">
</OpenLibrary>
- <NewMethodElement
- type="MethodPlugin"
+ <NewMethodPlugin
name="Plug_A"
+ briefDescription="Brief desciption of Plug_A"
+ authors="Somebody"
>
- </NewMethodElement>
+ </NewMethodPlugin>
<NewMethodElement
type="MethodConfiguration"
@@ -29,7 +30,7 @@
<OutputLibrary disable="false" />
- <CompareToGoldenFile disable="true"
+ <CompareToGoldenFile disable="false"
goldenFileName="newMethodElements.xml"
diffCount="4"
elementCount="71"
diff --git a/org.eclipse.epf.library.tests/src/org/eclipse/epf/library/tester/TestCommandFileTest.java b/org.eclipse.epf.library.tests/src/org/eclipse/epf/library/tester/TestCommandFileTest.java
index 0ea3452..3b53d2c 100644
--- a/org.eclipse.epf.library.tests/src/org/eclipse/epf/library/tester/TestCommandFileTest.java
+++ b/org.eclipse.epf.library.tests/src/org/eclipse/epf/library/tester/TestCommandFileTest.java
@@ -48,8 +48,8 @@
"TestCommands",
"newMethodElements",
- "newMethodElements.tc"
- //"newActivities.tc"
+ //"newMethodElements.tc"
+ "newActivities.tc"
};
private QaTestService service = new QaTestService(new TestFolderSetup(), true);
diff --git a/org.eclipse.epf.library.tests/src/org/eclipse/epf/library/tester/TesterOutputUtil.java b/org.eclipse.epf.library.tests/src/org/eclipse/epf/library/tester/TesterOutputUtil.java
index 30d99b3..0700736 100644
--- a/org.eclipse.epf.library.tests/src/org/eclipse/epf/library/tester/TesterOutputUtil.java
+++ b/org.eclipse.epf.library.tests/src/org/eclipse/epf/library/tester/TesterOutputUtil.java
@@ -21,6 +21,7 @@
import org.eclipse.epf.uma.MethodElement;
import org.eclipse.epf.uma.MethodLibrary;
import org.eclipse.epf.uma.MethodPlugin;
+import org.eclipse.epf.uma.ProcessPackage;
/**
* Utility class for tester output manipulations
@@ -87,9 +88,31 @@
return getMethodConfiguration(lib, firstPath);
}
- public static MethodElement getBreakdownElementParent(MethodLibrary lib,
+ public static ProcessPackage getBreakdownElementParent(MethodLibrary lib,
String parentPath, String beName) {
- return null;
+ if (parentPath == null || parentPath.length() == 0) {
+ return null;
+ }
+ List paths = parseMethodElementPath(parentPath);
+ int sz = paths.size();
+ if (sz == 0) {
+ return null;
+ }
+ MethodElement me = getFirstMethodElement(lib, (String) paths.get(0));
+ if (me == null) {
+ return null;
+ }
+ for (int i=1; i<sz; i++) {
+ Map nameMap = getMethodElementNameMap(me.eContents());
+ me = (MethodElement) nameMap.get(paths.get(i));
+ if (me == null || i == sz - 1) {
+ break;
+ }
+ if (i > 2 && me instanceof ProcessPackage) {
+
+ }
+ }
+ return me instanceof ProcessPackage ? (ProcessPackage) me : null;
}
public static List parseMethodElementPath(String path) {
diff --git a/org.eclipse.epf.library.tests/src/org/eclipse/epf/library/tester/impl/testcommands/TCNewMethodElement.java b/org.eclipse.epf.library.tests/src/org/eclipse/epf/library/tester/impl/testcommands/TCNewMethodElement.java
index 18b4d45..d804bfa 100644
--- a/org.eclipse.epf.library.tests/src/org/eclipse/epf/library/tester/impl/testcommands/TCNewMethodElement.java
+++ b/org.eclipse.epf.library.tests/src/org/eclipse/epf/library/tester/impl/testcommands/TCNewMethodElement.java
@@ -26,6 +26,7 @@
import org.eclipse.epf.library.tester.iface.TCExeReply;
import org.eclipse.epf.library.tester.impl.TestCommandImpl;
import org.eclipse.epf.uma.BreakdownElement;
+import org.eclipse.epf.uma.CapabilityPattern;
import org.eclipse.epf.uma.ContentElement;
import org.eclipse.epf.uma.ContentPackage;
import org.eclipse.epf.uma.MethodConfiguration;
@@ -33,6 +34,8 @@
import org.eclipse.epf.uma.MethodLibrary;
import org.eclipse.epf.uma.MethodPackage;
import org.eclipse.epf.uma.MethodPlugin;
+import org.eclipse.epf.uma.ProcessComponent;
+import org.eclipse.epf.uma.ProcessPackage;
import org.eclipse.epf.uma.UmaFactory;
import org.eclipse.epf.uma.UmaPackage;
import org.eclipse.epf.uma.util.ContentDescriptionFactory;
@@ -86,7 +89,9 @@
if (reply != null && !reply.passing()) {
return reply;
}
-
+ if (true) {
+ return null;
+ }
return executeEdit(name, parentPath);
}
@@ -105,6 +110,9 @@
}
private TCExeReply addToLib(String parentPath, MethodElement me) {
+ if (me instanceof BreakdownElement) {
+ return addBeToLib(parentPath, (BreakdownElement) me);
+ }
MethodLibrary currLib = getOwner().getCurrentBaseLib();
MethodElement parentMe = TesterOutputUtil.getMethodElement(currLib, parentPath);
if (parentMe == null) {
@@ -118,13 +126,24 @@
return null;
}
- private TCExeReply addToLib(String parentPath, BreakdownElement be) {
+ private TCExeReply addBeToLib(String parentPath, BreakdownElement be) {
MethodLibrary currLib = getOwner().getCurrentBaseLib();
- MethodElement parentMe = TesterOutputUtil.getBreakdownElementParent(currLib, parentPath, be.getName());
+ ProcessPackage parentMe = TesterOutputUtil.getBreakdownElementParent(currLib, parentPath, be.getName());
if (parentMe == null) {
return new TCExeReplyImpl("parentMe == null", false);
- }
- addToParent(be, parentMe);
+ }
+ if (be instanceof CapabilityPattern) {
+ CapabilityPattern cp = (CapabilityPattern) be;
+ //cp.setDefaultContext(defaultConfig);
+
+ ProcessComponent pc = UmaFactory.eINSTANCE.createProcessComponent();
+ pc.setGuid(EcoreUtil.generateUUID());
+ pc.setName(be.getName());
+ parentMe.getChildPackages().add(pc);
+ pc.setProcess(cp);
+
+ addToParent(be, pc);
+ }
save(parentMe);