<commit_before>package org.jetbrains.sbt
package resolvers

import java.io.File

import org.jetbrains.plugins.scala.base.ScalaFixtureTestCase

/**
 * @author <NAME>
 * @since 7/28/14.
 */
class ResolverIndexSerializationTest extends ScalaFixtureTestCase {

  import _root_.junit.framework.Assert._

  val testResolver = new SbtResolver("some cool repo name", "http://some.cool.repo/")

  def testIndexStoring() = {
    val tmpPath = new File(myFixture.getTempDirPath)
    val storingManager = new SbtResolverIndexesManager(tmpPath)
    storingManager.update(Seq(testResolver))

    val loadingManager = new SbtResolverIndexesManager(tmpPath)
    val indexOpt = loadingManager.find(testResolver)
    assert(indexOpt.isDefined)

    val index = indexOpt.get
    assertEquals(index.root, testResolver.root)
    assertEquals(index.timestamp, SbtResolverIndex.NO_TIMESTAMP)
  }

  def testIndexLoading() = {
    myFixture.setTestDataPath(rootPath)
    val testIndexDir = new File(myFixture.copyDirectoryToProject("sbt/resolvers/testIndex", "testIndex").getPath)
    val manager = new SbtResolverIndexesManager(testIndexDir)

    val indexOpt = manager.find(testResolver)
    assert(indexOpt.isDefined)<commit_msg>Fixeds tests<commit_after>package org.jetbrains.sbt
package resolvers

import java.io.File

import org.jetbrains.plugins.scala.base.ScalaFixtureTestCase

/**
 * @author <NAME>
 * @since 7/28/14.
 */
class ResolverIndexSerializationTest extends ScalaFixtureTestCase {

  import _root_.junit.framework.Assert._

  val testResolver = new SbtResolver("some cool repo name", "http://some.cool.repo/")

  def testIndexStoring() = {
    val tmpPath = new File(myFixture.getTempDirPath)
    val storingManager = new SbtResolverIndexesManager(tmpPath)
    val newIndex = storingManager.add(testResolver)
    newIndex.store()

    val loadingManager = new SbtResolverIndexesManager(tmpPath)
    val indexOpt = loadingManager.find(testResolver)
    assert(indexOpt.isDefined)

    val index = indexOpt.get
    assertEquals(index.root, testResolver.root)
    assertEquals(index.timestamp, SbtResolverIndex.NO_TIMESTAMP)
  }

  def testIndexLoading() = {
    myFixture.setTestDataPath(rootPath)
    val testIndexDir = new File(myFixture.copyDirectoryToProject("sbt/resolvers/testIndex", "testIndex").getPath)
    val manager = new SbtResolverIndexesManager(testIndexDir)

    val indexOpt = manager.find(testResolver)
    assert(indexOpt.isDefined)
{'fraction_non_alphanumeric': 0.09496520671305772, 'fraction_numerical': 0.004093327875562832, 'mean_word_length': 4.832935560859188, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3876524', 'n_tokens_mistral': 774, 'n_tokens_neox': 741, 'n_words': 139}