Author: maurelio1234
Date: 2008-07-22 08:12:12-0700
New Revision: 15337
Removed:
trunk/src/argouml-app/tests/ArgoUML profile.internal.ocl tests with MDR.launch
trunk/src/argouml-app/tests/org/argouml/profile/internal/ocl/
Modified:
trunk/src/argouml-app/tests/org/argouml/profile/ProfileMother.java
trunk/src/argouml-app/tests/org/argouml/profile/TestCoreProfileReference.java
trunk/src/argouml-app/tests/org/argouml/profile/TestProfileFacade.java
trunk/src/argouml-app/tests/org/argouml/profile/TestProfileManager.java
trunk/src/argouml-app/tests/org/argouml/profile/TestProfileMother.java
trunk/src/argouml-app/tests/org/argouml/profile/TestProfileReference.java
trunk/src/argouml-app/tests/org/argouml/profile/TestReaderModelLoader.java
trunk/src/argouml-app/tests/org/argouml/profile/TestSubsystemInit.java
trunk/src/argouml-app/tests/org/argouml/profile/TestUserDefinedProfile.java
trunk/src/argouml-app/tests/org/argouml/profile/TestUserProfileReference.java
trunk/src/argouml-app/tests/org/argouml/profile/internal/TestProfileJava.java
trunk/src/argouml-app/tests/org/argouml/profile/internal/TestProfileManagerImpl.java
Log:
undoing mistakenly commited changes, going back to r15333
Removed: trunk/src/argouml-app/tests/ArgoUML profile.internal.ocl tests with MDR.launch
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/tests/ArgoUML%20profile.internal.ocl%20tests%20with%20MDR.launch?view=auto&rev=15336
Modified: trunk/src/argouml-app/tests/org/argouml/profile/ProfileMother.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/tests/org/argouml/profile/ProfileMother.java?view=diff&rev=15337&p1=trunk/src/argouml-app/tests/org/argouml/profile/ProfileMother.java&p2=trunk/src/argouml-app/tests/org/argouml/profile/ProfileMother.java&r1=15336&r2=15337
==============================================================================
--- trunk/src/argouml-app/tests/org/argouml/profile/ProfileMother.java (original)
+++ trunk/src/argouml-app/tests/org/argouml/profile/ProfileMother.java 2008-07-22 08:12:12-0700
@@ -45,28 +45,27 @@
import org.argouml.persistence.UmlFilePersister;
/**
- * Based on the <a
- * href="http://www.xpuniverse.com/2001/pdfs/Testing03.pdf">ObjectMother design
- * pattern</a>, provides reusable facilities to create profiles.
- *
+ * Based on the
+ * <a href="http://www.xpuniverse.com/2001/pdfs/Testing03.pdf">ObjectMother
+ * design pattern</a>, provides reusable facilities to create profiles.
+ *
* @author Luis Sergio Oliveira (euluis)
*/
public class ProfileMother {
-
+
private static final Logger LOG = Logger.getLogger(ProfileMother.class);
/**
* "profile"
*/
public static final String STEREOTYPE_NAME_PROFILE = "profile";
-
/**
* "st" the example stereotype name.
*/
public static final String STEREOTYPE_NAME_ST = "st";
/**
- * Create a simple profile model with a class named "foo" and with a
+ * Create a simple profile model with a class named "foo" and with a
* stereotype named "st".
*
* @return the profile model.
@@ -76,7 +75,7 @@
Object profileStereotype = getProfileStereotype();
getCoreHelper().addStereotype(model, profileStereotype);
Object fooClass = Model.getCoreFactory().buildClass("foo", model);
- getExtensionMechanismsFactory().buildStereotype(fooClass,
+ getExtensionMechanismsFactory().buildStereotype(fooClass,
STEREOTYPE_NAME_ST, model);
return model;
}
@@ -86,21 +85,22 @@
Collection<Object> models = new ArrayList<Object>();
models.add(umlProfile);
Collection stereotypes = getExtensionMechanismsHelper().getStereotypes(
- models);
+ models);
for (Object stereotype : stereotypes) {
- if (STEREOTYPE_NAME_PROFILE.equals(Model.getFacade().getName(
- stereotype))) return stereotype;
+ if (STEREOTYPE_NAME_PROFILE.equals(
+ Model.getFacade().getName(stereotype)))
+ return stereotype;
}
return null;
}
-
+
private Object umlProfileModel;
Object getUmlProfileModel() {
if (ProfileFacade.isInitiated()) {
try {
- umlProfileModel = ProfileFacade.getManager().getUMLProfile()
- .getProfilePackages().iterator().next();
+ umlProfileModel = ProfileFacade.getManager().getUMLProfile().
+ getProfilePackages().iterator().next();
TestCase.assertTrue(getFacade().isAModel(umlProfileModel));
} catch (ProfileException e) {
LOG.error("Exception", e);
@@ -108,8 +108,8 @@
}
if (umlProfileModel == null) {
umlProfileModel = getModelManagementFactory().createModel();
- getExtensionMechanismsFactory().buildStereotype(umlProfileModel,
- STEREOTYPE_NAME_PROFILE, umlProfileModel);
+ getExtensionMechanismsFactory().buildStereotype(
+ umlProfileModel, STEREOTYPE_NAME_PROFILE, umlProfileModel);
}
return umlProfileModel;
}
@@ -124,7 +124,7 @@
public void saveProfileModel(Object model, File file) throws IOException {
FileOutputStream fileOut = new FileOutputStream(file);
try {
- XmiWriter xmiWriter = Model.getXmiWriter(model, fileOut, "x("
+ XmiWriter xmiWriter = Model.getXmiWriter(model, fileOut, "x("
+ UmlFilePersister.PERSISTENCE_VERSION + ")");
xmiWriter.write();
fileOut.flush();
Modified: trunk/src/argouml-app/tests/org/argouml/profile/TestCoreProfileReference.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/tests/org/argouml/profile/TestCoreProfileReference.java?view=diff&rev=15337&p1=trunk/src/argouml-app/tests/org/argouml/profile/TestCoreProfileReference.java&p2=trunk/src/argouml-app/tests/org/argouml/profile/TestCoreProfileReference.java&r1=15336&r2=15337
==============================================================================
--- trunk/src/argouml-app/tests/org/argouml/profile/TestCoreProfileReference.java (original)
+++ trunk/src/argouml-app/tests/org/argouml/profile/TestCoreProfileReference.java 2008-07-22 08:12:12-0700
@@ -35,7 +35,7 @@
* @author Luis Sergio Oliveira (euluis)
*/
public class TestCoreProfileReference extends TestCase {
-
+
/**
* Tests {@link CoreProfileReference#CoreProfileReference(String)}.
*
@@ -44,19 +44,20 @@
public void testCtorHappyPath() throws MalformedURLException {
String fileName = "profileName.xmi";
ProfileReference reference = new CoreProfileReference(fileName);
- assertEquals(CoreProfileReference.PROFILES_RESOURCE_PATH + fileName,
- reference.getPath());
+ assertEquals(CoreProfileReference.PROFILES_RESOURCE_PATH + fileName,
+ reference.getPath());
assertEquals(
- new URL(CoreProfileReference.PROFILES_BASE_URL + fileName),
- reference.getPublicReference());
+ new URL(CoreProfileReference.PROFILES_BASE_URL + fileName),
+ reference.getPublicReference());
}
-
+
/**
* Tests that the constructor checks for empty file name.
*
* @throws MalformedURLException if the built URL is incorrect.
*/
- public void testCtorFailsWhenFileNameIsEmpty() throws MalformedURLException {
+ public void testCtorFailsWhenFileNameIsEmpty()
+ throws MalformedURLException {
try {
new CoreProfileReference("");
// TODO: This requires that the tests be run with assertions
@@ -66,13 +67,14 @@
// expected
}
}
-
+
/**
* Tests that the constructor checks for null file name.
*
* @throws MalformedURLException if the built URL is incorrect.
*/
- public void testCtorFailsWhenFileNameIsNull() throws MalformedURLException {
+ public void testCtorFailsWhenFileNameIsNull()
+ throws MalformedURLException {
try {
new CoreProfileReference(null);
// TODO: This requires that the tests be run with assertions
Modified: trunk/src/argouml-app/tests/org/argouml/profile/TestProfileFacade.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/tests/org/argouml/profile/TestProfileFacade.java?view=diff&rev=15337&p1=trunk/src/argouml-app/tests/org/argouml/profile/TestProfileFacade.java&p2=trunk/src/argouml-app/tests/org/argouml/profile/TestProfileFacade.java&r1=15336&r2=15337
==============================================================================
--- trunk/src/argouml-app/tests/org/argouml/profile/TestProfileFacade.java (original)
+++ trunk/src/argouml-app/tests/org/argouml/profile/TestProfileFacade.java 2008-07-22 08:12:12-0700
@@ -29,24 +29,25 @@
import junit.framework.TestCase;
/**
+ *
* @author Luis Sergio Oliveira (euluis)
*/
public class TestProfileFacade extends TestCase {
private MockControl managerCtrl;
-
private ProfileManager manager;
- /*
+ /*
* @see junit.framework.TestCase#setUp()
*/
@Override
protected void setUp() throws Exception {
- managerCtrl = MockControl.createControl(ProfileManager.class);
+ managerCtrl = MockControl.createControl(
+ ProfileManager.class);
manager = (ProfileManager) managerCtrl.getMock();
ProfileFacade.setManager(manager);
}
-
+
@Override
protected void tearDown() throws Exception {
ProfileFacade.reset();
@@ -65,14 +66,14 @@
// expected
}
}
-
+
/**
* Test {@link ProfileFacade#register(Profile)}.
*/
public void testRegister() {
manager.registerProfile(null);
managerCtrl.replay();
-
+
ProfileFacade.register(null);
managerCtrl.verify();
}
@@ -83,7 +84,7 @@
public void testRemove() {
manager.removeProfile(null);
managerCtrl.replay();
-
+
ProfileFacade.remove((Profile) null);
managerCtrl.verify();
}
Modified: trunk/src/argouml-app/tests/org/argouml/profile/TestProfileManager.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/tests/org/argouml/profile/TestProfileManager.java?view=diff&rev=15337&p1=trunk/src/argouml-app/tests/org/argouml/profile/TestProfileManager.java&p2=trunk/src/argouml-app/tests/org/argouml/profile/TestProfileManager.java&r1=15336&r2=15337
==============================================================================
--- trunk/src/argouml-app/tests/org/argouml/profile/TestProfileManager.java (original)
+++ trunk/src/argouml-app/tests/org/argouml/profile/TestProfileManager.java 2008-07-22 08:12:12-0700
@@ -36,15 +36,13 @@
/**
* Tests for a ProfileManager implementation.
- *
+ *
* @author Luis Sergio Oliveira (euluis)
*/
public class TestProfileManager extends TestCase {
-
+
private Profile mockProfile;
-
private ProfileManager manager;
-
private String mockProfileClassName;
@Override
@@ -56,9 +54,8 @@
public String getDisplayName() {
return null;
}
-
@Override
- public Collection<Object> getProfilePackages()
+ public Collection<Object> getProfilePackages()
throws ProfileException {
return Collections.emptyList();
}
@@ -66,7 +63,7 @@
manager = ProfileFacade.getManager();
assertNotNull(manager);
}
-
+
@Override
protected void tearDown() throws Exception {
ProfileFacade.reset();
@@ -80,7 +77,7 @@
manager.registerProfile(mockProfile);
assertTrue(manager.getRegisteredProfiles().contains(mockProfile));
}
-
+
/**
* Test the {@link ProfileManager#removeProfile(Profile)} method.
*/
@@ -99,30 +96,30 @@
mockProfileClassName = mockProfile.getClass().getName();
assertNull(manager.getProfileForClass(mockProfileClassName));
manager.registerProfile(mockProfile);
- assertEquals(mockProfile, manager
- .getProfileForClass(mockProfileClassName));
+ assertEquals(mockProfile, manager.getProfileForClass(
+ mockProfileClassName));
manager.removeProfile(mockProfile);
assertNull(manager.getProfileForClass(mockProfileClassName));
}
-
+
/**
- * Tests the methods of {@link ProfileManager} related to default profiles
+ * Tests the methods of {@link ProfileManager} related to default profiles
* management.
*/
public void testDefaultProfilesManagement() {
- List<Object> initialDefaultProfiles = new ArrayList<Object>(manager
- .getDefaultProfiles());
+ List<Object> initialDefaultProfiles =
+ new ArrayList<Object>(manager.getDefaultProfiles());
assertNull(manager.getProfileForClass(mockProfileClassName));
manager.registerProfile(mockProfile);
manager.addToDefaultProfiles(mockProfile);
- assertEquals(initialDefaultProfiles.size() + 1, manager
- .getDefaultProfiles().size());
+ assertEquals(initialDefaultProfiles.size() + 1,
+ manager.getDefaultProfiles().size());
manager.removeFromDefaultProfiles(mockProfile);
- assertEquals(initialDefaultProfiles.size(), manager
- .getDefaultProfiles().size());
+ assertEquals(initialDefaultProfiles.size(),
+ manager.getDefaultProfiles().size());
assertFalse(manager.getDefaultProfiles().contains(mockProfile));
}
-
+
/**
* Test the method {@link ProfileManager#getUMLProfile()}.
*/
Modified: trunk/src/argouml-app/tests/org/argouml/profile/TestProfileMother.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/tests/org/argouml/profile/TestProfileMother.java?view=diff&rev=15337&p1=trunk/src/argouml-app/tests/org/argouml/profile/TestProfileMother.java&p2=trunk/src/argouml-app/tests/org/argouml/profile/TestProfileMother.java&r1=15336&r2=15337
==============================================================================
--- trunk/src/argouml-app/tests/org/argouml/profile/TestProfileMother.java (original)
+++ trunk/src/argouml-app/tests/org/argouml/profile/TestProfileMother.java 2008-07-22 08:12:12-0700
@@ -37,12 +37,12 @@
import junit.framework.TestCase;
/**
+ *
* @author Luis Sergio Oliveira (euluis)
*/
public class TestProfileMother extends TestCase {
-
+
private ProfileMother mother;
-
private File testDir;
@Override
@@ -50,57 +50,43 @@
InitializeModel.initializeDefault();
mother = new ProfileMother();
}
-
- /**
- * test profile model creation
- */
+
public void testCreateProfileModel() {
Object model = mother.createSimpleProfileModel();
assertNotNull(model);
Collection profileStereotypes = getFacade().getStereotypes(model);
assertEquals(1, profileStereotypes.size());
- assertEquals(ProfileMother.STEREOTYPE_NAME_PROFILE, getFacade()
- .getName(profileStereotypes.iterator().next()));
+ assertEquals(ProfileMother.STEREOTYPE_NAME_PROFILE,
+ getFacade().getName(profileStereotypes.iterator().next()));
}
-
- /**
- * test simple profile model creation
- *
- * @throws Exception is something goes wrong
- */
+
public void testCreateSimpleProfileModel() throws Exception {
final Object model = mother.createSimpleProfileModel();
- Collection<Object> models = new ArrayList<Object>() {
- {
+ Collection<Object> models = new ArrayList<Object>() { {
add(model);
}
};
- Collection stereotypes = getExtensionMechanismsHelper().getStereotypes(
- models);
+ Collection stereotypes =
+ getExtensionMechanismsHelper().getStereotypes(models);
Object st = null;
for (Object stereotype : stereotypes) {
- if (ProfileMother.STEREOTYPE_NAME_ST.equals(getFacade().getName(
- stereotype))) {
+ if (ProfileMother.STEREOTYPE_NAME_ST.equals(
+ getFacade().getName(stereotype))) {
st = stereotype;
break;
}
}
assertNotNull("\"st\" stereotype not found in model.", st);
- assertTrue(Model.getExtensionMechanismsHelper().isStereotype(st,
+ assertTrue(Model.getExtensionMechanismsHelper().isStereotype(st,
ProfileMother.STEREOTYPE_NAME_ST, "Class"));
}
-
- /**
- * test save profile model
- *
- * @throws Exception if something goes wrong
- */
+
public void testSaveProfileModel() throws Exception {
Object model = mother.createSimpleProfileModel();
File file = new File(testDir, "testSaveProfileModel.xmi");
mother.saveProfileModel(model, file);
- assertTrue("The file to where the file was supposed to be saved "
+ assertTrue("The file to where the file was supposed to be saved "
+ "doesn't exist.", file.exists());
}
-
+
}
Modified: trunk/src/argouml-app/tests/org/argouml/profile/TestProfileReference.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/tests/org/argouml/profile/TestProfileReference.java?view=diff&rev=15337&p1=trunk/src/argouml-app/tests/org/argouml/profile/TestProfileReference.java&p2=trunk/src/argouml-app/tests/org/argouml/profile/TestProfileReference.java&r1=15336&r2=15337
==============================================================================
--- trunk/src/argouml-app/tests/org/argouml/profile/TestProfileReference.java (original)
+++ trunk/src/argouml-app/tests/org/argouml/profile/TestProfileReference.java 2008-07-22 08:12:12-0700
@@ -31,32 +31,33 @@
/**
* Tests for the ProfileReference class.
- *
+ *
* @author Luis Sergio Oliveira (euluis)
*/
public class TestProfileReference extends TestCase {
-
+
/**
* Test correct call to constructor.
*
* @throws MalformedURLException if the URL is incorrect.
*/
public void testCtorHappyPath() throws MalformedURLException {
- new ProfileReference("systemId/name.xmi", new URL(
- "file:///publicId/name.xmi"));
+ new ProfileReference("systemId/name.xmi",
+ new URL("file:///publicId/name.xmi"));
}
-
+
/**
- * Test call to constructor with inconsistent file names in the path and the
- * publicReference arguments. NOTE: to run successfully this test you'll
- * have to enable assertions.
+ * Test call to constructor with inconsistent file names in the path and
+ * the publicReference arguments.
+ *
+ * NOTE: to run successfully this test you'll have to enable assertions.
*
* @throws MalformedURLException if the URL is incorrect.
*/
- public void testCtorInconsistentFileNameDetected()
+ public void testCtorInconsistentFileNameDetected()
throws MalformedURLException {
try {
- new ProfileReference("/org/argouml/language/x/profile/name.xmi",
+ new ProfileReference("/org/argouml/language/x/profile/name.xmi",
new URL("http://argouml-x.tigris.org/iconsistentName.xmi"));
fail("Expected an AssertionError to be thrown!");
} catch (MalformedURLException e) {
@@ -65,22 +66,22 @@
// expected
}
}
-
+
/**
- * Checks that the path handed to the constructor is correctly returned by
+ * Checks that the path handed to the constructor is correctly returned by
* {@link ProfileReference#getPath()}.
*
* @throws MalformedURLException if the URL is incorrect.
*/
public void testGetPath() throws MalformedURLException {
String path = "/org/argouml/language/x/profile/name.xmi";
- ProfileReference profileReference = new ProfileReference(path, new URL(
- "http://x.org/name.xmi"));
+ ProfileReference profileReference = new ProfileReference(
+ path, new URL("http://x.org/name.xmi"));
assertEquals(path, profileReference.getPath());
}
-
+
/**
- * Checks that the publicReference handed to the constructor is correctly
+ * Checks that the publicReference handed to the constructor is correctly
* returned by {@link ProfileReference#getPublicReference()}.
*
* @throws MalformedURLException if the URL is incorrect.
@@ -88,7 +89,7 @@
public void testGetPublicReference() throws MalformedURLException {
URL publicReference = new URL("http://x.org/name.xmi");
ProfileReference profileReference = new ProfileReference(
- "/org/argouml/language/x/profile/name.xmi", publicReference);
+ "/org/argouml/language/x/profile/name.xmi", publicReference);
assertEquals(publicReference, profileReference.getPublicReference());
}
}
Modified: trunk/src/argouml-app/tests/org/argouml/profile/TestReaderModelLoader.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/tests/org/argouml/profile/TestReaderModelLoader.java?view=diff&rev=15337&p1=trunk/src/argouml-app/tests/org/argouml/profile/TestReaderModelLoader.java&p2=trunk/src/argouml-app/tests/org/argouml/profile/TestReaderModelLoader.java&r1=15336&r2=15337
==============================================================================
--- trunk/src/argouml-app/tests/org/argouml/profile/TestReaderModelLoader.java (original)
+++ trunk/src/argouml-app/tests/org/argouml/profile/TestReaderModelLoader.java 2008-07-22 08:12:12-0700
@@ -38,7 +38,7 @@
/**
* Tests for the {@link ReaderModelLoader} class.
- *
+ *
* @author Luis Sergio Oliveira (euluis)
*/
public class TestReaderModelLoader extends TestCase {
@@ -49,7 +49,7 @@
Reader reader = new StringReader("dummy string");
new ReaderModelLoader(reader);
}
-
+
/**
* Test {@link ReaderModelLoader#loadModel(ProfileReference)}.
*
@@ -64,10 +64,10 @@
File file = new File(testDir, "testSaveProfileModel.xmi");
mother.saveProfileModel(model, file);
Reader reader = new FileReader(file);
- ProfileReference profileReference = new UserProfileReference(file
- .toURI().toURL().toExternalForm());
- Collection models = new ReaderModelLoader(reader)
- .loadModel(profileReference);
+ ProfileReference profileReference = new UserProfileReference(
+ file.toURL().toExternalForm());
+ Collection models = new ReaderModelLoader(reader).
+ loadModel(profileReference);
assertNotNull(models);
assertTrue(models.size() >= 1);
}
Modified: trunk/src/argouml-app/tests/org/argouml/profile/TestSubsystemInit.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/tests/org/argouml/profile/TestSubsystemInit.java?view=diff&rev=15337&p1=trunk/src/argouml-app/tests/org/argouml/profile/TestSubsystemInit.java&p2=trunk/src/argouml-app/tests/org/argouml/profile/TestSubsystemInit.java&r1=15336&r2=15337
==============================================================================
--- trunk/src/argouml-app/tests/org/argouml/profile/TestSubsystemInit.java (original)
+++ trunk/src/argouml-app/tests/org/argouml/profile/TestSubsystemInit.java 2008-07-22 08:12:12-0700
@@ -31,11 +31,11 @@
/**
* Test cases for the initialization of the profile subsystem.
- *
+ *
* @author Luis Sergio Oliveira (euluis)
*/
public class TestSubsystemInit extends TestCase {
-
+
private InitProfileSubsystem initSubsystem;
@Override
@@ -45,15 +45,11 @@
initSubsystem = new InitProfileSubsystem();
}
- /**
- * tests subsystem initialization
- */
public void testInitMakesManagerAvailableInFacade() {
try {
ProfileFacade.getManager();
fail("ProfileFacade shouldn't be initialized!");
- } catch (RuntimeException e) {
- }
+ } catch (RuntimeException e) { }
initSubsystem.init();
assertNotNull(ProfileFacade.getManager());
}
Modified: trunk/src/argouml-app/tests/org/argouml/profile/TestUserDefinedProfile.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/tests/org/argouml/profile/TestUserDefinedProfile.java?view=diff&rev=15337&p1=trunk/src/argouml-app/tests/org/argouml/profile/TestUserDefinedProfile.java&p2=trunk/src/argouml-app/tests/org/argouml/profile/TestUserDefinedProfile.java&r1=15336&r2=15337
==============================================================================
--- trunk/src/argouml-app/tests/org/argouml/profile/TestUserDefinedProfile.java (original)
+++ trunk/src/argouml-app/tests/org/argouml/profile/TestUserDefinedProfile.java 2008-07-22 08:12:12-0700
@@ -25,42 +25,34 @@
package org.argouml.profile;
import java.io.File;
-import java.util.HashSet;
-import java.util.Set;
import junit.framework.TestCase;
import org.argouml.FileHelper;
import org.argouml.model.InitializeModel;
-import org.argouml.profile.internal.ProfileManagerImpl;
-import org.argouml.profile.internal.ocl.CrOCL;
-import org.argouml.uml.cognitive.critics.CrUML;
/**
* Some basic tests for the {@link UserDefinedProfile} class.
*
* @author Luis Sergio Oliveira (euluis)
- * @authos maurelio1234
*/
public class TestUserDefinedProfile extends TestCase {
-
+
private File testDir;
@Override
protected void setUp() throws Exception {
super.setUp();
InitializeModel.initializeDefault();
- ProfileFacade.setManager(new ProfileManagerImpl());
-
testDir = FileHelper.setUpDir4Test(getClass());
}
-
+
@Override
protected void tearDown() throws Exception {
FileHelper.deleteDir(testDir);
super.tearDown();
}
-
+
/**
* Test loading of a very simple profile via its constructor. Check that its
* display name contains the file name.
@@ -78,35 +70,4 @@
assertTrue(profile.getDisplayName().contains(profileFile.getName()));
}
- /**
- * Test the constructor used for loading a profile from a Jar file TODO Test
- * FigNode!
- *
- * @throws Exception if something goes wrong
- */
- public void testLoadingAsFromJar() throws Exception {
- ProfileManager pm = ProfileFacade.getManager();
-
- // create profile model
- ProfileMother profileMother = new ProfileMother();
- Object model = profileMother.createSimpleProfileModel();
- // save the profile into a xmi file
- File profileFile = new File(testDir, "testLoadingConstructor.xmi");
- profileMother.saveProfileModel(model, profileFile);
-
- CrOCL critic = new CrOCL("context Class inv: 3 > 2", null, null, null,
- null, null, null);
- Set<CrUML> critics = new HashSet<CrUML>();
- critics.add(critic);
-
- Set<String> profiles = new HashSet<String>();
- profiles.add(pm.getUMLProfile().getProfileIdentifier());
-
- Profile profile = new UserDefinedProfile("displayName", profileFile
- .toURI().toURL(), critics, profiles);
-
- assertEquals(profile.getDisplayName(), "displayName");
- assertTrue(profile.getDependencies().contains(pm.getUMLProfile()));
- assertTrue(profile.getCritics().contains(critic));
- }
}
Modified: trunk/src/argouml-app/tests/org/argouml/profile/TestUserProfileReference.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/tests/org/argouml/profile/TestUserProfileReference.java?view=diff&rev=15337&p1=trunk/src/argouml-app/tests/org/argouml/profile/TestUserProfileReference.java&p2=trunk/src/argouml-app/tests/org/argouml/profile/TestUserProfileReference.java&r1=15336&r2=15337
==============================================================================
--- trunk/src/argouml-app/tests/org/argouml/profile/TestUserProfileReference.java (original)
+++ trunk/src/argouml-app/tests/org/argouml/profile/TestUserProfileReference.java 2008-07-22 08:12:12-0700
@@ -32,35 +32,38 @@
/**
* Unit tests for UserProfileReference class.
- *
+ *
* @author Luis Sergio Oliveira (euluis)
*/
public class TestUserProfileReference extends TestCase {
-
+
/**
- * Tests {@link UserProfileReference#UserProfileReference(String)} in the
+ * Tests {@link UserProfileReference#UserProfileReference(String)} in the
* happy path.
*
* @throws MalformedURLException if the built URL is incorrect.
*/
public void testCtorHappyPath() throws MalformedURLException {
String fileName = "profileName.xmi";
- // [euluis] Using Windows style initial path, don't know if this fails
+ // [euluis] Using Windows style initial path, don't know if this fails
// in *nixes.
- String path = "C:" + File.separatorChar + "userProfilesDir"
- + File.separatorChar + fileName;
+ String path = "C:" + File.separatorChar + "userProfilesDir"
+ + File.separatorChar + fileName;
ProfileReference reference = new UserProfileReference(path);
assertEquals(path, reference.getPath());
- assertEquals(new URL(UserProfileReference.DEFAULT_USER_PROFILE_BASE_URL
- + fileName), reference.getPublicReference());
+ assertEquals(
+ new URL(UserProfileReference.DEFAULT_USER_PROFILE_BASE_URL
+ + fileName),
+ reference.getPublicReference());
}
-
+
/**
* Tests that the constructor checks for empty file name.
*
* @throws MalformedURLException if the built URL is incorrect.
*/
- public void testCtorFailsWhenFileNameIsEmpty() throws MalformedURLException {
+ public void testCtorFailsWhenFileNameIsEmpty()
+ throws MalformedURLException {
try {
new UserProfileReference("");
fail("Expecting AssertionError due to empty file name.");
@@ -68,13 +71,14 @@
// expected
}
}
-
+
/**
* Tests that the constructor checks for null file name.
*
* @throws MalformedURLException if the built URL is incorrect.
*/
- public void testCtorFailsWhenFileNameIsNull() throws MalformedURLException {
+ public void testCtorFailsWhenFileNameIsNull()
+ throws MalformedURLException {
try {
new UserProfileReference(null);
fail("Expecting NullPointerException due to null path.");
@@ -82,5 +86,5 @@
// expected
}
}
-
+
}
Modified: trunk/src/argouml-app/tests/org/argouml/profile/internal/TestProfileJava.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/tests/org/argouml/profile/internal/TestProfileJava.java?view=diff&rev=15337&p1=trunk/src/argouml-app/tests/org/argouml/profile/internal/TestProfileJava.java&p2=trunk/src/argouml-app/tests/org/argouml/profile/internal/TestProfileJava.java&r1=15336&r2=15337
==============================================================================
--- trunk/src/argouml-app/tests/org/argouml/profile/internal/TestProfileJava.java (original)
+++ trunk/src/argouml-app/tests/org/argouml/profile/internal/TestProfileJava.java 2008-07-22 08:12:12-0700
@@ -32,11 +32,11 @@
/**
* Tests for the ProfileJava class.
- *
+ *
* @author Luis Sergio Oliveira (euluis)
*/
public class TestProfileJava extends TestCase {
-
+
@Override
protected void setUp() throws Exception {
super.setUp();
@@ -44,20 +44,10 @@
new InitProfileSubsystem().init();
}
- /**
- * test java profile creation
- *
- * @throws ProfileException if something goes wrong
- */
public void testProfileJava() throws ProfileException {
new ProfileJava(new ProfileUML());
}
-
- /**
- * test java profile creation
- *
- * @throws Exception if something goes wrong
- */
+
public void testProfileJavaNoArgs() throws Exception {
new ProfileJava();
}
Modified: trunk/src/argouml-app/tests/org/argouml/profile/internal/TestProfileManagerImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/tests/org/argouml/profile/internal/TestProfileManagerImpl.java?view=diff&rev=15337&p1=trunk/src/argouml-app/tests/org/argouml/profile/internal/TestProfileManagerImpl.java&p2=trunk/src/argouml-app/tests/org/argouml/profile/internal/TestProfileManagerImpl.java&r1=15336&r2=15337
==============================================================================
--- trunk/src/argouml-app/tests/org/argouml/profile/internal/TestProfileManagerImpl.java (original)
+++ trunk/src/argouml-app/tests/org/argouml/profile/internal/TestProfileManagerImpl.java 2008-07-22 08:12:12-0700
@@ -36,11 +36,11 @@
/**
* Tests for the ProfileManagerImpl class.
- *
+ *
* @author Luis Sergio Oliveira (euluis)
*/
public class TestProfileManagerImpl extends TestCase {
-
+
private ProfileManager manager;
@Override
@@ -50,39 +50,30 @@
manager = new ProfileManagerImpl();
}
- /**
- * test profile manager
- */
public void testProfileManagerImpl() {
List<Profile> registeredProfiles = manager.getRegisteredProfiles();
assertTrue(2 <= registeredProfiles.size());
Set<String> internalProfileNameSet = new HashSet<String>();
for (Profile profile : registeredProfiles) {
- if (profile.getDisplayName().equals(ProfileUML.NAME)
+ if (profile.getDisplayName().equals(ProfileUML.NAME)
|| profile.getDisplayName().equals(ProfileJava.NAME))
internalProfileNameSet.add(profile.getDisplayName());
}
assertEquals(2, internalProfileNameSet.size());
}
-
- /**
- * test remove profile
- */
+
public void testRemoveProfileThatIsntDefault() {
- Profile javaProfile = manager.getProfileForClass(ProfileJava.class
- .getName());
+ Profile javaProfile = manager.getProfileForClass(
+ ProfileJava.class.getName());
assertNotNull(javaProfile);
assertTrue(manager.getRegisteredProfiles().contains(javaProfile));
manager.removeProfile(javaProfile);
assertFalse(manager.getRegisteredProfiles().contains(javaProfile));
}
-
- /**
- * test remove profile
- */
+
public void testRemoveDefaultProfile() {
- Profile umlProfile = manager.getProfileForClass(ProfileUML.class
- .getName());
+ Profile umlProfile = manager.getProfileForClass(
+ ProfileUML.class.getName());
assertNotNull(umlProfile);
assertTrue(manager.getRegisteredProfiles().contains(umlProfile));
assertTrue(manager.getDefaultProfiles().contains(umlProfile));
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.