Examples of Objectify


Examples of com.googlecode.objectify.Objectify

public class MessageRepository {
    /**
     * @return Collection of Message
     */
    public Collection<Message> getAll() {
        final Objectify service = getService();

        return(service.query(Message.class).list());
    }
View Full Code Here

Examples of com.googlecode.objectify.Objectify

    /**
     * @param message
     */
    public void create(final Message message) {
        final Objectify service = getService();

        service.put(message);
    }
View Full Code Here

Examples of com.googlecode.objectify.Objectify

    /**
     * @param id
     */
    public void deleteById(final Long id) {
        final Objectify service = getService();

        service.delete(Message.class, id.longValue());
    }
View Full Code Here

Examples of com.googlecode.objectify.Objectify

          return other;
  }
 
  @Override
  public MatchInfo LoadMatchByOpponentInDropdown(String userId, String opponentId) {
          Objectify ofy = ObjectifyService.ofy();
          Iterable<MatchInfo> list = ofy.load().type(MatchInfo.class);
          Iterator<MatchInfo> itr= list.iterator();
          while(itr.hasNext()){
              MatchInfo mt = itr.next();
              if(mt.getPlayerOneEmail().equals(userId)&&mt.getPlayerTwoEmail().equals(opponentId)||mt.getPlayerOneEmail().equals(opponentId)&&mt.getPlayerTwoEmail().equals(userId))   
              // found the match!
View Full Code Here

Examples of com.googlecode.objectify.Objectify

        } catch (NotConfiguredException e) { }
    }

    /** Test getObjectify(). */
    @Test public void testGetObjectify() {
        Objectify objectify = mock(Objectify.class);
        DaoObjectifyService service = createService();
        when(service.getObjectifyServiceProxy().begin()).thenReturn(objectify);
        ObjectifyProxy proxy = service.getObjectify();
        assertSame(objectify, proxy.getProxyTarget());
        assertFalse(proxy.isTransactional());
View Full Code Here

Examples of com.googlecode.objectify.Objectify

        assertFalse(proxy.isTransactional());
    }

    /** Test getObjectifyWithTransaction(). */
    @Test public void testGetObjectifyWithTransaction() {
        Objectify objectify = mock(Objectify.class);
        DaoObjectifyService service = createService();
        when(service.getObjectifyServiceProxy().beginTransaction()).thenReturn(objectify);
        ObjectifyProxy proxy = service.getObjectifyWithTransaction();
        assertSame(objectify, proxy.getProxyTarget());
        assertTrue(proxy.isTransactional());
View Full Code Here

Examples of com.googlecode.objectify.Objectify

*/
public class ObjectifyProxyTest {

    /** Test the constructor. */
    @Test public void testConstructor() {
        Objectify objectify = mock(Objectify.class);

        ObjectifyProxy proxy = new ObjectifyProxy(objectify);
        assertSame(objectify, proxy.getProxyTarget());
        assertFalse(proxy.isTransactional());

View Full Code Here

Examples of com.googlecode.objectify.Objectify

        assertTrue(proxy.isTransactional());
    }

    /** Test commit(). */
    @Test public void testCommit() {
        Objectify objectify = mock(Objectify.class, Mockito.RETURNS_DEEP_STUBS);
        ObjectifyProxy proxy = null;

        try {
            proxy = new ObjectifyProxy(objectify, false);
            proxy.commit();
            fail("Expected DaoException");
        } catch (DaoException e) { }

        proxy = new ObjectifyProxy(objectify, true);

        when(objectify.getTxn().isActive()).thenReturn(false);
        proxy.commit();
        verify(objectify.getTxn(), times(0)).commit();

        when(objectify.getTxn().isActive()).thenReturn(true);
        proxy.commit();
        verify(objectify.getTxn()).commit();
    }
View Full Code Here

Examples of com.googlecode.objectify.Objectify

        verify(objectify.getTxn()).commit();
    }

    /** Test rollback(). */
    @Test public void testRollback() {
        Objectify objectify = mock(Objectify.class, Mockito.RETURNS_DEEP_STUBS);
        ObjectifyProxy proxy = null;

        try {
            proxy = new ObjectifyProxy(objectify, false);
            proxy.rollback();
            fail("Expected DaoException");
        } catch (DaoException e) { }

        proxy = new ObjectifyProxy(objectify, true);

        when(objectify.getTxn().isActive()).thenReturn(false);
        proxy.rollback();
        verify(objectify.getTxn(), times(0)).rollback();

        when(objectify.getTxn().isActive()).thenReturn(true);
        proxy.rollback();
        verify(objectify.getTxn()).rollback();
    }
View Full Code Here

Examples of com.googlecode.objectify.Objectify

    return opts;
  }

  @Override
  protected ObjectifyPersister createObjectify(AsyncDatastoreService ds, ObjectifyOpts opts) {
    Objectify objectify = super.createObjectify(ds, opts);
    return new ObjectifyPersisterImpl(objectify, this);
  }
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.