Examples of toStringID()


Examples of org.apache.mahout.cf.taste.model.IDMigrator.toStringID()

  public void testStore() throws Exception {
    IDMigrator migrator = new MemoryIDMigrator();
    long id = migrator.toLongID(DUMMY_STRING);
    assertNull(migrator.toStringID(id));
    migrator.storeMapping(id, DUMMY_STRING);
    assertEquals(DUMMY_STRING, migrator.toStringID(id));
  }

  public void testInitialize() throws Exception {
    IDMigrator migrator = new MemoryIDMigrator();
    long id = migrator.toLongID(DUMMY_STRING);
View Full Code Here

Examples of org.apache.mahout.cf.taste.model.IDMigrator.toStringID()

  }

  public void testInitialize() throws Exception {
    IDMigrator migrator = new MemoryIDMigrator();
    long id = migrator.toLongID(DUMMY_STRING);
    assertNull(migrator.toStringID(id));
    migrator.initialize(Collections.singleton(DUMMY_STRING));
    assertEquals(DUMMY_STRING, migrator.toStringID(id));
  }

}
View Full Code Here

Examples of org.apache.mahout.cf.taste.model.IDMigrator.toStringID()

  public void testInitialize() throws Exception {
    IDMigrator migrator = new MemoryIDMigrator();
    long id = migrator.toLongID(DUMMY_STRING);
    assertNull(migrator.toStringID(id));
    migrator.initialize(Collections.singleton(DUMMY_STRING));
    assertEquals(DUMMY_STRING, migrator.toStringID(id));
  }

}
View Full Code Here

Examples of org.apache.mahout.cf.taste.model.IDMigrator.toStringID()

  public void testLoadFromFile() throws Exception {
    IDMigrator migrator = new FileIDMigrator(testFile);
    long dogAsLong = migrator.toLongID("dog");
    long cowAsLong = migrator.toLongID("cow");
    long donkeyAsLong = migrator.toLongID("donkey");
    assertEquals("dog", migrator.toStringID(dogAsLong));
    assertEquals("cow", migrator.toStringID(cowAsLong));
    assertNull(migrator.toStringID(donkeyAsLong));
  }

  @Test
View Full Code Here

Examples of org.apache.mahout.cf.taste.model.IDMigrator.toStringID()

    IDMigrator migrator = new FileIDMigrator(testFile);
    long dogAsLong = migrator.toLongID("dog");
    long cowAsLong = migrator.toLongID("cow");
    long donkeyAsLong = migrator.toLongID("donkey");
    assertEquals("dog", migrator.toStringID(dogAsLong));
    assertEquals("cow", migrator.toStringID(cowAsLong));
    assertNull(migrator.toStringID(donkeyAsLong));
  }

  @Test
  public void testNoRefreshAfterFileUpdate() throws Exception {
View Full Code Here

Examples of org.apache.mahout.cf.taste.model.IDMigrator.toStringID()

    long dogAsLong = migrator.toLongID("dog");
    long cowAsLong = migrator.toLongID("cow");
    long donkeyAsLong = migrator.toLongID("donkey");
    assertEquals("dog", migrator.toStringID(dogAsLong));
    assertEquals("cow", migrator.toStringID(cowAsLong));
    assertNull(migrator.toStringID(donkeyAsLong));
  }

  @Test
  public void testNoRefreshAfterFileUpdate() throws Exception {
    IDMigrator migrator = new FileIDMigrator(testFile, 0L);
View Full Code Here

Examples of org.apache.mahout.cf.taste.model.IDMigrator.toStringID()

  public void testNoRefreshAfterFileUpdate() throws Exception {
    IDMigrator migrator = new FileIDMigrator(testFile, 0L);

    /* call a method to make sure the original file is loaded */
    long dogAsLong = migrator.toLongID("dog");
    migrator.toStringID(dogAsLong);

    /* change the underlying file,
     * we have to wait at least a second to see the change in the file's lastModified timestamp */
    Thread.sleep(2000L);
    writeLines(testFile, UPDATED_STRING_IDS);
View Full Code Here

Examples of org.apache.mahout.cf.taste.model.IDMigrator.toStringID()

    writeLines(testFile, UPDATED_STRING_IDS);

    /* we shouldn't see any changes in the data as we have not yet refreshed */
    long cowAsLong = migrator.toLongID("cow");
    long donkeyAsLong = migrator.toLongID("donkey");
    assertEquals("dog", migrator.toStringID(dogAsLong));
    assertEquals("cow", migrator.toStringID(cowAsLong));
    assertNull(migrator.toStringID(donkeyAsLong));
  }

  @Test
View Full Code Here

Examples of org.apache.mahout.cf.taste.model.IDMigrator.toStringID()

    /* we shouldn't see any changes in the data as we have not yet refreshed */
    long cowAsLong = migrator.toLongID("cow");
    long donkeyAsLong = migrator.toLongID("donkey");
    assertEquals("dog", migrator.toStringID(dogAsLong));
    assertEquals("cow", migrator.toStringID(cowAsLong));
    assertNull(migrator.toStringID(donkeyAsLong));
  }

  @Test
  public void testRefreshAfterFileUpdate() throws Exception {
View Full Code Here

Examples of org.apache.mahout.cf.taste.model.IDMigrator.toStringID()

    /* we shouldn't see any changes in the data as we have not yet refreshed */
    long cowAsLong = migrator.toLongID("cow");
    long donkeyAsLong = migrator.toLongID("donkey");
    assertEquals("dog", migrator.toStringID(dogAsLong));
    assertEquals("cow", migrator.toStringID(cowAsLong));
    assertNull(migrator.toStringID(donkeyAsLong));
  }

  @Test
  public void testRefreshAfterFileUpdate() throws Exception {
    IDMigrator migrator = new FileIDMigrator(testFile, 0L);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.