Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.IPreference


  public final void testPutGetBoolean() throws Exception {
    String key1 = "key1";
    String key2 = "key2";
    String key3 = "key3";

    IPreference pref = fDao.loadOrCreate(key1);
    pref.putBooleans(true);
    fDao.save(pref);

    pref = fDao.loadOrCreate(key2);
    pref.putBooleans(true);
    fDao.save(pref);

    pref = fDao.loadOrCreate(key3);
    pref.putBooleans(false);
    fDao.save(pref);

    assertEquals(Boolean.TRUE, fDao.load(key1).getBoolean());
    assertEquals(Boolean.TRUE, fDao.load(key2).getBoolean());
    assertEquals(Boolean.FALSE, fDao.load(key3).getBoolean());

    pref = fDao.loadOrCreate(key2);
    pref.putBooleans(false);
    fDao.save(pref);

    assertEquals(Boolean.TRUE, fDao.load(key1).getBoolean());
    assertEquals(Boolean.FALSE, fDao.load(key2).getBoolean());
    assertEquals(Boolean.FALSE, fDao.load(key3).getBoolean());
View Full Code Here


   * @throws Exception
   */
  @Test
  public final void testActivation() throws Exception   {
    String key = "key";
    IPreference pref = fFactory.createPreference(key);
    pref.putBooleans(true);
    fDao.save(pref);
    pref = null;
    System.gc();
    assertEquals(Boolean.TRUE, fDao.load(key).getBoolean());
    String anotherKey = "anotherKey";
    String[] longs = new String[] { "2", "3", "5"};
    pref = fFactory.createPreference(anotherKey);
    pref.putStrings(longs);
    fDao.save(pref);
    longs = null;
    pref = null;
    System.gc();
    assertEquals(3, fDao.load(anotherKey).getStrings().length);
View Full Code Here

  public final void testPutGetStrings() throws Exception {
    String key1 = "key1";
    String key2 = "key2";
    String key3 = "key3";

    IPreference pref1 = fFactory.createPreference(key1);
    String[] value1 = new String[] { "value1.1", "value1.2", "value1.3" };
    pref1.putStrings(value1);

    IPreference pref2 = fFactory.createPreference(key2);
    String[] value2 = new String[] { "value2.1", "value2.2", "value2.3" };
    pref2.putStrings(value2);

    IPreference pref3 = fFactory.createPreference(key3);
    String[] value3 = new String[] { "value3.1", "value3.2", "value3.3" };
    pref3.putStrings(value3);

    fDao.save(pref1);
    fDao.save(pref2);
    fDao.save(pref3);
View Full Code Here

    long[] value1 = new long[] { 11, 12, 13 };
    long[] value2 = new long[] { 21, 22, 23 };
    long[] value3 = new long[] { 31, 32, 33 };

    IPreference pref = fDao.loadOrCreate(key1);
    pref.putLongs(value1);
    fDao.save(pref);

    pref = fDao.loadOrCreate(key2);
    pref.putLongs(value2);
    fDao.save(pref);

    pref = fDao.loadOrCreate(key3);
    pref.putLongs(value3);
    fDao.save(pref);

    assertEquals(true, Arrays.equals(value1, fDao.load(key1).getLongs()));
    assertEquals(true, Arrays.equals(value2, fDao.load(key2).getLongs()));
    assertEquals(true, Arrays.equals(value3, fDao.load(key3).getLongs()));

    value2 = new long[] { 110, 120, 130 };
    pref = fDao.loadOrCreate(key2);
    pref.putLongs(value2);
    fDao.save(pref);

    assertEquals(true, Arrays.equals(value1, fDao.load(key1).getLongs()));
    assertEquals(true, Arrays.equals(value2, fDao.load(key2).getLongs()));
    assertEquals(true, Arrays.equals(value3, fDao.load(key3).getLongs()));
View Full Code Here

    int[] value1 = new int[] { 11, 12, 13 };
    int[] value2 = new int[] { 21, 22, 23 };
    int[] value3 = new int[] { 31, 32, 33 };

    IPreference pref = fFactory.createPreference(key1);
    pref.putIntegers(value1);
    fDao.save(pref);

    pref = fFactory.createPreference(key2);
    pref.putIntegers(value2);
    fDao.save(pref);

    pref = fFactory.createPreference(key3);
    pref.putIntegers(value3);
    fDao.save(pref);

    assertEquals(true, Arrays.equals(value1, fDao.load(key1).getIntegers()));
    assertEquals(true, Arrays.equals(value2, fDao.load(key2).getIntegers()));
    assertEquals(true, Arrays.equals(value3, fDao.load(key3).getIntegers()));

    value2 = new int[] { 110, 120, 130 };
    pref = fDao.loadOrCreate(key2);
    pref.putIntegers(value2);
    fDao.save(pref);

    assertEquals(true, Arrays.equals(value1, fDao.load(key1).getIntegers()));
    assertEquals(true, Arrays.equals(value2, fDao.load(key2).getIntegers()));
    assertEquals(true, Arrays.equals(value3, fDao.load(key3).getIntegers()));
View Full Code Here

    long value1 = 10;
    long value2 = 15;
    long value3 = 20;

    IPreference pref = fFactory.createPreference(key1);
    pref.putLongs(value1);
    fDao.save(pref);

    pref = fFactory.createPreference(key2);
    pref.putLongs(value2);
    fDao.save(pref);

    pref = fFactory.createPreference(key3);
    pref.putLongs(value3);
    fDao.save(pref);

    assertEquals(Long.valueOf(value1), fDao.load(key1).getLong());
    assertEquals(Long.valueOf(value2), fDao.load(key2).getLong());
    assertEquals(Long.valueOf(value3), fDao.load(key3).getLong());

    value3 = 5;
    pref.putLongs(value3);
    fDao.save(pref);

    assertEquals(Long.valueOf(value1), fDao.load(key1).getLong());
    assertEquals(Long.valueOf(value2), fDao.load(key2).getLong());
    assertEquals(Long.valueOf(value3), fDao.load(key3).getLong());
View Full Code Here

    String value1 = "value1";
    String value2 = "value2";
    String value3 = "value3";

    IPreference pref = fFactory.createPreference(key1);
    pref.putStrings(value1);
    fDao.save(pref);

    pref = fFactory.createPreference(key2);
    pref.putStrings(value2);
    fDao.save(pref);

    pref = fFactory.createPreference(key3);
    pref.putStrings(value3);
    fDao.save(pref);

    assertEquals(value1, fDao.load(key1).getString());
    assertEquals(value2, fDao.load(key2).getString());
    assertEquals(value3, fDao.load(key3).getString());

    value1 = "newValue1";
    pref = fDao.load(key1);
    pref.putStrings(value1);
    fDao.save(pref);

    assertEquals(value1, fDao.load(key1).getString());
    assertEquals(value2, fDao.load(key2).getString());
    assertEquals(value3, fDao.load(key3).getString());
View Full Code Here

    int value1 = 10;
    int value2 = 15;
    int value3 = 20;

    IPreference pref = fFactory.createPreference(key1);
    pref.putIntegers(value1);
    fDao.save(pref);

    pref = fFactory.createPreference(key2);
    pref.putIntegers(value2);
    fDao.save(pref);

    pref = fFactory.createPreference(key3);
    pref.putIntegers(value3);
    fDao.save(pref);

    assertEquals(Integer.valueOf(value1), fDao.load(key1).getInteger());
    assertEquals(Integer.valueOf(value2), fDao.load(key2).getInteger());
    assertEquals(Integer.valueOf(value3), fDao.load(key3).getInteger());

    value3 = 5;
    pref.putIntegers(value3);
    fDao.save(pref);

    assertEquals(Integer.valueOf(value1), fDao.load(key1).getInteger());
    assertEquals(Integer.valueOf(value2), fDao.load(key2).getInteger());
    assertEquals(Integer.valueOf(value3), fDao.load(key3).getInteger());
View Full Code Here

    boolean value1 = true;
    String value2 = "value2";
    int value3 = 34;
    String[] value4 = new String[] { "value4.1", "value4.2", "value4.3" };

    IPreference pref = fFactory.createPreference(key1);
    pref.putBooleans(value1);
    fDao.save(pref);

    pref = fFactory.createPreference(key2);
    pref.putStrings(value2);
    fDao.save(pref);

    pref = fFactory.createPreference(key3);
    pref.putIntegers(value3);
    fDao.save(pref);

    pref = fFactory.createPreference(key4);
    pref.putStrings(value4);
    fDao.save(pref);

    assertEquals(Boolean.valueOf(value1), fDao.load(key1).getBoolean());
    assertEquals(value2, fDao.load(key2).getString());
    assertEquals(Integer.valueOf(value3), fDao.load(key3).getInteger());
View Full Code Here

        }
      };
      fDao.addEntityListener(prefListener);

      /* Add some Preferences */
      IPreference pref = fFactory.createPreference(key1);
      pref.putBooleans(value1);
      fDao.save(pref);

      pref = fFactory.createPreference(key2);
      pref.putIntegers(value2);
      fDao.save(pref);

      pref = fFactory.createPreference(key3);
      pref.putStrings(value3);
      fDao.save(pref);

      pref = fFactory.createPreference(key4);
      pref.putStrings(value4);
      fDao.save(pref);

      /* Update some Preferences */
      pref = fDao.loadOrCreate(key1);
      pref.putBooleans(false);
      fDao.save(pref);

      pref = fDao.loadOrCreate(key2);
      pref.putIntegers(0);
      fDao.save(pref);

      pref = fDao.loadOrCreate(key3);
      pref.putStrings("updated_value");
      fDao.save(pref);

      pref = fDao.loadOrCreate(key4);
      pref.putStrings("4", "3", "2", "1");
      fDao.save(pref);

      /* Delete some Preferences */
      fDao.delete(key1);
      fDao.delete(key2);
View Full Code Here

TOP

Related Classes of org.rssowl.core.persist.IPreference

Copyright © 2018 www.massapicom. 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.