Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorddunne2011-05-17 12:40:22 -0400
committerRyan D. Brooks2011-05-17 12:40:22 -0400
commitd394d2b2acd8eb7f160e11701e8f05e09f2c427f (patch)
tree4b45c5d83f7ac7e252a47402bcb90d8e83d9aac2 /plugins/org.eclipse.osee.framework.skynet.core.test
parent53325314bd54d2aa06a398519fc14a1394976dea (diff)
downloadorg.eclipse.osee-d394d2b2acd8eb7f160e11701e8f05e09f2c427f.tar.gz
org.eclipse.osee-d394d2b2acd8eb7f160e11701e8f05e09f2c427f.tar.xz
org.eclipse.osee-d394d2b2acd8eb7f160e11701e8f05e09f2c427f.zip
bug: Convert console exceptions to test errors and cleaned up logs
Diffstat (limited to 'plugins/org.eclipse.osee.framework.skynet.core.test')
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/FrameworkCore_Demo_Suite.java7
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/ChangeManagerTest.java6
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/DirtyArtifactCacheTest.java24
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/DuplicateHridTest.java5
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/RoughArtifactTest.java18
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/RelationCacheTest.java12
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/revision/ConflictTestManager.java11
7 files changed, 61 insertions, 22 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/FrameworkCore_Demo_Suite.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/FrameworkCore_Demo_Suite.java
index 3d74297393..c18f677a82 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/FrameworkCore_Demo_Suite.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/FrameworkCore_Demo_Suite.java
@@ -50,6 +50,7 @@ import org.eclipse.osee.framework.skynet.core.revision.ConflictTest;
import org.eclipse.osee.framework.skynet.core.transaction.TransactionManagerTest;
import org.eclipse.osee.framework.skynet.core.utility.CsvArtifactTest;
import org.eclipse.osee.framework.skynet.core.word.UpdateBookmarkIdTest;
+import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@@ -100,6 +101,7 @@ import org.junit.runners.Suite;
public class FrameworkCore_Demo_Suite {
@BeforeClass
public static void setUp() throws Exception {
+ System.out.println("\n\nBegin " + FrameworkCore_Demo_Suite.class.getSimpleName());
OseeProperties.setIsInTest(true);
assertTrue("Demo Application Server must be running.",
ClientSessionManager.getAuthenticationProtocols().contains("demo"));
@@ -107,4 +109,9 @@ public class FrameworkCore_Demo_Suite {
ClientSessionManager.getSession().getAuthenticationProtocol().equals("demo"));
}
+ @AfterClass
+ public static void tearDown() throws Exception {
+ System.out.println("End " + FrameworkCore_Demo_Suite.class.getSimpleName());
+ }
+
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/ChangeManagerTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/ChangeManagerTest.java
index 6f8e5f68e0..c3e6fe689a 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/ChangeManagerTest.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/ChangeManagerTest.java
@@ -12,11 +12,9 @@ package org.eclipse.osee.framework.skynet.core.artifact;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.logging.Level;
-
import org.eclipse.osee.framework.core.client.ClientSessionManager;
import org.eclipse.osee.framework.core.data.SystemUser;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
@@ -117,8 +115,8 @@ public class ChangeManagerTest {
}
public static void sleep(long milliseconds) throws Exception {
- OseeLog.log(ChangeManagerTest.class, Level.INFO, "Sleeping " + milliseconds);
+ // OseeLog.log(ChangeManagerTest.class, Level.INFO, "Sleeping " + milliseconds);
Thread.sleep(milliseconds);
- OseeLog.log(ChangeManagerTest.class, Level.INFO, "Awake");
+ // OseeLog.log(ChangeManagerTest.class, Level.INFO, "Awake");
}
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/DirtyArtifactCacheTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/DirtyArtifactCacheTest.java
new file mode 100644
index 0000000000..55b6ad4953
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/DirtyArtifactCacheTest.java
@@ -0,0 +1,24 @@
+/*
+ * Created on May 17, 2011
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.skynet.core.artifact;
+
+import junit.framework.Assert;
+import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
+
+/**
+ * This test should be run as the last test of a suite to make sure that the ArtifactCache has no dirty artifacts.
+ *
+ * @author Donald G. Dunne
+ */
+public class DirtyArtifactCacheTest {
+
+ @org.junit.Test
+ public void testArtifactCacheNotDirty() {
+ Assert.assertTrue(String.format(
+ "After all tests are run, there should be no dirty artifacts in Artifact Cache; Found [%s]",
+ Artifacts.artNames(ArtifactCache.getDirtyArtifacts())), ArtifactCache.getDirtyArtifacts().isEmpty());
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/DuplicateHridTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/DuplicateHridTest.java
index 1c63baca1d..e9f4d1dee3 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/DuplicateHridTest.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/DuplicateHridTest.java
@@ -12,7 +12,6 @@ package org.eclipse.osee.framework.skynet.core.artifact;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
import org.eclipse.osee.framework.database.core.ConnectionHandler;
@@ -35,8 +34,8 @@ public class DuplicateHridTest {
String random_HRID = generate_random_HRID();
assertFalse("Duplicate check returned false positive", ArtifactFactory.isUniqueHRID(known_duplicate));
assertTrue("Duplicate check returned false negative", ArtifactFactory.isUniqueHRID(random_HRID));
- System.out.println("isUniqueHrid(\"" + known_duplicate + "\") returns " + ArtifactFactory.isUniqueHRID(known_duplicate));
- System.out.println("isUnqiueHrid(\"" + random_HRID + "\") returns " + ArtifactFactory.isUniqueHRID(random_HRID));
+ // System.out.println("isUniqueHrid(\"" + known_duplicate + "\") returns " + ArtifactFactory.isUniqueHRID(known_duplicate));
+ // System.out.println("isUnqiueHrid(\"" + random_HRID + "\") returns " + ArtifactFactory.isUniqueHRID(random_HRID));
}
/* Queries the database and grabs the first HRID it sees */
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/RoughArtifactTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/RoughArtifactTest.java
index 521ac399fa..82818e102a 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/RoughArtifactTest.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/importing/RoughArtifactTest.java
@@ -10,8 +10,8 @@
*******************************************************************************/
package org.eclipse.osee.framework.skynet.core.importing;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeTypeDoesNotExist;
/**
* @author Ryan D. Brooks
@@ -22,19 +22,19 @@ public class RoughArtifactTest {
private static RoughArtifact ra;
- @BeforeClass
+ @org.junit.BeforeClass
public static void setUpBeforeClass() {
ra = new RoughArtifact(RoughArtifactKind.PRIMARY);
}
- @Test
- public void testAddAttributeWithNulls() {
- String nullString = null;
- ra.addAttribute(nullString, "");
+ //TODO: Not sure what this is testing
+ @org.junit.Test(expected = NullPointerException.class)
+ public void testAddAttributeWithNulls() throws OseeCoreException {
+ ra.addAttribute((String) null, "");
}
- @Test
- public void nonExistingEnumeration() {
+ @org.junit.Test(expected = OseeTypeDoesNotExist.class)
+ public void testNonExistingEnumeration() throws OseeCoreException {
ra.addAttribute("Apple", "Orange");
}
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/RelationCacheTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/RelationCacheTest.java
index 11562bc1c8..27d0cb6c5e 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/RelationCacheTest.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/RelationCacheTest.java
@@ -22,9 +22,11 @@ import org.eclipse.osee.framework.core.model.test.mocks.MockDataFactory;
import org.eclipse.osee.framework.core.model.type.RelationType;
import org.eclipse.osee.framework.jdk.core.util.Compare;
import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.eclipse.osee.framework.logging.SevereLoggingMonitor;
import org.eclipse.osee.framework.skynet.core.mocks.DataFactory;
import org.eclipse.osee.framework.skynet.core.mocks.MockLinker;
import org.eclipse.osee.framework.skynet.core.types.IArtifact;
+import org.eclipse.osee.support.test.util.TestUtil;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
@@ -50,8 +52,10 @@ public class RelationCacheTest {
private static RelationType relType1;
private static RelationType relType2;
+ private static SevereLoggingMonitor severeLoggingMonitor;
+
@BeforeClass
- public static void setup() throws OseeCoreException {
+ public static void setup() throws Exception {
branch1 = MockDataFactory.createBranch(100);
branch1.setId(100);
@@ -75,10 +79,12 @@ public class RelationCacheTest {
DataFactory.setEveryOtherToDeleted(sourceLinksRelType2);
checkAssumptions();
+
+ severeLoggingMonitor = TestUtil.severeLoggingStart();
}
@AfterClass
- public static void tearDown() {
+ public static void tearDown() throws Exception {
branch1 = null;
branch2 = null;
@@ -91,6 +97,8 @@ public class RelationCacheTest {
relType1 = null;
relType2 = null;
+
+ TestUtil.severeLoggingEnd(severeLoggingMonitor);
}
@Test
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 3a226c2bef..845cecf727 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
@@ -15,7 +15,6 @@ import java.util.Collection;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
-
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.enums.BranchArchivedState;
@@ -60,7 +59,7 @@ public class ConflictTestManager {
MODIFY_AND_DELETE;
};
- private static final boolean DEBUG = true;
+ 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";
@@ -217,11 +216,15 @@ public class ConflictTestManager {
}
for (int i = 0; i < NUMBER_OF_ARTIFACTS; i++) {
if (conflictDefs[i].destDelete) {
- System.out.println("Deleting Artifact with ID " + destArtifacts[i].getArtId() + " index " + i);
+ if (DEBUG) {
+ System.out.println("Deleting Artifact with ID " + destArtifacts[i].getArtId() + " index " + i);
+ }
destArtifacts[i].deleteAndPersist();
}
if (conflictDefs[i].sourceDelete) {
- System.out.println("Deleting Artifact with ID " + sourceArtifacts[i].getArtId() + " index " + i);
+ if (DEBUG) {
+ System.out.println("Deleting Artifact with ID " + sourceArtifacts[i].getArtId() + " index " + i);
+ }
sourceArtifacts[i].deleteAndPersist();
}
if (DEBUG) {

Back to the top