Provide default createSession() factory method
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Thu, 30 Jul 2015 03:37:43 +0000 (23:37 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Thu, 30 Jul 2015 03:38:20 +0000 (23:38 -0400)
Users may not care what backend is actually used, we can provide
a default one.

Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
src/test/java/org/lttng/tools/ILttngSession.java
src/test/java/org/lttng/tools/utils/LttngUtils.java
src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/LttngJulHandlerTracingDisabledBenchmark.java
src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/LttngJulHandlerTracingEnabledBenchmark.java
src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/old/OldLttngJulHandlerTracingDisabledBenchmark.java
src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/old/OldLttngJulHandlerTracingEnabledBenchmark.java
src/test/java/org/lttng/ust/agent/integration/EnabledEventsTestBase.java
src/test/java/org/lttng/ust/agent/integration/MultiSessionTestBase.java
src/test/java/org/lttng/ust/agent/integration/jul/JulLegacyApiTest.java
src/test/java/org/lttng/ust/agent/integration/log4j/Log4jLegacyApiTest.java

index c8b532ca23ac36b24e137835498f6cf76b067e52..e7d65a0f29a8224cba6aa20ecf9737bb4c4525fa 100644 (file)
@@ -55,8 +55,7 @@ public interface ILttngSession extends AutoCloseable {
     // ------------------------------------------------------------------------
 
     /**
-     * Constructor to create a new LTTng tracing session, which will use the
-     * command-line "lttng" utility.
+     * Create a new LTTng tracing session using the default backend.
      *
      * @param sessionName
      *            The name of the session to use. It can be null, in which case
@@ -65,7 +64,22 @@ public interface ILttngSession extends AutoCloseable {
      *            The tracing domain of this session
      * @return The new session object
      */
-    static ILttngSession newCommandLineSession(String sessionName, Domain domain) {
+    static ILttngSession createSession(String sessionName, Domain domain) {
+        return createCommandLineSession(sessionName, domain);
+    }
+
+    /**
+     * Create a new LTTng tracing session, which will use the command-line
+     * "lttng" utility.
+     *
+     * @param sessionName
+     *            The name of the session to use. It can be null, in which case
+     *            we will provide a unique random name.
+     * @param domain
+     *            The tracing domain of this session
+     * @return The new session object
+     */
+    static ILttngSession createCommandLineSession(String sessionName, Domain domain) {
         return new LttngCommandLineSession(sessionName, domain);
     }
 
index 3c1a83f385cd8c5f802364aadc6a7f78f79876ce..de7b2330c679a892d817f8403ee23c27d3b4fa54 100644 (file)
@@ -78,7 +78,7 @@ public final class LttngUtils {
      *         was an error
      */
     public static boolean checkForLttngTools(Domain domain) {
-        try (ILttngSession session = ILttngSession.newCommandLineSession(null, domain)) {
+        try (ILttngSession session = ILttngSession.createSession(null, domain)) {
             boolean ret1 = session.enableAllEvents();
             boolean ret2 = session.start();
             boolean ret3 = session.stop();
index 23ab1ee70cebd8812fd29b5c5fe5cf0dc0a14068..d0e514c703ecc16612437fb38d403bc2f00184e7 100644 (file)
@@ -46,7 +46,7 @@ public class LttngJulHandlerTracingDisabledBenchmark extends JulHandlerBenchmark
     public void testSetup() throws IOException {
         handler = new LttngLogHandler();
 
-        session = ILttngSession.newCommandLineSession(null, Domain.JUL);
+        session = ILttngSession.createSession(null, Domain.JUL);
         assertTrue(session.enableEvents("non-event"));
         assertTrue(session.start());
     }
index 8e4c37d2591665a5513e1be7264b43ceb511892a..c594de437b02903f69a5f359c8747d481c155489 100644 (file)
@@ -45,7 +45,7 @@ public class LttngJulHandlerTracingEnabledBenchmark extends JulHandlerBenchmarkB
     public void testSetup() throws IOException {
         handler = new LttngLogHandler();
 
-        session = ILttngSession.newCommandLineSession(null, Domain.JUL);
+        session = ILttngSession.createSession(null, Domain.JUL);
         assertTrue(session.enableAllEvents());
         assertTrue(session.start());
     }
index a3a5c41598124ffa071513a50a4b88cb09256e29..112b0f0c8d56e30527acb646462dfa3f1e141868 100644 (file)
@@ -43,7 +43,7 @@ public class OldLttngJulHandlerTracingDisabledBenchmark extends JulHandlerBenchm
     public void testSetup() {
         LTTngAgent.getLTTngAgent();
 
-        session = ILttngSession.newCommandLineSession(null, Domain.JUL);
+        session = ILttngSession.createSession(null, Domain.JUL);
         assertTrue(session.enableEvents("non-event"));
         assertTrue(session.start());
     }
index 23c6c9596b95fc680dbc95388f56819442c09cd2..a36578be8ebfca40963011c6292f8d2885de38c4 100644 (file)
@@ -69,7 +69,7 @@ public class OldLttngJulHandlerTracingEnabledBenchmark extends JulHandlerBenchma
             fail();
         }
 
-        session = ILttngSession.newCommandLineSession(null, Domain.JUL);
+        session = ILttngSession.createSession(null, Domain.JUL);
         assertTrue(session.enableAllEvents());
         assertTrue(session.start());
     }
index a04057ad4c2d329c7c6f1809e4393ef3a2658f7b..fd72279768671ec41f0a7d29e5deff36b6bad23c 100644 (file)
@@ -61,7 +61,7 @@ public abstract class EnabledEventsTestBase {
      */
     @Before
     public void testSetup() {
-        session = ILttngSession.newCommandLineSession(null, getDomain());
+        session = ILttngSession.createSession(null, getDomain());
     }
 
     /**
index 9976e6ac3218879aa0d56fe55237c57e805847fa..1efa3a6741b8576c556c02e92abb927abe1559ae 100644 (file)
@@ -63,9 +63,9 @@ public abstract class MultiSessionTestBase {
      */
     @Before
     public void testSetup() {
-        session1 = ILttngSession.newCommandLineSession(null, getDomain());
-        session2 = ILttngSession.newCommandLineSession(null, getDomain());
-        session3 = ILttngSession.newCommandLineSession(null, getDomain());
+        session1 = ILttngSession.createSession(null, getDomain());
+        session2 = ILttngSession.createSession(null, getDomain());
+        session3 = ILttngSession.createSession(null, getDomain());
     }
 
     /**
index b1a7c48c5d67d03f84f5808e03552a1028e5cbfa..a088bb94eae0c0de03cbb1d1a2e8c90682ef8e76 100644 (file)
@@ -92,7 +92,7 @@ public class JulLegacyApiTest {
         loggerA.setLevel(Level.ALL);
         loggerB.setLevel(Level.ALL);
 
-        session = ILttngSession.newCommandLineSession(null, DOMAIN);
+        session = ILttngSession.createSession(null, DOMAIN);
     }
 
     /**
index 0f473f96df78c71695c8e8b9da37f5addf38485e..d9ab7ff95938968f6160292a18dc996578d18f73 100644 (file)
@@ -93,7 +93,7 @@ public class Log4jLegacyApiTest {
         loggerA.setLevel(Level.ALL);
         loggerB.setLevel(Level.ALL);
 
-        session = ILttngSession.newCommandLineSession(null, DOMAIN);
+        session = ILttngSession.createSession(null, DOMAIN);
     }
 
     /**
This page took 0.027 seconds and 4 git commands to generate.