]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Fixed typo from string returned from Rename.renameNode 63/3163/1
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Wed, 28 Aug 2019 07:43:11 +0000 (10:43 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Wed, 28 Aug 2019 07:43:11 +0000 (10:43 +0300)
gitlab #367

Change-Id: I5524ae8c3133968a4819045fc2556439b5aa3526

bundles/org.simantics.db.testing/src/org/simantics/db/testing/base/SCLScriptTestBase.java
bundles/org.simantics.db.testing/src/org/simantics/db/testing/common/TestBase.java
bundles/org.simantics.modeling/scl/Simantics/Rename.scl
bundles/org.simantics.modeling/src/org/simantics/modeling/Rename.java

index 26e916fc1bcdfa53ed8f0076155b33b3d7bf603e..1ea9e6a546d0e77a6469e4bef55d69478e2adeb3 100644 (file)
@@ -19,21 +19,24 @@ import org.simantics.scl.osgi.SCLOsgi;
 import org.simantics.scl.osgi.internal.Activator;
 import org.simantics.scl.osgi.internal.ServiceBasedModuleSourceRepository;
 import org.simantics.scl.osgi.internal.ServiceBasedTestRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import gnu.trove.map.hash.THashMap;
 
 /**
  * Utilizies {@link TestRepository} for collecting SCL tests from bundles
  * 
- * @author Jani
- *
+ * @author Jani Simomaa
  */
 public class SCLScriptTestBase extends FreshDatabaseTest {
 
+    private static final Logger LOGGER = LoggerFactory.getLogger(SCLScriptTestBase.class);
+
     private Map<String, TestRunnable> testRunnables = new THashMap<String, TestRunnable>();
-    
+
     @Rule public TestName testName = new TestName();
-    
+
     /**
      * Constructor that initially searches for all SCL test scripts and stores
      * them into a Map for later access
@@ -47,14 +50,14 @@ public class SCLScriptTestBase extends FreshDatabaseTest {
             testRunnables.put(runnable.getName(), runnable);
         }
     }
-    
+
     /**
      * Simplest method for running a SCL test
      */
     protected void test() {
         test(-1);
     }
-    
+
     /**
      * Executes a test case with given timeout as seconds. When time runs out one
      * can assume a deadlock has happened. The process is killed after the timeout
@@ -65,7 +68,7 @@ public class SCLScriptTestBase extends FreshDatabaseTest {
     protected void test(int timeout) {
         testImpl(timeout);
     }
-    
+
     /**
      * Executes a test case with given timeout as seconds
      * 
@@ -75,25 +78,26 @@ public class SCLScriptTestBase extends FreshDatabaseTest {
         SCLOsgi.SOURCE_REPOSITORY = new ServiceBasedModuleSourceRepository(Activator.getContext());
         SCLOsgi.MODULE_REPOSITORY = new ModuleRepository(SCLOsgi.SOURCE_REPOSITORY);
         SCLOsgi.TEST_REPOSITORY = new ServiceBasedTestRepository(Activator.getContext());
-                
+
         String testName = resolveTestName();
         TestRunnable runnable = testRunnables.get(testName);
-        
+
         if (timeout > -1) {
             Timer timer = new Timer();
             timer.schedule(new TimerTask() {
 
                 @Override
                 public void run() {
+                    LOGGER.info("Watchdog will kill this test process because it has been executing for over {} seconds", timeout); //$NON-NLS-1$
                     String processName = ManagementFactory.getRuntimeMXBean().getName();
-                    System.out.println("PID: " + processName);
+                    LOGGER.info("Test Process Name: {}", processName); //$NON-NLS-1$
                     String PID = processName.split("@")[0];
                     String command = "taskkill /F /PID " + PID;
-                    System.out.println("Command: " + command);
+                    LOGGER.info("Running command to kill test process: {}", command); //$NON-NLS-1$
                     try {
                         Runtime.getRuntime().exec(command);
                     } catch (IOException e) {
-                        e.printStackTrace();
+                        LOGGER.error("Failed to kill process that ran over its execution time limit of {} seconds", timeout, e);
                     }
                 }
                 
@@ -101,7 +105,7 @@ public class SCLScriptTestBase extends FreshDatabaseTest {
             try {
                 runnable.run();
             } catch (Exception e) {
-                e.printStackTrace();
+                LOGGER.error("Failed to run test {} runnable {}", testName, runnable, e);
             } finally {
                 timer.cancel();
             }
@@ -109,11 +113,11 @@ public class SCLScriptTestBase extends FreshDatabaseTest {
             try {
                 runnable.run();
             } catch (Exception e) {
-                e.printStackTrace();
+                LOGGER.error("Failed to run test {} runnable {}", testName, runnable, e);
             }
         }
     }
-    
+
     /**
      * Resolves the full test name based on the names of classes that extends this
      * SCLScriptTestBase class.<br><br>
index 06fc784a29a30b68fa335fec2e25efbb7f9ad5ec..73e6ff8f13b47377064af2f7a2041aefe5da829b 100644 (file)
@@ -46,7 +46,7 @@ import org.slf4j.LoggerFactory;
  *
  * @author Marko Luukkainen <marko.luukkainen@vtt.fi>
  */
-public abstract class TestBase /*extends TestCase*/ {
+public abstract class TestBase {
     private static final Logger LOGGER = LoggerFactory.getLogger(TestBase.class);
     public static final boolean DEBUG = Configuration.get().debug;
     public static final String ROOT_LIBRARY_URI = "http:/";
index cb048e037ff672cb87841f22bd53adab9316866f..e7667ed877a59ab1bb841341a44f3c1039e110ab 100644 (file)
@@ -11,7 +11,7 @@ importJava "org.simantics.modeling.Rename" where
     Example:
     
         > renameNode resource "NewName"
-        "Succesfully renamed oldName to NewName"
+        "Successfully renamed oldName to NewName"
         
     or error if failed
     """
@@ -26,7 +26,7 @@ Renames the given `entity` with the given `newName` and returns
 Example:
 
     > renameMBNode entity "NewName"
-    "Succesfully renamed oldName to NewName"
+    "Successfully renamed oldName to NewName"
     
 or error if failed
 """
index 5d8543d213131cab85739580703ef6bad121a411..0c5007ba5167a868bb469062f26e2a91781c120b 100644 (file)
@@ -29,7 +29,7 @@ public class Rename {
        CommentMetadata cm = graph.getMetadata(CommentMetadata.class);
        graph.addMetadata(cm.add("Renamed node " + nodeName + ", resource  " + node +  ", to " + newName));
        
-               return "Succesfully renamed "+ nodeName + " to " + newName;
+               return "Successfully renamed "+ nodeName + " to " + newName;
     }
     
 }