Skip to content

Commit

Permalink
Merge pull request #1243 from gerashegalov/develop
Browse files Browse the repository at this point in the history
Swap hash and filename for filename-extension-sensitive code
  • Loading branch information
ianoc committed Apr 2, 2015
2 parents 3f82ca4 + 2056b28 commit adc9307
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Expand Up @@ -75,7 +75,7 @@ object DistributedCacheFile {
val hexsum = URIHasher(uri)
val fileName = new File(uri.toString).getName

Seq(fileName, hexsum).mkString("-")
Seq(hexsum, fileName).mkString("-")
}

def symlinkedUriFor(sourceUri: URI): URI =
Expand Down
Expand Up @@ -22,11 +22,11 @@ import java.net.URI
import org.apache.hadoop.conf.Configuration
import org.scalatest.{ Matchers, WordSpec }
import scala.collection.mutable
/*
TODO: fix? is it worth having the dep on mockito just for this?

// TODO: fix? is it worth having the dep on mockito just for this?
class DistributedCacheFileSpec extends WordSpec with Matchers {
case class UnknownMode(buffers: Map[Source, mutable.Buffer[Tuple]]) extends TestMode with CascadingLocal
/*
val conf = smartMock[Configuration]
lazy val hdfsMode = {
Expand All @@ -44,18 +44,19 @@ class DistributedCacheFileSpec extends WordSpec with Matchers {
lazy val testMode = smartMock[Test]
lazy val localMode = smartMock[Local]
*/
val uriString = "hdfs://foo.example:1234/path/to/the/stuff/thefilename.blah"
val uri = new URI(uriString)
val hashHex = URIHasher(uri)
val hashedFilename = "thefilename.blah-" + hashHex
val hashedFilename = hashHex + "-thefilename.blah"

"DistributedCacheFile" should {
"symlinkNameFor must return a hashed name" in {
DistributedCacheFile.symlinkNameFor(uri) shouldBe hashedFilename
}
}

/*
"UncachedFile.add" should {
val dcf = new UncachedFile(Right(uri))
Expand All @@ -81,5 +82,5 @@ class DistributedCacheFileSpec extends WordSpec with Matchers {
an[RuntimeException] should be thrownBy (dcf.add()(mode))
}
}
*/
}
*/

0 comments on commit adc9307

Please sign in to comment.