Package siena.remote

Examples of siena.remote.RemotePersistenceManager


 
  public void testRemote() {
    MockPersistenceManager mock = new MockPersistenceManager();
    PersistenceManagerFactory.install(mock, Person.class);
   
    RemotePersistenceManager remote = new RemotePersistenceManager();
    Properties properties = new Properties();
    properties.setProperty("connector", MockConnector.class.getName());
    properties.setProperty("serializer", MockConnector.class.getName());
    remote.init(properties);
   
    remote.insert(TESLA);
    assertEquals("insert", mock.action);
    assertEquals(TESLA, mock.object);
   
    remote.update(TESLA);
    assertEquals("update", mock.action);
    assertEquals(TESLA, mock.object);
   
    Person expected = new Person();
    expected.id = TESLA.id;
   
    remote.delete(TESLA);
    assertEquals("delete", mock.action);
    assertEquals(expected, mock.object);
   
    remote.get(TESLA);
    assertEquals("get", mock.action);
    assertEquals(expected, mock.object);
   
    remote.createQuery(Person.class).fetch();
    assertEquals(0, mock.lastQuery.filters.size());
    assertEquals(0, mock.lastQuery.orders.size());
   
    remote.createQuery(Person.class).order("firstName").order("lastName").fetch();
    assertEquals(0, mock.lastQuery.filters.size());
    assertEquals(Arrays.asList("firstName", "lastName"), mock.lastQuery.orders);
   
    remote.createQuery(Person.class)
      .filter("city", "Ulm")
      .filter("firstName", "Albert")
      .filter("lastName", null)
      .order("firstName")
      .order("lastName")
View Full Code Here


 
  public void testSecurity() {
    MockPersistenceManager mock = new MockPersistenceManager();
    PersistenceManagerFactory.install(mock, Person.class);
   
    RemotePersistenceManager remote = new RemotePersistenceManager();
    Properties properties = new Properties();
    properties.setProperty("connector", MockConnector.class.getName());
    properties.setProperty("serializer", MockConnector.class.getName());
    properties.setProperty("key", "siena");
    remote.init(properties);
   
    remote.createQuery(Person.class).fetch();
  }
View Full Code Here

 
  public void testFailSecurity() {
    MockPersistenceManager mock = new MockPersistenceManager();
    PersistenceManagerFactory.install(mock, Person.class);
   
    RemotePersistenceManager remote = new RemotePersistenceManager();
    Properties properties = new Properties();
    properties.setProperty("connector", MockConnector.class.getName());
    properties.setProperty("serializer", MockConnector.class.getName());
    properties.setProperty("key", "siena");
    remote.init(properties);
   
    MockConnector.key = "1234";
   
    try {
      remote.createQuery(Person.class).fetch();
    } catch(SienaException e) {
      return;
    }
    fail("It should have failed due to invalid hash");
  }
View Full Code Here

TOP

Related Classes of siena.remote.RemotePersistenceManager

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.