01: package org.objectweb.salome_tmf.test.basic;
02:
03: import org.objectweb.salome_tmf.data.Campaign;
04: import org.objectweb.salome_tmf.data.Family;
05: import org.objectweb.salome_tmf.data.TestList;
06: import org.objectweb.salome_tmf.ihm.main.datawrapper.DataModel;
07: import org.objectweb.salome_tmf.test.common.SalomeProxy;
08:
09: public class CopyPasteBehaviorTest {
10:
11: final static String URL = "http://salome-tmf.rd.francetelecom.fr/www/salome-demo/salome_tmf/";
12: final static String USER = "marchemi";
13: final static String PROJECT = "salome-demo";
14:
15: final static String FAMILY_NAME = "Famille par defaut";
16: final static String TESTLIST_NAME = "Suite par defaut";
17: final static String CAMPAIGN_NAME = "c";
18:
19: public CopyPasteBehaviorTest() {
20: }
21:
22: public void run() {
23: try {
24: SalomeProxy pSalomeProxy = new SalomeProxy();
25: pSalomeProxy.connect(URL, USER, PROJECT);
26:
27: TestList tListCopy = copyPasteTestList(FAMILY_NAME,
28: TESTLIST_NAME);
29: Campaign campCopy = copyPasteCampaign(CAMPAIGN_NAME);
30: deleteTestList(tListCopy);
31: deleteCampaign(campCopy);
32:
33: pSalomeProxy.disconnect();
34: } catch (Exception e) {
35: e.printStackTrace();
36: }
37: }
38:
39: public TestList copyPasteTestList(String familyName,
40: String testListName) {
41: TestList tListCopy = null;
42: try {
43: Family pFamily = DataModel.getCurrentProject()
44: .getFamilyFromModel(familyName);
45: TestList pSuite = pFamily.getTestListInModel(testListName);
46: tListCopy = TestList.copieIn(pSuite, pFamily);
47: } catch (Exception e) {
48: e.printStackTrace();
49: }
50: return tListCopy;
51: }
52:
53: public Campaign copyPasteCampaign(String campaignName) {
54: Campaign campCopy = null;
55: try {
56: Campaign camp = DataModel.getCurrentProject()
57: .getCampaignFromModel(campaignName);
58: campCopy = Campaign.copieIn(camp, DataModel
59: .getCurrentUser());
60: } catch (Exception e) {
61: e.printStackTrace();
62: }
63: return campCopy;
64: }
65:
66: public void deleteTestList(TestList testList) {
67: try {
68: testList.getFamilyFromModel().deleteTestListInDBAndModel(
69: testList);
70: } catch (Exception e) {
71: e.printStackTrace();
72: }
73: }
74:
75: public void deleteCampaign(Campaign camp) {
76: try {
77: DataModel.getCurrentProject().deleteCampaignInDBAndModel(
78: camp);
79: } catch (Exception e) {
80: e.printStackTrace();
81: }
82: }
83:
84: public static void main(String[] args) {
85: CopyPasteBehaviorTest behavior = new CopyPasteBehaviorTest();
86: behavior.run();
87: }
88:
89: }
|