Examples of IPreference


Examples of org.rssowl.core.persist.IPreference

    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

Examples of org.rssowl.core.persist.IPreference

    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

Examples of org.rssowl.core.persist.IPreference

    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

Examples of org.rssowl.core.persist.IPreference

        }
      };
      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

Examples of org.rssowl.core.persist.IPreference

   *
   * @throws Exception
   */
  @Test
  public void testSaveSingleEntryStringArray() throws Exception {
    IPreference pref = fFactory.createPreference("Foo");
    pref.putStrings("Bar");
    fDao.save(pref);
    fDao.load(pref.getKey()).getStrings();
  }
View Full Code Here

Examples of org.rssowl.core.persist.IPreference

   *
   * @throws Exception
   */
  @Test
  public void testSaveStringsDuplicate() throws Exception {
    IPreference pref = fFactory.createPreference("Foo");
    pref.putStrings("1", "2", "3", "1", "2", "3");
    fDao.save(pref);
    pref = fDao.loadOrCreate("Foo");
    pref.putStrings("1", "2", "3", "1", "2", "3");
    fDao.save(pref);
  }
View Full Code Here

Examples of org.rssowl.core.persist.IPreference

   *
   * @throws Exception
   */
  @Test
  public void testSaveArrayWithDuplicateStrings() throws Exception {
    IPreference pref = fFactory.createPreference("Foo");
    pref.putStrings("1", "2", "3", "1", "2", "3");
    fDao.save(pref);
  }
View Full Code Here

Examples of org.rssowl.core.persist.IPreference

   * @throws Exception
   */
  @Test
  public void testUpdateArray() throws Exception {
    String key = "Foo";
    IPreference pref = fFactory.createPreference(key);
    pref.putStrings("1", "2", "3", "1", "2", "3");
    fDao.save(pref);
    String[] updatedStrings = new String[] { "1", "3", "2" };
    pref.putStrings(updatedStrings);
    fDao.save(pref);
    String[] savedStrings = fDao.load(key).getStrings();
    assertArrayEquals(updatedStrings, savedStrings);
  }
View Full Code Here

Examples of org.rssowl.core.persist.IPreference

      query.descend("fId").constrain(Long.valueOf(preference.getId())); //$NON-NLS-1$

      List<IPreference> result = query.execute();
      assertEquals(1, result.size());

      IPreference otherPreference = result.get(0);

      assertEquals(preference.getKey(), otherPreference.getKey());
      if ("string".equals(preference.getKey()))
        assertEquals(preference.getString(), otherPreference.getString());

      if ("strings".equals(preference.getKey()))
        assertTrue(Arrays.equals(preference.getStrings(), otherPreference.getStrings()));

      if ("boolean".equals(preference.getKey()))
        assertEquals(preference.getBoolean(), otherPreference.getBoolean());

      if ("booleans".equals(preference.getKey()))
        assertTrue(Arrays.equals(preference.getBooleans(), otherPreference.getBooleans()));

      if ("integer".equals(preference.getKey()))
        assertEquals(preference.getInteger(), otherPreference.getInteger());

      if ("integers".equals(preference.getKey()))
        assertTrue(Arrays.equals(preference.getIntegers(), otherPreference.getIntegers()));

      if ("long".equals(preference.getKey()))
        assertEquals(preference.getLong(), otherPreference.getLong());

      if ("longs".equals(preference.getKey()))
        assertTrue(Arrays.equals(preference.getLongs(), otherPreference.getLongs()));
    }

    /* Assert Label */
    List<ILabel> labels = db.query(ILabel.class);
    assertEquals(labels.size(), defragmentedDb.query(ILabel.class).size());
View Full Code Here

Examples of org.rssowl.core.persist.IPreference

    super(Preference.class, true);
  }

  @Override
  protected void doSave(IPreference entity) {
    IPreference pref = load(entity.getKey());
    if (pref != null && pref != entity)
      throw new UniqueConstraintException("key", entity); //$NON-NLS-1$

    super.doSave(entity);
  }
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.