| author | kwilk | 2012-02-10 01:46:29 (EST) |
|---|---|---|
| committer | Ryan D. Brooks | 2012-02-10 01:46:29 (EST) |
| commit | 02ed14a249ebafc4ea8f53b54f047c05e31476dd (patch) (side-by-side diff) | |
| tree | 77a448ddba44f0e334d24867d2abdb993cae0f0d | |
| parent | f162143dce76cf4d07a7212df5d732d019d45fd9 (diff) | |
| download | org.eclipse.osee-02ed14a249ebafc4ea8f53b54f047c05e31476dd.zip org.eclipse.osee-02ed14a249ebafc4ea8f53b54f047c05e31476dd.tar.gz org.eclipse.osee-02ed14a249ebafc4ea8f53b54f047c05e31476dd.tar.bz2 | |
refactor: Code quality improvements
15 files changed, 27 insertions, 51 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/FavoriteAction.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/FavoriteAction.java index b3458b6..9fb4708 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/FavoriteAction.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/FavoriteAction.java @@ -31,21 +31,21 @@ import org.eclipse.osee.framework.ui.swt.ImageManager; public class FavoriteAction extends AbstractAtsAction { private final ISelectedAtsArtifacts selectedAtsArtifacts; - private boolean prompt = true; + private boolean prompt; public FavoriteAction(ISelectedAtsArtifacts selectedAtsArtifacts) { - super(); this.selectedAtsArtifacts = selectedAtsArtifacts; + this.prompt = true; updateEnablement(); } public void updateEnablement() { String title = "Favorite"; try { - setEnabled(getSelectedFavoritableArts().size() > 0); - if (getSelectedFavoritableArts().size() == 1) { - title = - FavoritesManager.amIFavorite(getSelectedFavoritableArts().iterator().next()) ? "Remove Favorite" : "Add as Favorite"; + Collection<AbstractWorkflowArtifact> workflows = getSelectedFavoritableArts(); + setEnabled(!workflows.isEmpty()); + if (workflows.size() == 1) { + title = FavoritesManager.amIFavorite(workflows.iterator().next()) ? "Remove Favorite" : "Add as Favorite"; } else { title = "Toggle Favorites"; } diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeManager.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeManager.java index 7a952b0..866fbf0 100644 --- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeManager.java +++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeManager.java @@ -114,18 +114,6 @@ public class MergeManager { } } - if (debug) { - if (importCoverage.getGuid().equals("AAte3i2bH3L1MvsFMqAA")) { - System.out.println("here"); - } - if (importCoverage.getName().equals("NavigationButton2.java")) { - System.out.println("here"); - } - if (importCoverage.getName().equals("getImage")) { - System.out.println("here"); - } - } - int count = 0; // Determine match for all import item children for (ICoverage childCoverage : importItemChildren) { diff --git a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/commit/CommitTestSuite.java b/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/commit/CommitTestSuite.java index 1413d44..ad723ec 100644 --- a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/commit/CommitTestSuite.java +++ b/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/commit/CommitTestSuite.java @@ -21,5 +21,5 @@ BranchCommitServiceTest.class // * @author Roberto E. Escobar */ public class CommitTestSuite { - + // } diff --git a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/exchange/ExchangeTestSuite.java b/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/exchange/ExchangeTestSuite.java index 6a65a91..245c25b 100644 --- a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/exchange/ExchangeTestSuite.java +++ b/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/exchange/ExchangeTestSuite.java @@ -20,5 +20,5 @@ import org.junit.runners.Suite; @RunWith(Suite.class) @Suite.SuiteClasses({TransformerTestSuite.class}) public class ExchangeTestSuite { - + // } diff --git a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/exchange/transformer/TransformerTestSuite.java b/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/exchange/transformer/TransformerTestSuite.java index 393121d..7cccff3 100644 --- a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/exchange/transformer/TransformerTestSuite.java +++ b/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/exchange/transformer/TransformerTestSuite.java @@ -21,5 +21,5 @@ import org.junit.runners.Suite; ExchangeTransformProviderTest.class, // }) public class TransformerTestSuite { - + // } diff --git a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/mocks/MockBranchProvider.java b/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/mocks/MockBranchProvider.java index 2b6ae2f..2021448 100644 --- a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/mocks/MockBranchProvider.java +++ b/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/mocks/MockBranchProvider.java @@ -78,7 +78,7 @@ public final class MockBranchProvider implements IBranchesProvider { public static Branch getRootBranch(Collection<Branch> branches) { for (Branch branch : branches) { - if (branch.getName().equals(ROOT_BRANCH_NAME)) { + if (ROOT_BRANCH_NAME.equals(branch.getName())) { return branch; } } diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/CompositeOperation.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/CompositeOperation.java index bb50cd9..2231be7 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/CompositeOperation.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/CompositeOperation.java @@ -36,9 +36,7 @@ public class CompositeOperation extends AbstractOperation { } public CompositeOperation(String name, String pluginId, OperationBehavior behavior, List<? extends IOperation> operations) { - super(name, pluginId); - this.operations = operations; - this.behavior = behavior; + this(name, pluginId, behavior, NullOperationLogger.getSingleton(), operations); } public CompositeOperation(String name, String pluginId, OperationLogger logger, List<? extends IOperation> operations) { diff --git a/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/DatabaseInitializationOperation.java b/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/DatabaseInitializationOperation.java index 586f1fd..7b53dcf 100644 --- a/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/DatabaseInitializationOperation.java +++ b/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/DatabaseInitializationOperation.java @@ -256,7 +256,6 @@ public class DatabaseInitializationOperation { boolean serverOk = isApplicationServerAlive(serverUrl); Conditions.checkExpressionFailOnTrue(!serverOk, "Error connecting to application server [%s].\nPlease ensure server is running and try again.", serverUrl); - // System.out.println("OSEE Application Server Validation [PASSED]"); } public static void executeWithoutPrompting(String choice) throws OseeCoreException { diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/OseeCacheServlet.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/OseeCacheServlet.java index 86a7e4f..8126e78 100644 --- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/OseeCacheServlet.java +++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/OseeCacheServlet.java @@ -62,7 +62,6 @@ public class OseeCacheServlet extends UnsecuredOseeHttpServlet { private final ISessionManager sessionManager; public OseeCacheServlet(ISessionManager sessionManager, IDataTranslationService translationService, IOseeCachingService cachingService, IOseeModelFactoryService factoryService) { - super(); this.sessionManager = sessionManager; this.translationService = translationService; this.cachingService = cachingService; diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/model/BranchEventTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/model/BranchEventTest.java index e11bee8..3a1159a 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/model/BranchEventTest.java +++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/event/model/BranchEventTest.java @@ -76,7 +76,7 @@ public class BranchEventTest { } /** - * If all branch tests take longer than 10seconds, fail test, something went wrong. + * If all branch tests take longer than 20seconds, fail test, something went wrong. */ @org.junit.Test(timeout = 20000) public void testEvents() throws Exception { diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/revision/ConflictTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/revision/ConflictTest.java index cc6bee7..613bc2f 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/revision/ConflictTest.java +++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/revision/ConflictTest.java @@ -17,7 +17,6 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.util.Collection; import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Platform; import org.eclipse.osee.framework.core.enums.BranchState; import org.eclipse.osee.framework.core.enums.ConflictStatus; import org.eclipse.osee.framework.core.exception.OseeCoreException; @@ -35,7 +34,6 @@ import org.eclipse.osee.framework.skynet.core.conflict.Conflict; import org.eclipse.osee.framework.skynet.core.conflict.ConflictManagerExternal; import org.eclipse.osee.framework.skynet.core.conflict.RelationConflict; import org.eclipse.osee.framework.skynet.core.rule.OseeHousekeepingRule; -import org.eclipse.osee.support.test.util.TestUtil; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Ignore; @@ -47,8 +45,6 @@ import org.junit.rules.MethodRule; * @author Theron Virgin */ public class ConflictTest { - private static final boolean DEBUG = - "TRUE".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.osee.framework.skynet.core.test/debug/Junit")); @Rule public MethodRule oseeHousekeepingRule = new OseeHousekeepingRule(); @@ -69,7 +65,6 @@ public class ConflictTest { */ @org.junit.Test public void testGetMergeBranchNotCreated() throws Exception { - TestUtil.sleep(5000); SevereLoggingMonitor monitorLog = new SevereLoggingMonitor(); OseeLog.registerLoggerListener(monitorLog); try { @@ -117,7 +112,6 @@ public class ConflictTest { */ @org.junit.Test public void testGetMergeBranchCreated() throws Exception { - //TestUtil.sleep(5000); SevereLoggingMonitor monitorLog = new SevereLoggingMonitor(); OseeLog.registerLoggerListener(monitorLog); try { @@ -125,14 +119,6 @@ public class ConflictTest { BranchManager.getMergeBranch(ConflictTestManager.getSourceBranch(), ConflictTestManager.getDestBranch()); assertFalse(mergeBranch == null); Collection<Artifact> artifacts = ArtifactQuery.getArtifactListFromBranch(mergeBranch, INCLUDE_DELETED); - if (DEBUG) { - System.out.println("Found the following Artifacts on the branch "); - System.out.print(" "); - for (Artifact artifact : artifacts) { - System.out.print(artifact.getArtId() + ", "); - } - System.out.println("\n"); - } int expectedNumber = ConflictTestManager.numberOfArtifactsOnMergeBranch(); int actualNumber = artifacts.size(); @@ -155,7 +141,6 @@ public class ConflictTest { ConflictManagerInternal.getConflictsPerBranch(ConflictTestManager.getSourceBranch(), ConflictTestManager.getDestBranch(), ConflictTestManager.getSourceBranch().getBaseTransaction(), new NullProgressMonitor()); - int whichChange = 1; for (Conflict conflict : conflicts) { if (conflict instanceof AttributeConflict) { @@ -164,7 +149,6 @@ public class ConflictTest { } else if (conflict instanceof RelationConflict) { fail("Relation Conflicts are not supported yet"); } - whichChange++; } conflicts = @@ -226,10 +210,12 @@ public class ConflictTest { "WHERE txs1.gamma_id = t1.gamma_id AND txs1.tx_current = 0 %s " + "SELECT distinct t2.%s, txs2.branch_id FROM osee_txs txs2, %s t2 " + "WHERE txs2.gamma_id = t2.gamma_id AND txs2.tx_current != 0"; - //@formatter:on private static final String MULTIPLE_TX_CURRENT_SET = - "SELECT resulttable.branch_id, resulttable.%s, COUNT(resulttable.branch_id) AS numoccurrences FROM " + "(SELECT txs1.branch_id, t1.%s FROM osee_txs txs1, %s t1 WHERE txs1.gamma_id = t1.gamma_id AND txs1.tx_current != 0) resulttable " + "GROUP BY resulttable.branch_id, resulttable.%s HAVING(COUNT(resulttable.branch_id) > 1) order by branch_id"; + "SELECT resulttable.branch_id, resulttable.%s, COUNT(resulttable.branch_id) AS numoccurrences FROM " + + "(SELECT txs1.branch_id, t1.%s FROM osee_txs txs1, %s t1 WHERE txs1.gamma_id = t1.gamma_id AND txs1.tx_current != 0) resulttable " + + "GROUP BY resulttable.branch_id, resulttable.%s HAVING(COUNT(resulttable.branch_id) > 1) order by branch_id"; + //@formatter:on private static void checkNoTxCurrent(String dataId, String dataTable) throws OseeCoreException { IOseeStatement chStmt = ConnectionHandler.getStatement(); diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/revision/ConflictTestManager.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/revision/ConflictTestManager.java index 929bd68..0e5358b 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/revision/ConflictTestManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/revision/ConflictTestManager.java @@ -61,7 +61,6 @@ public class ConflictTestManager { }; private static final boolean DEBUG = false; - // "TRUE".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.osee.framework.skynet.core.test/debug/Junit")); private static final String FOLDER = "System Requirements"; private static final String SOURCE_BRANCH = "Conflict_Test_Source_Branch"; diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java index 6322394..3065f01 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java @@ -82,8 +82,10 @@ public class BranchManager { // this private empty constructor exists to prevent the default constructor from allowing public construction } + /** + * use static methods instead + */ @Deprecated - // use static methods instead public static BranchManager getInstance() { return instance; } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/ConflictManagerExternal.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/ConflictManagerExternal.java index 986677e..367a021 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/ConflictManagerExternal.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/ConflictManagerExternal.java @@ -12,6 +12,7 @@ package org.eclipse.osee.framework.skynet.core.conflict; import java.util.ArrayList; import java.util.List; +import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.osee.framework.core.data.IOseeBranch; import org.eclipse.osee.framework.core.enums.ConflictStatus; @@ -25,6 +26,8 @@ import org.eclipse.osee.framework.skynet.core.revision.ConflictManagerInternal; */ public class ConflictManagerExternal { + private static final IProgressMonitor monitor = new NullProgressMonitor(); + private final Branch destinationBranch; private final Branch sourceBranch; private List<Conflict> originalConflicts; @@ -38,7 +41,7 @@ public class ConflictManagerExternal { if (originalConflicts == null) { originalConflicts = ConflictManagerInternal.getConflictsPerBranch(sourceBranch, destinationBranch, - sourceBranch.getBaseTransaction(), new NullProgressMonitor()); + sourceBranch.getBaseTransaction(), monitor); } return originalConflicts; } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java index 5c0e01a..01c39df 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java @@ -292,7 +292,7 @@ public class ConflictManagerInternal { */ private static boolean isAttributeConflictValidOnBranch(int destinationGammaId, Branch branch, int endTransactionNumber) throws OseeCoreException { String sql = - "select count(1) from osee_txs txs where txs.gamma_id = ? and txs.branch_id = ? and txs.transaction_id <= ?"; + "SELECT count(1) FROM osee_txs txs WHERE txs.gamma_id = ? AND txs.branch_id = ? AND txs.transaction_id <= ?"; return ConnectionHandler.runPreparedQueryFetchInt(0, sql, destinationGammaId, branch.getId(), endTransactionNumber) == 0; } @@ -333,7 +333,9 @@ public class ConflictManagerInternal { } finally { chStmt.close(); } - Collections.sort(destinationBranches); + if (destinationBranches.size() > 1) { + Collections.sort(destinationBranches); + } return destinationBranches; } |

