diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 7710c06f4a..b4cac48d92 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -11,7 +11,9 @@ Breaking API Changes ~~~~~~~~~~~~~~~~~~~~ * util-core: `c.t.io.Reader.Writable` and `c.t.Reader.writable()` are removed. Use `c.t.io.Pipe` -instead. ``PHAB_ID=D226603`` + instead. ``PHAB_ID=D226603`` + +* util-core: `c.t.util.TempFolder` has been moved to `c.t.io.TempFolder`. ``PHAB_ID=D226940`` Runtime Behavior Changes ~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/util-core/src/main/scala/com/twitter/util/TempFolder.scala b/util-core/src/main/scala/com/twitter/io/TempFolder.scala similarity index 88% rename from util-core/src/main/scala/com/twitter/util/TempFolder.scala rename to util-core/src/main/scala/com/twitter/io/TempFolder.scala index 28174fdb5b..ceb977ca9b 100644 --- a/util-core/src/main/scala/com/twitter/util/TempFolder.scala +++ b/util-core/src/main/scala/com/twitter/io/TempFolder.scala @@ -14,18 +14,14 @@ * limitations under the License. */ -package com.twitter.util +package com.twitter.io import java.io.File -import com.twitter.io.Files - /** * Test mixin that creates a temporary thread-local folder for a block of code to execute in. * The folder is recursively deleted after the test. * - * Note, the [[com.twitter.util.io]] package would be a better home for this trait. - * * Note that multiple uses of TempFolder cannot be nested, because the temporary directory * is effectively a thread-local global. */ @@ -59,11 +55,11 @@ trait TempFolder { * @return The current thread's active temporary folder. * @throws RuntimeException if not running within a withTempFolder block */ - def folderName = { _folderName.get.getPath } + def folderName: String = { _folderName.get.getPath } /** * @return The canonical path of the current thread's active temporary folder. * @throws RuntimeException if not running within a withTempFolder block */ - def canonicalFolderName = { _folderName.get.getCanonicalPath } + def canonicalFolderName: String = { _folderName.get.getCanonicalPath } } diff --git a/util-core/src/test/scala/com/twitter/io/FilesTest.scala b/util-core/src/test/scala/com/twitter/io/FilesTest.scala index 5f7a62eb8d..0ce3e1657f 100644 --- a/util-core/src/test/scala/com/twitter/io/FilesTest.scala +++ b/util-core/src/test/scala/com/twitter/io/FilesTest.scala @@ -1,13 +1,10 @@ package com.twitter.io import java.io.File - import org.junit.runner.RunWith import org.scalatest.WordSpec import org.scalatest.junit.JUnitRunner -import com.twitter.util.TempFolder - @RunWith(classOf[JUnitRunner]) class FilesTest extends WordSpec with TempFolder { "Files" should { diff --git a/util-logging/src/test/scala/com/twitter/logging/FileHandlerTest.scala b/util-logging/src/test/scala/com/twitter/logging/FileHandlerTest.scala index a617744658..1f6f5b0f5f 100644 --- a/util-logging/src/test/scala/com/twitter/logging/FileHandlerTest.scala +++ b/util-logging/src/test/scala/com/twitter/logging/FileHandlerTest.scala @@ -18,13 +18,14 @@ package com.twitter.logging import java.io._ import java.util.{Calendar, Date, logging => javalog} - import org.junit.runner.RunWith import org.scalatest.WordSpec import org.scalatest.junit.JUnitRunner import com.twitter.conversions.storage._ import com.twitter.conversions.time._ -import com.twitter.util.{TempFolder, Time} +import com.twitter.io.TempFolder +import com.twitter.util.Time + @RunWith(classOf[JUnitRunner]) class FileHandlerTest extends WordSpec with TempFolder { def reader(filename: String) = { diff --git a/util-logging/src/test/scala/com/twitter/logging/LoggerTest.scala b/util-logging/src/test/scala/com/twitter/logging/LoggerTest.scala index c199c23288..27f2a20668 100644 --- a/util-logging/src/test/scala/com/twitter/logging/LoggerTest.scala +++ b/util-logging/src/test/scala/com/twitter/logging/LoggerTest.scala @@ -17,7 +17,7 @@ package com.twitter.logging import com.twitter.conversions.time._ -import com.twitter.util.TempFolder +import com.twitter.io.TempFolder import java.net.InetSocketAddress import java.util.concurrent.{Callable, CountDownLatch, Executors, Future, TimeUnit} import java.util.{logging => javalog} diff --git a/util-logging/src/test/scala/com/twitter/logging/ThrottledHandlerTest.scala b/util-logging/src/test/scala/com/twitter/logging/ThrottledHandlerTest.scala index 6a990588f8..51922db563 100644 --- a/util-logging/src/test/scala/com/twitter/logging/ThrottledHandlerTest.scala +++ b/util-logging/src/test/scala/com/twitter/logging/ThrottledHandlerTest.scala @@ -17,7 +17,8 @@ package com.twitter.logging import com.twitter.conversions.time._ -import com.twitter.util.{TempFolder, Time} +import com.twitter.io.TempFolder +import com.twitter.util.Time import org.scalatest.{BeforeAndAfter, WordSpec} class ThrottledHandlerTest extends WordSpec with BeforeAndAfter with TempFolder { diff --git a/util-slf4j-api/src/test/scala/com/twitter/util/logging/SerializableLoggingTest.scala b/util-slf4j-api/src/test/scala/com/twitter/util/logging/SerializableLoggingTest.scala index ba77802a1e..32460dbba3 100644 --- a/util-slf4j-api/src/test/scala/com/twitter/util/logging/SerializableLoggingTest.scala +++ b/util-slf4j-api/src/test/scala/com/twitter/util/logging/SerializableLoggingTest.scala @@ -1,6 +1,6 @@ package com.twitter.util.logging -import com.twitter.util.TempFolder +import com.twitter.io.TempFolder import java.io._ import org.scalatest.FunSuite