ProfileConfigurationFilePersister.java

1
/* $Id: ProfileConfigurationFilePersister.java 19907 2012-12-30 13:06:01Z closettop_nightlybuild $
2
 *****************************************************************************
3
 * Copyright (c) 2009-2012 Contributors - see below
4
 * All rights reserved. This program and the accompanying materials
5
 * are made available under the terms of the Eclipse Public License v1.0
6
 * which accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 *
9
 * Contributors:
10
 *    tfmorris
11
 *****************************************************************************
12
 *
13
 * Some portions of this file was previously release using the BSD License:
14
 */
15
16
// Copyright (c) 2007-2009 The Regents of the University of California. All
17
// Rights Reserved. Permission to use, copy, modify, and distribute this
18
// software and its documentation without fee, and without a written
19
// agreement is hereby granted, provided that the above copyright notice
20
// and this paragraph appear in all copies. This software program and
21
// documentation are copyrighted by The Regents of the University of
22
// California. The software program and documentation are supplied "AS
23
// IS", without any accompanying services from The Regents. The Regents
24
// does not warrant that the operation of the program will be
25
// uninterrupted or error-free. The end-user understands that the program
26
// was developed for research purposes and is advised not to rely
27
// exclusively on the program for any reason. IN NO EVENT SHALL THE
28
// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
29
// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
30
// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
31
// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
32
// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
33
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
34
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
35
// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
36
// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
37
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
38
39
package org.argouml.persistence;
40
41
import java.io.File;
42
import java.io.FileOutputStream;
43
import java.io.IOException;
44
import java.io.InputStream;
45
import java.io.OutputStream;
46
import java.io.OutputStreamWriter;
47
import java.io.PrintWriter;
48
import java.io.StringWriter;
49
import java.io.UnsupportedEncodingException;
50
import java.net.URL;
51
import java.util.ArrayList;
52
import java.util.Collection;
53
import java.util.List;
54
import java.util.logging.Level;
55
import java.util.logging.Logger;
56
57
import org.argouml.application.api.Argo;
58
import org.argouml.application.helpers.ApplicationVersion;
59
import org.argouml.configuration.Configuration;
60
import org.argouml.kernel.ProfileConfiguration;
61
import org.argouml.kernel.Project;
62
import org.argouml.kernel.ProjectMember;
63
import org.argouml.model.Model;
64
import org.argouml.model.UmlException;
65
import org.argouml.model.XmiWriter;
66
import org.argouml.profile.Profile;
67
import org.argouml.profile.ProfileFacade;
68
import org.argouml.profile.ProfileManager;
69
import org.argouml.profile.UserDefinedProfile;
70
import org.xml.sax.InputSource;
71
import org.xml.sax.SAXException;
72
73
/**
74
 * Persister for project's profile configuration.
75
 *
76
 * @author maurelio1234
77
 */
78
public class ProfileConfigurationFilePersister extends MemberFilePersister {
79
80
    private static final Logger LOG =
81
        Logger.getLogger(ProfileConfigurationFilePersister.class.getName());
82
83
    /*
84
     * @see org.argouml.persistence.MemberFilePersister#getMainTag()
85
     */
86
    public String getMainTag() {
87 1 1. getMainTag : mutated return of Object value for org/argouml/persistence/ProfileConfigurationFilePersister::getMainTag to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return "profile";
88
    }
89
90
    public void load(Project project, InputStream inputStream)
91
        throws OpenException {
92 1 1. load : removed call to org/argouml/persistence/ProfileConfigurationFilePersister::load → NO_COVERAGE
        load(project, new InputSource(inputStream));
93
    }
94
95
    /*
96
     * @see org.argouml.persistence.MemberFilePersister#load(org.argouml.kernel.Project, java.io.InputStream)
97
     */
98
    public void load(Project project, InputSource inputSource)
99
        throws OpenException {
100
        try {
101
            ProfileConfigurationParser parser =
102
                new ProfileConfigurationParser();
103 1 1. load : removed call to org/argouml/persistence/ProfileConfigurationParser::parse → NO_COVERAGE
            parser.parse(inputSource);
104
            Collection<Profile> profiles = parser.getProfiles();
105
106
            Collection<String> unresolved = parser.getUnresolvedFilenames();
107 1 1. load : negated conditional → NO_COVERAGE
            if (!unresolved.isEmpty()) {
108
                profiles.addAll(loadUnresolved(unresolved));
109
            }
110
111
            ProfileConfiguration pc = new ProfileConfiguration(project,
112
                    profiles);
113 1 1. load : removed call to org/argouml/kernel/Project::setProfileConfiguration → NO_COVERAGE
            project.setProfileConfiguration(pc);
114
        } catch (Exception e) {
115 1 1. load : negated conditional → NO_COVERAGE
            if (e instanceof OpenException) {
116
                throw (OpenException) e;
117
            }
118
            throw new OpenException(e);
119
        }
120
    }
121
122
123
    /**
124
     * Use XMI as a fall back alternative when the file for the user defined
125
     * profile isn't found by the profile manager.
126
     * <p>
127
     * TODO: work in progress, see issue 5039
128
     *
129
     * @param unresolved collection of unresolved filenames from the parser
130
     * @return collection of resolved profiles
131
     */
132
    private Collection<Profile> loadUnresolved(Collection<String> unresolved) {
133
        Collection<Profile> profiles = new ArrayList<Profile>();
134
        ProfileManager profileManager = ProfileFacade.getManager();
135 1 1. loadUnresolved : negated conditional → NO_COVERAGE
        for (String filename : unresolved) {
136
            // TODO: work in progress, see issue 5039
137
//            addUserDefinedProfile(filename, xmi, profileManager);
138
//            Profile profile = getMatchingUserDefinedProfile(filename,
139
//                    profileManager);
140
//            assert profile != null : "Profile should have been found now.";
141
//            profiles.add(profile);
142
        }
143 1 1. loadUnresolved : mutated return of Object value for org/argouml/persistence/ProfileConfigurationFilePersister::loadUnresolved to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return profiles;
144
    }
145
146
    /**
147
     * Register a user defined profile in the profileManager, using the backup
148
     * XMI file from the project being loaded.
149
     * <p>
150
     * <em>NOTE:</em> This has the side effect of permanently registering the
151
     * profile which may not be what the user wants.
152
     *
153
     * @param fileName name of original XMI file that the author of the project
154
     *                used when creating the UserDefinedProfile.
155
     * @param xmi the contents of the XMI file.
156
     * @param profileManager the {@link ProfileManager}.
157
     * @throws IOException on any i/o error
158
     */
159
    private void addUserDefinedProfile(String fileName, StringBuffer xmi,
160
            ProfileManager profileManager) throws IOException {
161
        File profilesDirectory = getProfilesDirectory(profileManager);
162
        File profileFile = new File(profilesDirectory, fileName);
163
        OutputStreamWriter writer = new OutputStreamWriter(
164
                new FileOutputStream(profileFile),
165
                Argo.getEncoding());
166 1 1. addUserDefinedProfile : removed call to java/io/OutputStreamWriter::write → NO_COVERAGE
        writer.write(xmi.toString());
167 1 1. addUserDefinedProfile : removed call to java/io/OutputStreamWriter::close → NO_COVERAGE
        writer.close();
168
169
        LOG.log(Level.INFO,
170
                "Wrote user defined profile \"{0}\", with size {1}.",
171
                new Object[]{profileFile, xmi.length()});
172
173 1 1. addUserDefinedProfile : negated conditional → NO_COVERAGE
        if (isSomeProfileDirectoryConfigured(profileManager)) {
174 1 1. addUserDefinedProfile : removed call to org/argouml/profile/ProfileManager::refreshRegisteredProfiles → NO_COVERAGE
            profileManager.refreshRegisteredProfiles();
175
        } else {
176 1 1. addUserDefinedProfile : removed call to org/argouml/profile/ProfileManager::addSearchPathDirectory → NO_COVERAGE
            profileManager.addSearchPathDirectory(
177
                profilesDirectory.getAbsolutePath());
178
        }
179
    }
180
181
182
    private static File getProfilesDirectory(ProfileManager profileManager) {
183 1 1. getProfilesDirectory : negated conditional → NO_COVERAGE
        if (isSomeProfileDirectoryConfigured(profileManager)) {
184
            List<String> directories =
185
                profileManager.getSearchPathDirectories();
186 1 1. getProfilesDirectory : mutated return of Object value for org/argouml/persistence/ProfileConfigurationFilePersister::getProfilesDirectory to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return new File(directories.get(0));
187
        } else {
188
            File userSettingsFile = new File(
189
                Configuration.getFactory().getConfigurationHandler().
190
                    getDefaultPath());
191 1 1. getProfilesDirectory : mutated return of Object value for org/argouml/persistence/ProfileConfigurationFilePersister::getProfilesDirectory to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return userSettingsFile.getParentFile();
192
        }
193
    }
194
195
    private static boolean isSomeProfileDirectoryConfigured(
196
            ProfileManager profileManager) {
197 4 1. isSomeProfileDirectoryConfigured : changed conditional boundary → NO_COVERAGE
2. isSomeProfileDirectoryConfigured : negated conditional → NO_COVERAGE
3. isSomeProfileDirectoryConfigured : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
4. isSomeProfileDirectoryConfigured : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
        return profileManager.getSearchPathDirectories().size() > 0;
198
    }
199
200
    /*
201
     * @see org.argouml.persistence.MemberFilePersister#save(org.argouml.kernel.ProjectMember, java.io.OutputStream)
202
     */
203
    public void save(ProjectMember member, OutputStream stream)
204
	throws SaveException {
205
206
        PrintWriter w;
207
        try {
208
            w = new PrintWriter(new OutputStreamWriter(stream, "UTF-8"));
209
        } catch (UnsupportedEncodingException e1) {
210
            throw new SaveException("UTF-8 encoding not supported on platform",
211
                    e1);
212
        }
213 1 1. save : removed call to org/argouml/persistence/ProfileConfigurationFilePersister::saveProjectMember → NO_COVERAGE
        saveProjectMember(member, w);
214 1 1. save : removed call to java/io/PrintWriter::flush → NO_COVERAGE
        w.flush();
215
    }
216
217
    private void saveProjectMember(ProjectMember member, PrintWriter w)
218
	throws SaveException {
219
220
        try {
221 1 1. saveProjectMember : negated conditional → NO_COVERAGE
	    if (member instanceof ProfileConfiguration) {
222
		ProfileConfiguration pc = (ProfileConfiguration) member;
223
224 1 1. saveProjectMember : removed call to java/io/PrintWriter::println → NO_COVERAGE
		w.println("<?xml version = \"1.0\" encoding = \"UTF-8\" ?>");
225
		// TODO: This DTD doesn't exist, so we can't tell readers to
226
		// look for it
227
//		w.println("<!DOCTYPE profile SYSTEM \"profile.dtd\" >");
228
		// but we need a 2nd line to make the funky UML persister work
229 1 1. saveProjectMember : removed call to java/io/PrintWriter::println → NO_COVERAGE
		w.println(""); // remove this line if the above is uncommented
230 1 1. saveProjectMember : removed call to java/io/PrintWriter::println → NO_COVERAGE
		w.println("<profile>");
231
232 1 1. saveProjectMember : negated conditional → NO_COVERAGE
		for (Profile profile : pc.getProfiles()) {
233 1 1. saveProjectMember : negated conditional → NO_COVERAGE
                    if (profile instanceof UserDefinedProfile) {
234
                        UserDefinedProfile uprofile =
235
                            (UserDefinedProfile) profile;
236 1 1. saveProjectMember : removed call to java/io/PrintWriter::println → NO_COVERAGE
                        w.println("\t\t<userDefined>");
237 1 1. saveProjectMember : removed call to java/io/PrintWriter::println → NO_COVERAGE
                        w.println("\t\t\t<filename>"
238
                                + uprofile.getModelFile().getName()
239
                                + "</filename>");
240 1 1. saveProjectMember : removed call to java/io/PrintWriter::println → NO_COVERAGE
                        w.println("\t\t\t<model>");
241
242 1 1. saveProjectMember : removed call to org/argouml/persistence/ProfileConfigurationFilePersister::printModelXMI → NO_COVERAGE
                        printModelXMI(w, uprofile.getProfilePackages());
243
244 1 1. saveProjectMember : removed call to java/io/PrintWriter::println → NO_COVERAGE
                        w.println("\t\t\t</model>");
245 1 1. saveProjectMember : removed call to java/io/PrintWriter::println → NO_COVERAGE
                        w.println("\t\t</userDefined>");
246
                    } else {
247 1 1. saveProjectMember : removed call to java/io/PrintWriter::println → NO_COVERAGE
                        w.println("\t\t<plugin>");
248 1 1. saveProjectMember : removed call to java/io/PrintWriter::println → NO_COVERAGE
                        w.println("\t\t\t" + profile.getProfileIdentifier());
249 1 1. saveProjectMember : removed call to java/io/PrintWriter::println → NO_COVERAGE
                        w.println("\t\t</plugin>");
250
                    }
251
                }
252
253 1 1. saveProjectMember : removed call to java/io/PrintWriter::println → NO_COVERAGE
		w.println("</profile>");
254
	    }
255
	} catch (Exception e) {
256 1 1. saveProjectMember : removed call to java/lang/Exception::printStackTrace → NO_COVERAGE
	    e.printStackTrace();
257
	    throw new SaveException(e);
258
	}
259
    }
260
261
    private void printModelXMI(PrintWriter w, Collection profileModels)
262
        throws UmlException {
263
264
        // TODO: Why is this not executed?  Remove if not needed - tfm
265
        if (true) {
266
            return;
267
        }
268
269
        StringWriter myWriter = new StringWriter();
270
        for (Object model : profileModels) {
271
            XmiWriter xmiWriter = Model.getXmiWriter(model,
272
                (OutputStream) null, //myWriter,
273
                ApplicationVersion.getVersion() + "("
274
                    + UmlFilePersister.PERSISTENCE_VERSION + ")");
275
            xmiWriter.write();
276
        }
277
278
        myWriter.flush();
279
        w.println("" + myWriter.toString());
280
    }
281
282
283
    @Override
284
    public void load(Project project, URL url) throws OpenException {
285 1 1. load : removed call to org/argouml/persistence/ProfileConfigurationFilePersister::load → NO_COVERAGE
        load(project, new InputSource(url.toExternalForm()));
286
    }
287
288
}
289
290
/**
291
 * Parser for Profile Configuration.
292
 *
293
 * @author Tom Morris <tfmorris@gmail.com>
294
 */
295
class ProfileConfigurationParser extends SAXParserBase {
296
297
    private static final Logger LOG =
298
        Logger.getLogger(ProfileConfigurationParser.class.getName());
299
300
    private ProfileConfigurationTokenTable tokens =
301
        new ProfileConfigurationTokenTable();
302
303
    private Profile profile;
304
305
    private String model;
306
307
    private String filename;
308
309
    private Collection<Profile> profiles = new ArrayList<Profile>();
310
311
    private Collection<String> unresolvedFilenames = new ArrayList<String>();
312
313
    /**
314
     * Construct the parser.
315
     */
316
    public ProfileConfigurationParser() {
317
        // Empty constructor
318
    }
319
320
    public Collection<Profile> getProfiles() {
321 1 1. getProfiles : mutated return of Object value for org/argouml/persistence/ProfileConfigurationParser::getProfiles to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return profiles;
322
    }
323
324
    public Collection<String> getUnresolvedFilenames() {
325 1 1. getUnresolvedFilenames : mutated return of Object value for org/argouml/persistence/ProfileConfigurationParser::getUnresolvedFilenames to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return unresolvedFilenames;
326
    }
327
328
    public void handleStartElement(XMLElement e) {
329
330
        try {
331
            switch (tokens.toToken(e.getName(), true)) {
332
333
            case ProfileConfigurationTokenTable.TOKEN_PROFILE:
334
                break;
335
            case ProfileConfigurationTokenTable.TOKEN_PLUGIN:
336
                profile = null;
337
                break;
338
            case ProfileConfigurationTokenTable.TOKEN_USER_DEFINED:
339
                profile = null;
340
                filename = null;
341
                model = null;
342
                break;
343
            case ProfileConfigurationTokenTable.TOKEN_FILENAME:
344
                break;
345
            case ProfileConfigurationTokenTable.TOKEN_MODEL:
346
                break;
347
348
            default:
349
                LOG.log(Level.WARNING, "WARNING: unknown tag:" + e.getName());
350
                break;
351
            }
352
        } catch (Exception ex) {
353
            LOG.log(Level.SEVERE, "Exception in startelement", ex);
354
        }
355
    }
356
357
    /**
358
     * Called by the XML implementation to signal the end of an XML entity.
359
     *
360
     * @param e The XML entity that ends.
361
     * @throws SAXException on any error
362
     */
363
    public void handleEndElement(XMLElement e) throws SAXException {
364
365
        try {
366
            switch (tokens.toToken(e.getName(), false)) {
367
368
            case ProfileConfigurationTokenTable.TOKEN_PROFILE:
369 1 1. handleEndElement : removed call to org/argouml/persistence/ProfileConfigurationParser::handleProfileEnd → NO_COVERAGE
                handleProfileEnd(e);
370
                break;
371
            case ProfileConfigurationTokenTable.TOKEN_PLUGIN:
372 1 1. handleEndElement : removed call to org/argouml/persistence/ProfileConfigurationParser::handlePluginEnd → NO_COVERAGE
                handlePluginEnd(e);
373
                break;
374
            case ProfileConfigurationTokenTable.TOKEN_USER_DEFINED:
375 1 1. handleEndElement : removed call to org/argouml/persistence/ProfileConfigurationParser::handleUserDefinedEnd → NO_COVERAGE
                handleUserDefinedEnd(e);
376
                break;
377
            case ProfileConfigurationTokenTable.TOKEN_FILENAME:
378 1 1. handleEndElement : removed call to org/argouml/persistence/ProfileConfigurationParser::handleFilenameEnd → NO_COVERAGE
                handleFilenameEnd(e);
379
                break;
380
            case ProfileConfigurationTokenTable.TOKEN_MODEL:
381 1 1. handleEndElement : removed call to org/argouml/persistence/ProfileConfigurationParser::handleModelEnd → NO_COVERAGE
                handleModelEnd(e);
382
                break;
383
384
            default:
385
                LOG.log(Level.WARNING,
386
                        "WARNING: unknown end tag:" + e.getName());
387
                break;
388
            }
389
        } catch (Exception ex) {
390
            throw new SAXException(ex);
391
        }
392
    }
393
394
    protected void handleProfileEnd(XMLElement e) {
395 1 1. handleProfileEnd : negated conditional → NO_COVERAGE
        if (profiles.isEmpty()) {
396
            LOG.log(Level.WARNING, "No profiles defined");
397
        }
398
    }
399
400
    protected void handlePluginEnd(XMLElement e) throws SAXException {
401
        String name = e.getText().trim();
402
        profile = lookupProfile(name);
403 1 1. handlePluginEnd : negated conditional → NO_COVERAGE
        if (profile != null) {
404
            profiles.add(profile);
405
            LOG.log(Level.FINE, "Found plugin profile {0}", name);
406
        } else {
407
            LOG.log(Level.SEVERE, "Unabled to find plugin profile - {0}", name);
408
        }
409
    }
410
411
    private static Profile lookupProfile(String profileIdentifier)
412
        throws SAXException {
413
        Profile profile;
414
        profile = ProfileFacade.getManager().lookForRegisteredProfile(
415
                profileIdentifier);
416 1 1. lookupProfile : negated conditional → NO_COVERAGE
        if (profile == null) {
417
418
            // for compatibility with older format
419
            profile = ProfileFacade.getManager().getProfileForClass(
420
                    profileIdentifier);
421
422 1 1. lookupProfile : negated conditional → NO_COVERAGE
            if (profile == null) {
423
                throw new SAXException("Plugin profile \"" + profileIdentifier
424
                        + "\" is not available in installation.", null);
425
            }
426
        }
427 1 1. lookupProfile : mutated return of Object value for org/argouml/persistence/ProfileConfigurationParser::lookupProfile to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return profile;
428
    }
429
430
    protected void handleUserDefinedEnd(XMLElement e) {
431
        // <model> is not used in current implementation
432 1 1. handleUserDefinedEnd : negated conditional → NO_COVERAGE
        if (filename == null /* || model == null */) {
433
            LOG.log(Level.SEVERE,
434
                    "Got badly formed user defined profile entry " + e);
435
        }
436
        profile = getMatchingUserDefinedProfile(filename, ProfileFacade
437
                .getManager());
438
439 1 1. handleUserDefinedEnd : negated conditional → NO_COVERAGE
        if (profile == null) {
440
            unresolvedFilenames.add(filename);
441
        } else {
442
            profiles.add(profile);
443
            LOG.log(Level.FINE,
444
                    "Loaded user defined profile - filename = {0}", filename);
445
        }
446
447
    }
448
449
    private static Profile getMatchingUserDefinedProfile(String fileName,
450
            ProfileManager profileManager) {
451 1 1. getMatchingUserDefinedProfile : negated conditional → NO_COVERAGE
        for (Profile candidateProfile
452
                : profileManager.getRegisteredProfiles()) {
453 1 1. getMatchingUserDefinedProfile : negated conditional → NO_COVERAGE
            if (candidateProfile instanceof UserDefinedProfile) {
454
                UserDefinedProfile userProfile =
455
                    (UserDefinedProfile) candidateProfile;
456 1 1. getMatchingUserDefinedProfile : negated conditional → NO_COVERAGE
                if (userProfile.getModelFile() != null
457
                        && fileName
458 1 1. getMatchingUserDefinedProfile : negated conditional → NO_COVERAGE
                                .equals(userProfile.getModelFile().getName())) {
459 1 1. getMatchingUserDefinedProfile : mutated return of Object value for org/argouml/persistence/ProfileConfigurationParser::getMatchingUserDefinedProfile to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                    return userProfile;
460
                }
461
            }
462
        }
463 1 1. getMatchingUserDefinedProfile : mutated return of Object value for org/argouml/persistence/ProfileConfigurationParser::getMatchingUserDefinedProfile to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return null;
464
    }
465
466
    protected void handleFilenameEnd(XMLElement e) {
467
        filename = e.getText().trim();
468
        LOG.log(Level.FINE, "Got filename = {0}", filename);
469
    }
470
471
    protected void handleModelEnd(XMLElement e) {
472
        model = e.getText().trim();
473
        LOG.log(Level.FINE, "Got model = {0}", model);
474
    }
475
476
    /**
477
     * Token Table for Profile Configuration parser.
478
     *
479
     * @author Tom Morris
480
     */
481
    class ProfileConfigurationTokenTable extends XMLTokenTableBase {
482
483
        private static final String STRING_PROFILE = "profile";
484
485
        private static final String STRING_PLUGIN = "plugin";
486
487
        private static final String STRING_USER_DEFINED = "userDefined";
488
489
        private static final String STRING_FILENAME = "filename";
490
491
        private static final String STRING_MODEL = "model";
492
493
        public static final int TOKEN_PROFILE = 1;
494
495
        public static final int TOKEN_PLUGIN = 2;
496
497
        public static final int TOKEN_USER_DEFINED = 3;
498
499
        public static final int TOKEN_FILENAME = 4;
500
501
        public static final int TOKEN_MODEL = 5;
502
503
        private static final int TOKEN_LAST = 5;
504
505
        public static final int TOKEN_UNDEFINED = 999;
506
507
        /**
508
         * Construct the token table.,
509
         */
510
        public ProfileConfigurationTokenTable() {
511
            super(TOKEN_LAST);
512
        }
513
514
        protected void setupTokens() {
515 1 1. setupTokens : removed call to org/argouml/persistence/ProfileConfigurationParser$ProfileConfigurationTokenTable::addToken → NO_COVERAGE
            addToken(STRING_PROFILE, Integer.valueOf(TOKEN_PROFILE));
516 1 1. setupTokens : removed call to org/argouml/persistence/ProfileConfigurationParser$ProfileConfigurationTokenTable::addToken → NO_COVERAGE
            addToken(STRING_PLUGIN, Integer.valueOf(TOKEN_PLUGIN));
517 1 1. setupTokens : removed call to org/argouml/persistence/ProfileConfigurationParser$ProfileConfigurationTokenTable::addToken → NO_COVERAGE
            addToken(STRING_USER_DEFINED, Integer.valueOf(TOKEN_USER_DEFINED));
518 1 1. setupTokens : removed call to org/argouml/persistence/ProfileConfigurationParser$ProfileConfigurationTokenTable::addToken → NO_COVERAGE
            addToken(STRING_FILENAME, Integer.valueOf(TOKEN_FILENAME));
519 1 1. setupTokens : removed call to org/argouml/persistence/ProfileConfigurationParser$ProfileConfigurationTokenTable::addToken → NO_COVERAGE
            addToken(STRING_MODEL, Integer.valueOf(TOKEN_MODEL));
520
        }
521
    }
522
523
}

Mutations

87

1.1
Location : getMainTag
Killed by : none
mutated return of Object value for org/argouml/persistence/ProfileConfigurationFilePersister::getMainTag to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

92

1.1
Location : load
Killed by : none
removed call to org/argouml/persistence/ProfileConfigurationFilePersister::load → NO_COVERAGE

103

1.1
Location : load
Killed by : none
removed call to org/argouml/persistence/ProfileConfigurationParser::parse → NO_COVERAGE

107

1.1
Location : load
Killed by : none
negated conditional → NO_COVERAGE

113

1.1
Location : load
Killed by : none
removed call to org/argouml/kernel/Project::setProfileConfiguration → NO_COVERAGE

115

1.1
Location : load
Killed by : none
negated conditional → NO_COVERAGE

135

1.1
Location : loadUnresolved
Killed by : none
negated conditional → NO_COVERAGE

143

1.1
Location : loadUnresolved
Killed by : none
mutated return of Object value for org/argouml/persistence/ProfileConfigurationFilePersister::loadUnresolved to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

166

1.1
Location : addUserDefinedProfile
Killed by : none
removed call to java/io/OutputStreamWriter::write → NO_COVERAGE

167

1.1
Location : addUserDefinedProfile
Killed by : none
removed call to java/io/OutputStreamWriter::close → NO_COVERAGE

173

1.1
Location : addUserDefinedProfile
Killed by : none
negated conditional → NO_COVERAGE

174

1.1
Location : addUserDefinedProfile
Killed by : none
removed call to org/argouml/profile/ProfileManager::refreshRegisteredProfiles → NO_COVERAGE

176

1.1
Location : addUserDefinedProfile
Killed by : none
removed call to org/argouml/profile/ProfileManager::addSearchPathDirectory → NO_COVERAGE

183

1.1
Location : getProfilesDirectory
Killed by : none
negated conditional → NO_COVERAGE

186

1.1
Location : getProfilesDirectory
Killed by : none
mutated return of Object value for org/argouml/persistence/ProfileConfigurationFilePersister::getProfilesDirectory to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

191

1.1
Location : getProfilesDirectory
Killed by : none
mutated return of Object value for org/argouml/persistence/ProfileConfigurationFilePersister::getProfilesDirectory to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

197

1.1
Location : isSomeProfileDirectoryConfigured
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : isSomeProfileDirectoryConfigured
Killed by : none
negated conditional → NO_COVERAGE

3.3
Location : isSomeProfileDirectoryConfigured
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

4.4
Location : isSomeProfileDirectoryConfigured
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

213

1.1
Location : save
Killed by : none
removed call to org/argouml/persistence/ProfileConfigurationFilePersister::saveProjectMember → NO_COVERAGE

214

1.1
Location : save
Killed by : none
removed call to java/io/PrintWriter::flush → NO_COVERAGE

221

1.1
Location : saveProjectMember
Killed by : none
negated conditional → NO_COVERAGE

224

1.1
Location : saveProjectMember
Killed by : none
removed call to java/io/PrintWriter::println → NO_COVERAGE

229

1.1
Location : saveProjectMember
Killed by : none
removed call to java/io/PrintWriter::println → NO_COVERAGE

230

1.1
Location : saveProjectMember
Killed by : none
removed call to java/io/PrintWriter::println → NO_COVERAGE

232

1.1
Location : saveProjectMember
Killed by : none
negated conditional → NO_COVERAGE

233

1.1
Location : saveProjectMember
Killed by : none
negated conditional → NO_COVERAGE

236

1.1
Location : saveProjectMember
Killed by : none
removed call to java/io/PrintWriter::println → NO_COVERAGE

237

1.1
Location : saveProjectMember
Killed by : none
removed call to java/io/PrintWriter::println → NO_COVERAGE

240

1.1
Location : saveProjectMember
Killed by : none
removed call to java/io/PrintWriter::println → NO_COVERAGE

242

1.1
Location : saveProjectMember
Killed by : none
removed call to org/argouml/persistence/ProfileConfigurationFilePersister::printModelXMI → NO_COVERAGE

244

1.1
Location : saveProjectMember
Killed by : none
removed call to java/io/PrintWriter::println → NO_COVERAGE

245

1.1
Location : saveProjectMember
Killed by : none
removed call to java/io/PrintWriter::println → NO_COVERAGE

247

1.1
Location : saveProjectMember
Killed by : none
removed call to java/io/PrintWriter::println → NO_COVERAGE

248

1.1
Location : saveProjectMember
Killed by : none
removed call to java/io/PrintWriter::println → NO_COVERAGE

249

1.1
Location : saveProjectMember
Killed by : none
removed call to java/io/PrintWriter::println → NO_COVERAGE

253

1.1
Location : saveProjectMember
Killed by : none
removed call to java/io/PrintWriter::println → NO_COVERAGE

256

1.1
Location : saveProjectMember
Killed by : none
removed call to java/lang/Exception::printStackTrace → NO_COVERAGE

285

1.1
Location : load
Killed by : none
removed call to org/argouml/persistence/ProfileConfigurationFilePersister::load → NO_COVERAGE

321

1.1
Location : getProfiles
Killed by : none
mutated return of Object value for org/argouml/persistence/ProfileConfigurationParser::getProfiles to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

325

1.1
Location : getUnresolvedFilenames
Killed by : none
mutated return of Object value for org/argouml/persistence/ProfileConfigurationParser::getUnresolvedFilenames to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

369

1.1
Location : handleEndElement
Killed by : none
removed call to org/argouml/persistence/ProfileConfigurationParser::handleProfileEnd → NO_COVERAGE

372

1.1
Location : handleEndElement
Killed by : none
removed call to org/argouml/persistence/ProfileConfigurationParser::handlePluginEnd → NO_COVERAGE

375

1.1
Location : handleEndElement
Killed by : none
removed call to org/argouml/persistence/ProfileConfigurationParser::handleUserDefinedEnd → NO_COVERAGE

378

1.1
Location : handleEndElement
Killed by : none
removed call to org/argouml/persistence/ProfileConfigurationParser::handleFilenameEnd → NO_COVERAGE

381

1.1
Location : handleEndElement
Killed by : none
removed call to org/argouml/persistence/ProfileConfigurationParser::handleModelEnd → NO_COVERAGE

395

1.1
Location : handleProfileEnd
Killed by : none
negated conditional → NO_COVERAGE

403

1.1
Location : handlePluginEnd
Killed by : none
negated conditional → NO_COVERAGE

416

1.1
Location : lookupProfile
Killed by : none
negated conditional → NO_COVERAGE

422

1.1
Location : lookupProfile
Killed by : none
negated conditional → NO_COVERAGE

427

1.1
Location : lookupProfile
Killed by : none
mutated return of Object value for org/argouml/persistence/ProfileConfigurationParser::lookupProfile to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

432

1.1
Location : handleUserDefinedEnd
Killed by : none
negated conditional → NO_COVERAGE

439

1.1
Location : handleUserDefinedEnd
Killed by : none
negated conditional → NO_COVERAGE

451

1.1
Location : getMatchingUserDefinedProfile
Killed by : none
negated conditional → NO_COVERAGE

453

1.1
Location : getMatchingUserDefinedProfile
Killed by : none
negated conditional → NO_COVERAGE

456

1.1
Location : getMatchingUserDefinedProfile
Killed by : none
negated conditional → NO_COVERAGE

458

1.1
Location : getMatchingUserDefinedProfile
Killed by : none
negated conditional → NO_COVERAGE

459

1.1
Location : getMatchingUserDefinedProfile
Killed by : none
mutated return of Object value for org/argouml/persistence/ProfileConfigurationParser::getMatchingUserDefinedProfile to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

463

1.1
Location : getMatchingUserDefinedProfile
Killed by : none
mutated return of Object value for org/argouml/persistence/ProfileConfigurationParser::getMatchingUserDefinedProfile to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

515

1.1
Location : setupTokens
Killed by : none
removed call to org/argouml/persistence/ProfileConfigurationParser$ProfileConfigurationTokenTable::addToken → NO_COVERAGE

516

1.1
Location : setupTokens
Killed by : none
removed call to org/argouml/persistence/ProfileConfigurationParser$ProfileConfigurationTokenTable::addToken → NO_COVERAGE

517

1.1
Location : setupTokens
Killed by : none
removed call to org/argouml/persistence/ProfileConfigurationParser$ProfileConfigurationTokenTable::addToken → NO_COVERAGE

518

1.1
Location : setupTokens
Killed by : none
removed call to org/argouml/persistence/ProfileConfigurationParser$ProfileConfigurationTokenTable::addToken → NO_COVERAGE

519

1.1
Location : setupTokens
Killed by : none
removed call to org/argouml/persistence/ProfileConfigurationParser$ProfileConfigurationTokenTable::addToken → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 0.32