001: /***************************************************************
002: * This file is part of the [fleXive](R) project.
003: *
004: * Copyright (c) 1999-2008
005: * UCS - unique computing solutions gmbh (http://www.ucs.at)
006: * All rights reserved
007: *
008: * The [fleXive](R) project is free software; you can redistribute
009: * it and/or modify it under the terms of the GNU General Public
010: * License as published by the Free Software Foundation;
011: * either version 2 of the License, or (at your option) any
012: * later version.
013: *
014: * The GNU General Public License can be found at
015: * http://www.gnu.org/copyleft/gpl.html.
016: * A copy is found in the textfile GPL.txt and important notices to the
017: * license from the author are found in LICENSE.txt distributed with
018: * these libraries.
019: *
020: * This library is distributed in the hope that it will be useful,
021: * but WITHOUT ANY WARRANTY; without even the implied warranty of
022: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
023: * GNU General Public License for more details.
024: *
025: * For further information about UCS - unique computing solutions gmbh,
026: * please see the company website: http://www.ucs.at
027: *
028: * For further information about [fleXive](R), please see the
029: * project website: http://www.flexive.org
030: *
031: *
032: * This copyright notice MUST APPEAR in all copies of the file!
033: ***************************************************************/package com.flexive.tests.embedded.structure;
034:
035: import com.flexive.shared.CacheAdmin;
036: import com.flexive.shared.EJBLookup;
037: import com.flexive.shared.FxLanguage;
038: import com.flexive.shared.exceptions.*;
039: import com.flexive.shared.interfaces.ACLEngine;
040: import com.flexive.shared.interfaces.AssignmentEngine;
041: import com.flexive.shared.interfaces.TypeEngine;
042: import com.flexive.shared.security.ACL;
043: import com.flexive.shared.security.Mandator;
044: import com.flexive.shared.structure.*;
045: import com.flexive.shared.value.FxString;
046: import static com.flexive.tests.embedded.FxTestUtils.login;
047: import static com.flexive.tests.embedded.FxTestUtils.logout;
048: import com.flexive.tests.embedded.TestUsers;
049: import org.testng.Assert;
050: import org.testng.annotations.AfterClass;
051: import org.testng.annotations.BeforeClass;
052: import org.testng.annotations.Test;
053:
054: import javax.naming.Context;
055: import javax.naming.InitialContext;
056: import javax.transaction.UserTransaction;
057:
058: /**
059: * Structure tests
060: *
061: * @author Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
062: */
063: @Test(groups={"ejb","structure"})
064: public class StructureTest {
065:
066: private TypeEngine te;
067: private AssignmentEngine ae;
068: private ACLEngine acl;
069:
070: @BeforeClass
071: public void beforeClass() throws FxLookupException,
072: FxLoginFailedException, FxAccountInUseException {
073: System.out.println("setting up structure test");
074: te = EJBLookup.getTypeEngine();
075: ae = EJBLookup.getAssignmentEngine();
076: acl = EJBLookup.getACLEngine();
077: login(TestUsers.SUPERVISOR);
078: }
079:
080: @AfterClass
081: public void afterClass() throws Exception {
082: try {
083: te.remove(CacheAdmin.getEnvironment().getType(
084: "ContactsTest").getId());
085: } catch (FxRuntimeException e) {
086: // ignore
087: }
088: try {
089: ae.removeAssignment(CacheAdmin.getEnvironment()
090: .getAssignment("ROOT/CONTACT_DATA").getId(), true,
091: false);
092: } catch (FxRuntimeException e) {
093: // ignore
094: }
095: try {
096: acl.remove(CacheAdmin.getEnvironment().getACL(
097: "ContactsTest").getId());
098: } catch (FxRuntimeException e) {
099: // ignore
100: }
101: logout();
102: }
103:
104: @Test(invocationCount=2)
105: public void typeCreateDeleteUpdate() throws Exception {
106: long testId = -1;
107: try {
108: testId = te.save(FxTypeEdit.createNew(
109: "TestCD",
110: new FxString("description..."),
111: CacheAdmin.getEnvironment().getACL(
112: ACL.Category.STRUCTURE.getDefaultId()),
113: null).setCheckValidity(false));
114: // testId = te.create(1, 1, 1, new ArrayList<Mandator>(2), "TestCD",
115: // new FxString("description..."), null, false,
116: // TypeStorageMode.Hierarchical, TypeCategory.User, TypeMode.Content,
117: // true, LanguageMode.Multiple, TypeState.Available, (byte) 0, true, 0, 0, 0, 0);
118: FxString desc = new FxString("Test data structure");
119: desc.setTranslation(FxLanguage.GERMAN,
120: "Testdaten Strukturen");
121: FxString hint = new FxString("Hint text ...");
122: FxGroupEdit ge = FxGroupEdit.createNew("TEST_DIRECT_DATA",
123: desc, hint, true, new FxMultiplicity(0, 1));
124: ae.createGroup(testId, ge, "/");
125: ACL structACL = null;
126: for (ACL a : CacheAdmin.getEnvironment().getACLs())
127: if (a.getCategory() == ACL.Category.STRUCTURE) {
128: structACL = a;
129: break;
130: }
131: assert structACL != null : "No available ACL for structure found!";
132: FxPropertyEdit pe = FxPropertyEdit.createNew(
133: "TestDirectProperty1", desc, hint, true,
134: new FxMultiplicity(0, 1), true, structACL,
135: FxDataType.String1024,
136: new FxString(FxString.EMPTY), true, null, null,
137: null);
138: ae.createProperty(testId, pe, "/");
139: pe.setName("TestDirectProperty2");
140: pe.setDataType(FxDataType.String1024);
141: pe.setMultiplicity(new FxMultiplicity(1, 1));
142: ae.createProperty(testId, pe, "/");
143: pe.setName("TestDirectProperty3");
144: pe.setDataType(FxDataType.String1024);
145: pe.setMultiplicity(new FxMultiplicity(0, 5));
146: ae.createProperty(testId, pe, "/");
147: } catch (FxApplicationException e) {
148: assert false : e.getMessage();
149: }
150: FxTypeEdit testEdit = new FxTypeEdit(CacheAdmin
151: .getEnvironment().getType("TestCD"));
152: long propCount = testEdit.getAssignedProperties().size();
153: testEdit.setName("TestCDNewName");
154: testEdit.setPermissions((byte) 0); //clear permissions
155: testEdit.setUseInstancePermissions(true);
156: testEdit.setDescription(new FxString("Changed description"));
157: testEdit.setCheckValidity(true);
158: testEdit.setState(TypeState.Unavailable);
159: te.save(testEdit);
160: FxType testType = CacheAdmin.getEnvironment().getType(
161: "TestCDNewName");
162: assert testType.getAssignedProperties().size() == propCount : "Property count mismatch";
163: assert testType.getAssignment("/TestDirectProperty2")
164: .getXPath().equals("TESTCDNEWNAME/TESTDIRECTPROPERTY2") : "Expected [TESTCDNEWNAME/TESTDIRECTPROPERTY2] but got: ["
165: + testType.getAssignment("/TestDirectProperty2")
166: .getXPath() + "]";
167: assert testType.usePermissions();
168: assert testType.useInstancePermissions();
169: assert !testType.usePropertyPermissions();
170: assert !testType.useStepPermissions();
171: assert !testType.useTypePermissions();
172: assert testType.isCheckValidity();
173: assert testType.getState() == TypeState.Unavailable;
174:
175: try {
176: assert testId == testType.getId() : "Wrong id for type!";
177: te.remove(testType.getId());
178: try {
179: CacheAdmin.getEnvironment().getType("TestCD");
180: assert false : "TestCD could be loaded after remove!";
181: } catch (Exception e) {
182: //ok
183: }
184: } catch (FxApplicationException e) {
185: assert false : e.getMessage();
186: }
187: }
188:
189: /**
190: * Test derived types
191: *
192: * @throws Exception on errors
193: */
194: @Test
195: public void derivedType() throws Exception {
196: long testId = -1;
197: try {
198: testId = te.save(FxTypeEdit.createNew("TestCDP",
199: new FxString("description..."), CacheAdmin
200: .getEnvironment().getACLs(
201: ACL.Category.STRUCTURE).get(0),
202: null));
203: // testId = te.create(1, 1, 1, new ArrayList<Mandator>(2), "TestCDP",
204: // new FxString("description..."), null, false,
205: // TypeStorageMode.Hierarchical, TypeCategory.User, TypeMode.Content,
206: // true, LanguageMode.Multiple, TypeState.Available, (byte) 0, true, 0, 0, 0, 0);
207: FxString desc = new FxString("Test data structure");
208: desc.setTranslation(FxLanguage.GERMAN,
209: "Testdaten Strukturen");
210: FxString hint = new FxString("Hint text ...");
211: ACL structACL = null;
212: for (ACL a : CacheAdmin.getEnvironment().getACLs())
213: if (a.getCategory() == ACL.Category.STRUCTURE) {
214: structACL = a;
215: break;
216: }
217: assert structACL != null : "No available ACL for structure found!";
218: FxPropertyEdit pe = FxPropertyEdit.createNew(
219: "TestDirectProperty1", desc, hint, true,
220: new FxMultiplicity(0, 1), true, structACL,
221: FxDataType.String1024,
222: new FxString(FxString.EMPTY), true, null, null,
223: null);
224: ae.createProperty(testId, pe, "/");
225: FxGroupEdit ge = FxGroupEdit.createNew("TestGroup", desc,
226: hint, true, new FxMultiplicity(0, 1));
227: ae.createGroup(testId, ge, "/");
228: pe.setName("TestDirectProperty2");
229: pe.setMultiplicity(new FxMultiplicity(0, 1));
230: ae.createProperty(testId, pe, "/TestGroup");
231: } catch (FxApplicationException e) {
232: assert false : e.getMessage();
233: }
234: FxType testType = CacheAdmin.getEnvironment()
235: .getType("TestCDP");
236: assert testId == testType.getId() : "Wrong id for type!";
237:
238: long testDerivedId;
239: testDerivedId = te.save(FxTypeEdit.createNew(
240: "TestCDDerived",
241: new FxString("description..."),
242: CacheAdmin.getEnvironment().getACLs(
243: ACL.Category.STRUCTURE).get(0), testType)
244: .setEnableParentAssignments(false));
245: // testDerivedId = te.create(1, 1, 1, new ArrayList<Mandator>(2), "TestCDDerived",
246: // new FxString("description..."), testType, false,
247: // TypeStorageMode.Hierarchical, TypeCategory.User, TypeMode.Content,
248: // true, LanguageMode.Multiple, TypeState.Available, (byte) 0, true, 0, 0, 0, 0);
249: FxType testTypeDerived = CacheAdmin.getEnvironment().getType(
250: "TestCDDerived");
251: assert testTypeDerived.getId() == testDerivedId : "Derived type id does not match!";
252: assert testTypeDerived.getParent().getId() == testType.getId() : "Derived types parent does not match!";
253: FxAssignment dp = null;
254: try {
255: dp = testTypeDerived.getAssignment("/TestDirectProperty1");
256: } catch (Exception e) {
257: assert false : "Failed to retrieved derived property: "
258: + e.getMessage();
259: }
260: assert !dp.isEnabled() : "Property should be disabled!";
261: FxPropertyAssignmentEdit dpe = new FxPropertyAssignmentEdit(
262: (FxPropertyAssignment) dp);
263: dpe.setEnabled(true);
264: ae.save(dpe, false);
265: testTypeDerived = CacheAdmin.getEnvironment().getType(
266: "TestCDDerived");
267: dp = testTypeDerived.getAssignment("/TestDirectProperty1");
268: assert dp.isEnabled() : "Property should be enabled!";
269:
270: try {
271: dp = testTypeDerived
272: .getAssignment("/TestGroup/TestDirectProperty2");
273: } catch (Exception e) {
274: assert false : "Failed to retrieved derived property: "
275: + e.getMessage();
276: }
277: assert !dp.isEnabled() : "Property should be disabled!";
278:
279: FxGroupAssignmentEdit gae = new FxGroupAssignmentEdit(
280: (FxGroupAssignment) testTypeDerived
281: .getAssignment("/TestGroup"));
282: gae.setEnabled(true);
283: ae.save(gae, false);
284: testTypeDerived = CacheAdmin.getEnvironment().getType(
285: "TestCDDerived");
286: dp = testTypeDerived
287: .getAssignment("/TestGroup/TestDirectProperty2");
288: assert dp.isEnabled() : "Property should be enabled!";
289:
290: try {
291: te.remove(testTypeDerived.getId());
292: try {
293: CacheAdmin.getEnvironment().getType("TestCDDerived");
294: assert false : "TestCDDerived could be loaded after remove!";
295: } catch (Exception e) {
296: //ok
297: }
298: te.remove(testType.getId());
299: try {
300: CacheAdmin.getEnvironment().getType("TestCDP");
301: assert false : "TestCD could be loaded after remove!";
302: } catch (Exception e) {
303: //ok
304: }
305: } catch (FxApplicationException e) {
306: assert false : e.getMessage();
307: }
308: }
309:
310: @Test
311: public void contactData() throws Exception {
312: try {
313: if (CacheAdmin.getEnvironment().getType("ContactsTest") != null)
314: return; //ok, exists already
315: } catch (Exception e) {
316: //ok, create the type
317: }
318: long aid = acl.create("ContactsTest", new FxString(
319: "Contact ACL"), Mandator.MANDATOR_FLEXIVE, "#AA0000",
320: "ACL for ContactsTest", ACL.Category.STRUCTURE);
321: ACL contactACL = CacheAdmin.getEnvironment().getACL(aid);
322: FxString desc = new FxString("Template for contact data");
323: desc.setTranslation(FxLanguage.GERMAN, "Kontaktdaten Vorlage");
324: FxString hint = new FxString("");
325: FxGroupEdit ge = FxGroupEdit.createNew("CONTACT_DATA", desc,
326: hint, true, new FxMultiplicity(0, FxMultiplicity.N));
327: ae.createGroup(ge, "/");
328: ge.setName("ADDRESS");
329: desc.setTranslation(FxLanguage.ENGLISH, "Address");
330: desc.setTranslation(FxLanguage.GERMAN, "Adresse");
331: ge.setLabel(desc);
332: ae.createGroup(ge, "/CONTACT_DATA");
333: desc.setTranslation(FxLanguage.ENGLISH, "Surname");
334: desc.setTranslation(FxLanguage.GERMAN, "Nachname");
335: hint
336: .setTranslation(FxLanguage.ENGLISH,
337: "Surname of the person");
338: hint.setTranslation(FxLanguage.GERMAN, "Nachname der Person");
339: FxPropertyEdit pe = FxPropertyEdit.createNew("SURNAME", desc,
340: hint, new FxMultiplicity(1, 1), contactACL,
341: FxDataType.String1024).setAutoUniquePropertyName(true);
342: ae.createProperty(pe, "/CONTACT_DATA");
343: desc.setTranslation(FxLanguage.ENGLISH, "Name");
344: desc.setTranslation(FxLanguage.GERMAN, "Vorname");
345: hint.setTranslation(FxLanguage.ENGLISH, "Name of the person");
346: hint.setTranslation(FxLanguage.GERMAN, "Vorname der Person");
347: pe.setLabel(desc);
348: pe.setHint(hint);
349: pe.setName("NAME");
350: ae.createProperty(pe, "/CONTACT_DATA");
351: desc.setTranslation(FxLanguage.ENGLISH, "Street");
352: desc.setTranslation(FxLanguage.GERMAN, "Strasse");
353: pe.setLabel(desc);
354: pe.setHint(desc);
355: pe.setDataType(FxDataType.String1024);
356: pe.setName("STREET");
357: ae.createProperty(pe, "/CONTACT_DATA/ADDRESS");
358: desc.setTranslation(FxLanguage.ENGLISH, "ZIP code");
359: desc.setTranslation(FxLanguage.GERMAN, "Postleitzahl");
360: pe.setDataType(FxDataType.String1024);
361: pe.setLabel(desc);
362: pe.setHint(desc);
363: pe.setName("ZIP");
364: ae.createProperty(pe, "/CONTACT_DATA/ADDRESS");
365: desc.setTranslation(FxLanguage.ENGLISH, "City");
366: desc.setTranslation(FxLanguage.GERMAN, "Stadt");
367: pe.setLabel(desc);
368: pe.setHint(desc);
369: pe.setName("CITY");
370: ae.createProperty(pe, "/CONTACT_DATA/ADDRESS");
371: desc.setTranslation(FxLanguage.ENGLISH, "Country");
372: desc.setTranslation(FxLanguage.GERMAN, "Land");
373: pe.setLabel(desc);
374: pe.setHint(desc);
375: pe.setName("COUNTRY");
376: ae.createProperty(pe, "/CONTACT_DATA/ADDRESS");
377: te.save(FxTypeEdit.createNew("ContactsTest", new FxString(
378: "Contact data"), contactACL, null));
379:
380: // te.create(contactACL.getId(), 1, 1, new ArrayList<Mandator>(2), "ContactsTest",
381: // new FxString("Contact data"), null, false,
382: // TypeStorageMode.Hierarchical, TypeCategory.User, TypeMode.Content,
383: // true, LanguageMode.Multiple, TypeState.Available, (byte) 0, true, 0, 0, 0, 0);
384: FxGroupAssignment ga = (FxGroupAssignment) CacheAdmin
385: .getEnvironment().getAssignment("ROOT/CONTACT_DATA");
386: FxGroupAssignmentEdit gae = FxGroupAssignmentEdit.createNew(ga,
387: CacheAdmin.getEnvironment().getType("ContactsTest"),
388: null, "/");
389: ae.save(gae, true);
390: }
391:
392: @Test
393: public void assignmentGroupProperty() throws Exception {
394: Context c = new InitialContext();
395: UserTransaction ut = (UserTransaction) c
396: .lookup("UserTransaction");
397: ut.begin();
398: FxString desc = new FxString("group description...");
399: desc.setTranslation(2, "gruppen beschreibung");
400: FxGroupEdit ge = FxGroupEdit.createNew("grouptest", desc,
401: new FxString("hint..."), true, new FxMultiplicity(0,
402: FxMultiplicity.N));
403: ae.createGroup(ge, "/");
404: ge.setName("subgroup");
405: ae.createGroup(ge, "/GROUPTEST");
406: ge.setName("subgroup2");
407: ae.createGroup(ge, "/GROUPTEST/SUBGROUP");
408: desc.setTranslation(1, "property description...");
409: desc.setTranslation(2, "attribut beschreibung...");
410: FxPropertyEdit pe = FxPropertyEdit.createNew("testproperty",
411: desc, new FxString("property hint"), true,
412: new FxMultiplicity(1, 1), true, CacheAdmin
413: .getEnvironment().getACL(1), FxDataType.Number,
414: new FxString("123"), true, null, null, null);
415: ae.createProperty(pe, "/GROUPTEST/SUBGROUP");
416: FxGroupAssignment ga = (FxGroupAssignment) CacheAdmin
417: .getEnvironment().getAssignment("ROOT/GROUPTEST");
418: FxGroupAssignmentEdit gae = FxGroupAssignmentEdit.createNew(ga,
419: CacheAdmin.getEnvironment().getType("ROOT"), "GTEST",
420: "/");
421: ae.save(gae, true);
422: ut.rollback();
423: }
424:
425: @Test
426: public void assignmentRemove() throws Exception {
427: long testId = -1;
428: ACL structACL = null;
429: FxString hint = new FxString("Hint text ...");
430: FxString desc = new FxString("Test data structure");
431: try {
432: testId = te.save(FxTypeEdit.createNew(
433: "TestAssignmentRemove", new FxString(
434: "description..."), CacheAdmin
435: .getEnvironment().getACLs(
436: ACL.Category.STRUCTURE).get(0),
437: null));
438: // te.create(1, 1, 1, new ArrayList<Mandator>(2), "TestAssignmentRemove",
439: // new FxString("description..."), null, false,
440: // TypeStorageMode.Hierarchical, TypeCategory.User, TypeMode.Content,
441: // true, LanguageMode.Multiple, TypeState.Available, (byte) 0, true, 0, 0, 0, 0);
442: desc.setTranslation(FxLanguage.GERMAN,
443: "Testdaten Strukturen");
444: structACL = null;
445: for (ACL a : CacheAdmin.getEnvironment().getACLs())
446: if (a.getCategory() == ACL.Category.STRUCTURE) {
447: structACL = a;
448: break;
449: }
450: assert structACL != null : "No available ACL for structure found!";
451: FxPropertyEdit pe = FxPropertyEdit.createNew(
452: "TestAssignmentRemoveProperty1", desc, hint, true,
453: new FxMultiplicity(0, 1), true, structACL,
454: FxDataType.String1024,
455: new FxString(FxString.EMPTY), true, null, null,
456: null);
457: ae.createProperty(testId, pe, "/");
458: } catch (FxApplicationException e) {
459: assert false : e.getMessage();
460: }
461: FxType testType = CacheAdmin.getEnvironment().getType(
462: "TestAssignmentRemove");
463: assert testId == testType.getId() : "Wrong id for type!";
464: FxPropertyAssignment pa = null;
465: long rmId = -1;
466: try {
467: pa = (FxPropertyAssignment) testType
468: .getAssignment("/TestAssignmentRemoveProperty1");
469: assert pa != null : "Created Property Assignment is null!";
470: rmId = pa.getId();
471: } catch (Exception e) {
472: assert false : "Created Property Assignment does not exist!";
473: }
474: FxPropertyAssignmentEdit pae = FxPropertyAssignmentEdit
475: .createNew(pa, testType,
476: "TestAssignmentRemoveProperty2", "/");
477: try {
478: long paId = ae.save(pae, true);
479: pa = (FxPropertyAssignment) CacheAdmin.getEnvironment()
480: .getAssignment(paId);
481: } catch (Exception e) {
482: assert false : "Failed to retrieve derived assignment(2): "
483: + e.getMessage();
484: }
485: //create derived assignment over 3 hops
486: ae.save(FxPropertyAssignmentEdit.createNew(pa, testType,
487: "TestAssignmentRemoveProperty3", "/"), true);
488: //check base's
489: testType = CacheAdmin.getEnvironment().getType(testId);
490: assert testType.getAssignment("/TestAssignmentRemoveProperty1")
491: .getBaseAssignmentId() == FxAssignment.NO_PARENT;
492: assert testType.getAssignment("/TestAssignmentRemoveProperty2")
493: .getBaseAssignmentId() == testType.getAssignment(
494: "/TestAssignmentRemoveProperty1").getId();
495: assert testType.getAssignment("/TestAssignmentRemoveProperty3")
496: .getBaseAssignmentId() == testType.getAssignment(
497: "/TestAssignmentRemoveProperty2").getId();
498: ae.removeAssignment(rmId, true, true);
499: assert CacheAdmin.getEnvironment()
500: .getSystemInternalRootPropertyAssignments().size() == CacheAdmin
501: .getEnvironment().getType(testId)
502: .getAssignedProperties().size() : "Expected to have "
503: + CacheAdmin.getEnvironment()
504: .getSystemInternalRootPropertyAssignments()
505: .size() + " assignments to the type!";
506:
507: //recreate
508: FxPropertyEdit pe = FxPropertyEdit.createNew(
509: "TestAssignmentRemoveProperty1", desc, hint, true,
510: new FxMultiplicity(0, 1), true, structACL,
511: FxDataType.String1024, new FxString(FxString.EMPTY),
512: true, null, null, null);
513: long id1 = ae.createProperty(testId, pe, "/");
514: pa = (FxPropertyAssignment) CacheAdmin.getEnvironment()
515: .getAssignment(id1);
516: long id2 = ae.save(FxPropertyAssignmentEdit.createNew(pa,
517: testType, "TestAssignmentRemoveProperty2", "/"), true);
518: pa = (FxPropertyAssignment) CacheAdmin.getEnvironment()
519: .getAssignment(id2);
520: // long id3 =
521: ae.save(FxPropertyAssignmentEdit.createNew(pa, testType,
522: "TestAssignmentRemoveProperty3", "/"), true);
523: //recheck
524: testType = CacheAdmin.getEnvironment().getType(testId);
525: assert testType.getAssignment("/TestAssignmentRemoveProperty1")
526: .getBaseAssignmentId() == FxAssignment.NO_PARENT;
527: assert testType.getAssignment("/TestAssignmentRemoveProperty2")
528: .getBaseAssignmentId() == testType.getAssignment(
529: "/TestAssignmentRemoveProperty1").getId();
530: assert testType.getAssignment("/TestAssignmentRemoveProperty3")
531: .getBaseAssignmentId() == testType.getAssignment(
532: "/TestAssignmentRemoveProperty2").getId();
533:
534: ae
535: .removeAssignment(testType.getAssignment(
536: "/TestAssignmentRemoveProperty1").getId(),
537: false, false);
538: testType = CacheAdmin.getEnvironment().getType(testId);
539: assert testType.getAssignment("/TestAssignmentRemoveProperty2")
540: .getBaseAssignmentId() == FxAssignment.NO_PARENT;
541: assert testType.getAssignment("/TestAssignmentRemoveProperty3")
542: .getBaseAssignmentId() == testType.getAssignment(
543: "/TestAssignmentRemoveProperty2").getId();
544:
545: te.remove(testId);
546: }
547:
548: @Test
549: public void overrideCaptionMultiLangTest()
550: throws FxNotFoundException, FxInvalidParameterException {
551: final FxPropertyAssignmentEdit property = FxPropertyAssignmentEdit
552: .createNew(
553: (FxPropertyAssignment) CacheAdmin
554: .getEnvironment().getAssignment(
555: "ROOT/CAPTION"),
556:
557: CacheAdmin.getEnvironment().getType(
558: FxType.CONTACTDATA), "test", "/");
559: Assert.assertTrue(property.isMultiLang(),
560: "Caption property should be multi-language by default");
561: if (property.getProperty().mayOverrideMultiLang())
562: Assert
563: .assertTrue(false,
564: "Expected Caption property to be not overrideable for this test case!");
565: try {
566: property.setMultiLang(false);
567: Assert.assertTrue(false,
568: "Non-overrideable option must not be overridden!");
569: } catch (FxInvalidParameterException ipe) {
570: //expected
571: }
572: }
573: }
|