/**
  * 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
   // in *nixes.
   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());
 }
  /**
   * Reads the informations defined as TaggedValues
   *
   * @param manager the profile manager which will be used to resolve dependencies
   */
  private void loadModel() {
    synchronized (packageLock) {
      if (profilePackages == null) {
        try {
          if (modelFile != null) {
            profilePackages = new FileModelLoader().loadModel(reference);
          } else {
            profilePackages = new URLModelLoader().loadModel(reference);
          }
        } catch (ProfileException e1) {
          LOG.log(Level.SEVERE, "Exception loading profile " + reference.getPath(), e1);
          profilePackages = Collections.emptySet();
          return;
        }
      }

      Collection packagesInProfile = filterPackages(profilePackages);

      for (Object obj : packagesInProfile) {
        // if there is only one package in the model,
        // we should suppose it's the profile model,
        // if there is more than one, we take the ones
        // marked as <<profile>>
        if (Model.getFacade().isAModelElement(obj)
            && (Model.getFacade().isAProfile(obj) || (packagesInProfile.size() == 1))) {

          // load profile name
          String name = Model.getFacade().getName(obj);
          if (name != null) {
            displayName = name;
          } else {
            if (displayName == null) {
              displayName = Translator.localize("misc.profile.unnamed");
            }
          }
          LOG.log(Level.INFO, "profile {0}", displayName);

          loadDependentProfiles(obj);
        }
      }

      loadFigNodes(packagesInProfile);
    }
  }