kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkr...@apache.org
Subject svn commit: r1205311 [3/3] - in /incubator/kafka/trunk/core/src: main/scala/kafka/ main/scala/kafka/consumer/ main/scala/kafka/consumer/storage/ main/scala/kafka/javaapi/ main/scala/kafka/javaapi/message/ main/scala/kafka/log/ main/scala/kafka/message/...
Date Wed, 23 Nov 2011 07:21:23 GMT
Modified: incubator/kafka/trunk/core/src/test/scala/unit/kafka/consumer/ZookeeperConsumerConnectorTest.scala
URL: http://svn.apache.org/viewvc/incubator/kafka/trunk/core/src/test/scala/unit/kafka/consumer/ZookeeperConsumerConnectorTest.scala?rev=1205311&r1=1205310&r2=1205311&view=diff
==============================================================================
--- incubator/kafka/trunk/core/src/test/scala/unit/kafka/consumer/ZookeeperConsumerConnectorTest.scala
(original)
+++ incubator/kafka/trunk/core/src/test/scala/unit/kafka/consumer/ZookeeperConsumerConnectorTest.scala
Wed Nov 23 07:21:16 2011
@@ -22,15 +22,14 @@ import kafka.zk.ZooKeeperTestHarness
 import kafka.integration.KafkaServerTestHarness
 import kafka.server.KafkaConfig
 import scala.collection._
-import kafka.utils.Utils
+import kafka.utils.{Utils, Logging}
 import kafka.utils.{TestZKUtils, TestUtils}
 import org.scalatest.junit.JUnit3Suite
 import org.apache.log4j.{Level, Logger}
 import kafka.message._
 import kafka.serializer.StringDecoder
 
-class ZookeeperConsumerConnectorTest extends JUnit3Suite with KafkaServerTestHarness with
ZooKeeperTestHarness {
-  private val logger = Logger.getLogger(getClass())
+class ZookeeperConsumerConnectorTest extends JUnit3Suite with KafkaServerTestHarness with
ZooKeeperTestHarness with Logging {
 
   val zookeeperConnect = TestZKUtils.zookeeperConnect
   val zkConnect = zookeeperConnect
@@ -117,7 +116,7 @@ class ZookeeperConsumerConnectorTest ext
     zkConsumerConnector1.shutdown
     zkConsumerConnector2.shutdown
     zkConsumerConnector3.shutdown
-    logger.info("all consumer connectors stopped")
+    info("all consumer connectors stopped")
     requestHandlerLogger.setLevel(Level.ERROR)
   }
 
@@ -170,7 +169,7 @@ class ZookeeperConsumerConnectorTest ext
     zkConsumerConnector1.shutdown
     zkConsumerConnector2.shutdown
     zkConsumerConnector3.shutdown
-    logger.info("all consumer connectors stopped")
+    info("all consumer connectors stopped")
     requestHandlerLogger.setLevel(Level.ERROR)
   }
 
@@ -232,7 +231,7 @@ class ZookeeperConsumerConnectorTest ext
           assertTrue(iterator.hasNext())
           val message = iterator.next()
           receivedMessages ::= message
-          logger.debug("received message: " + message)
+          debug("received message: " + message)
         }
       }
     }
@@ -275,7 +274,7 @@ class ZookeeperConsumerConnectorTest ext
           assertTrue(iterator.hasNext)
           val message = iterator.next
           messages ::= message
-          logger.debug("received message: " + Utils.toString(message.payload, "UTF-8"))
+          debug("received message: " + Utils.toString(message.payload, "UTF-8"))
         }
       }
     }

Modified: incubator/kafka/trunk/core/src/test/scala/unit/kafka/integration/AutoOffsetResetTest.scala
URL: http://svn.apache.org/viewvc/incubator/kafka/trunk/core/src/test/scala/unit/kafka/integration/AutoOffsetResetTest.scala?rev=1205311&r1=1205310&r2=1205311&view=diff
==============================================================================
--- incubator/kafka/trunk/core/src/test/scala/unit/kafka/integration/AutoOffsetResetTest.scala
(original)
+++ incubator/kafka/trunk/core/src/test/scala/unit/kafka/integration/AutoOffsetResetTest.scala
Wed Nov 23 07:21:16 2011
@@ -21,14 +21,14 @@ import junit.framework.Assert._
 import kafka.zk.ZooKeeperTestHarness
 import java.nio.channels.ClosedByInterruptException
 import java.util.concurrent.atomic.AtomicInteger
-import kafka.utils.ZKGroupTopicDirs
+import kafka.utils.{ZKGroupTopicDirs, Logging}
 import kafka.consumer.{ConsumerTimeoutException, ConsumerConfig, ConsumerConnector, Consumer}
 import kafka.server.{KafkaRequestHandlers, KafkaServer, KafkaConfig}
 import org.apache.log4j.{Level, Logger}
 import org.scalatest.junit.JUnit3Suite
 import kafka.utils.{TestUtils, TestZKUtils}
 
-class AutoOffsetResetTest extends JUnit3Suite with ZooKeeperTestHarness {
+class AutoOffsetResetTest extends JUnit3Suite with ZooKeeperTestHarness with Logging {
 
   val zkConnect = TestZKUtils.zookeeperConnect
   val topic = "test_topic"
@@ -41,7 +41,6 @@ class AutoOffsetResetTest extends JUnit3
   val largeOffset = 10000
   val smallOffset = -1
   
-  private val logger = Logger.getLogger(getClass())
   val requestHandlerLogger = Logger.getLogger(classOf[KafkaRequestHandlers])
 
   override def setUp() {
@@ -74,7 +73,7 @@ class AutoOffsetResetTest extends JUnit3
     val consumerConfig = new ConsumerConfig(consumerProps)
     
     TestUtils.updateConsumerOffset(consumerConfig, dirs.consumerOffsetDir + "/" + "0-0",
largeOffset)
-    logger.info("Updated consumer offset to " + largeOffset)
+    info("Updated consumer offset to " + largeOffset)
 
     Thread.sleep(500)
     val consumerConnector: ConsumerConnector = Consumer.create(consumerConfig)
@@ -93,7 +92,7 @@ class AutoOffsetResetTest extends JUnit3
               }
             }
             catch {
-              case te: ConsumerTimeoutException => logger.info("Consumer thread timing
out..")
+              case te: ConsumerTimeoutException => info("Consumer thread timing out..")
               case _: InterruptedException => 
               case _: ClosedByInterruptException =>
               case e => throw e
@@ -108,7 +107,7 @@ class AutoOffsetResetTest extends JUnit3
 
     threadList(0).join(2000)
 
-    logger.info("Asserting...")
+    info("Asserting...")
     assertEquals(numMessages, nMessages.get)
     consumerConnector.shutdown
   }
@@ -128,7 +127,7 @@ class AutoOffsetResetTest extends JUnit3
     val consumerConfig = new ConsumerConfig(consumerProps)
 
     TestUtils.updateConsumerOffset(consumerConfig, dirs.consumerOffsetDir + "/" + "0-0",
smallOffset)
-    logger.info("Updated consumer offset to " + smallOffset)
+    info("Updated consumer offset to " + smallOffset)
 
 
     val consumerConnector: ConsumerConnector = Consumer.create(consumerConfig)
@@ -161,7 +160,7 @@ class AutoOffsetResetTest extends JUnit3
 
     threadList(0).join(2000)
 
-    logger.info("Asserting...")
+    info("Asserting...")
     assertEquals(numMessages, nMessages.get)
     consumerConnector.shutdown
   }
@@ -181,7 +180,7 @@ class AutoOffsetResetTest extends JUnit3
     val consumerConfig = new ConsumerConfig(consumerProps)
 
     TestUtils.updateConsumerOffset(consumerConfig, dirs.consumerOffsetDir + "/" + "0-0",
largeOffset)
-    logger.info("Updated consumer offset to " + largeOffset)
+    info("Updated consumer offset to " + largeOffset)
 
 
     val consumerConnector: ConsumerConnector = Consumer.create(consumerConfig)
@@ -214,7 +213,7 @@ class AutoOffsetResetTest extends JUnit3
 
     threadList(0).join(2000)
 
-    logger.info("Asserting...")
+    info("Asserting...")
 
     assertEquals(0, nMessages.get)
     consumerConnector.shutdown

Modified: incubator/kafka/trunk/core/src/test/scala/unit/kafka/javaapi/consumer/ZookeeperConsumerConnectorTest.scala
URL: http://svn.apache.org/viewvc/incubator/kafka/trunk/core/src/test/scala/unit/kafka/javaapi/consumer/ZookeeperConsumerConnectorTest.scala?rev=1205311&r1=1205310&r2=1205311&view=diff
==============================================================================
--- incubator/kafka/trunk/core/src/test/scala/unit/kafka/javaapi/consumer/ZookeeperConsumerConnectorTest.scala
(original)
+++ incubator/kafka/trunk/core/src/test/scala/unit/kafka/javaapi/consumer/ZookeeperConsumerConnectorTest.scala
Wed Nov 23 07:21:16 2011
@@ -22,7 +22,7 @@ import kafka.zk.ZooKeeperTestHarness
 import kafka.integration.KafkaServerTestHarness
 import kafka.server.KafkaConfig
 import scala.collection._
-import kafka.utils.Utils
+import kafka.utils.{Utils, Logging}
 import kafka.utils.{TestZKUtils, TestUtils}
 import org.scalatest.junit.JUnit3Suite
 import scala.collection.JavaConversions._
@@ -33,8 +33,7 @@ import org.apache.log4j.{Level, Logger}
 import kafka.message.{NoCompressionCodec, DefaultCompressionCodec, CompressionCodec, Message}
 import kafka.serializer.StringDecoder
 
-class ZookeeperConsumerConnectorTest extends JUnit3Suite with KafkaServerTestHarness with
ZooKeeperTestHarness {
-  private val logger = Logger.getLogger(getClass())
+class ZookeeperConsumerConnectorTest extends JUnit3Suite with KafkaServerTestHarness with
ZooKeeperTestHarness with Logging {
 
   val zookeeperConnect = TestZKUtils.zookeeperConnect
   val zkConnect = zookeeperConnect
@@ -119,7 +118,7 @@ class ZookeeperConsumerConnectorTest ext
     zkConsumerConnector1.shutdown
     zkConsumerConnector2.shutdown
     zkConsumerConnector3.shutdown
-    logger.info("all consumer connectors stopped")
+    info("all consumer connectors stopped")
     requestHandlerLogger.setLevel(Level.ERROR)
   }
 
@@ -169,7 +168,7 @@ class ZookeeperConsumerConnectorTest ext
     zkConsumerConnector1.shutdown
     zkConsumerConnector2.shutdown
     zkConsumerConnector3.shutdown
-    logger.info("all consumer connectors stopped")
+    info("all consumer connectors stopped")
     requestHandlerLogger.setLevel(Level.ERROR)
   }
 
@@ -230,7 +229,7 @@ class ZookeeperConsumerConnectorTest ext
           assertTrue(iterator.hasNext())
           val message = iterator.next()
           receivedMessages ::= message
-          logger.debug("received message: " + message)
+          debug("received message: " + message)
         }
       }
     }
@@ -276,7 +275,7 @@ class ZookeeperConsumerConnectorTest ext
           assertTrue(iterator.hasNext)
           val message = iterator.next
           messages ::= message
-          logger.debug("received message: " + Utils.toString(message.payload, "UTF-8"))
+          debug("received message: " + Utils.toString(message.payload, "UTF-8"))
         }
       }
     }

Modified: incubator/kafka/trunk/core/src/test/scala/unit/kafka/log4j/KafkaLog4jAppenderTest.scala
URL: http://svn.apache.org/viewvc/incubator/kafka/trunk/core/src/test/scala/unit/kafka/log4j/KafkaLog4jAppenderTest.scala?rev=1205311&r1=1205310&r2=1205311&view=diff
==============================================================================
--- incubator/kafka/trunk/core/src/test/scala/unit/kafka/log4j/KafkaLog4jAppenderTest.scala
(original)
+++ incubator/kafka/trunk/core/src/test/scala/unit/kafka/log4j/KafkaLog4jAppenderTest.scala
Wed Nov 23 07:21:16 2011
@@ -24,7 +24,7 @@ import java.io.File
 import kafka.consumer.SimpleConsumer
 import kafka.server.{KafkaConfig, KafkaServer}
 import kafka.utils.TestUtils
-import kafka.utils.Utils
+import kafka.utils.{Utils, Logging}
 import junit.framework.Assert._
 import kafka.api.FetchRequest
 import kafka.serializer.Encoder
@@ -33,7 +33,7 @@ import kafka.producer.async.MissingConfi
 import org.scalatest.junit.JUnitSuite
 import org.junit.{After, Before, Test}
 
-class KafkaLog4jAppenderTest extends JUnitSuite {
+class KafkaLog4jAppenderTest extends JUnitSuite with Logging {
 
   var logDir: File = null
   //  var topicLogDir: File = null
@@ -130,10 +130,9 @@ class KafkaLog4jAppenderTest extends JUn
   @Test
   def testLog4jAppends() {
     PropertyConfigurator.configure(getLog4jConfig)
-    val logger = Logger.getLogger(classOf[KafkaLog4jAppenderTest])
 
     for(i <- 1 to 5)
-      logger.info("test")
+      info("test")
 
     Thread.sleep(500)
 



Mime
View raw message