Examples of Watermelon


Examples of org.javalite.activejdbc.test_models.Watermelon

public class OptimisticLockingTest extends ActiveJDBCTest {

    @Test
    public void shouldSetVersionToOneWhenCreatingNewRecord(){
        deleteAndPopulateTable("watermelons");
        Watermelon m = new Watermelon();
        m.set("melon_type", "dark_green");
        m.saveIt();
        Watermelon m1 = Watermelon.findById(1);
        a(m1.get("record_version")).shouldBeEqual(1);
    }
View Full Code Here

Examples of org.javalite.activejdbc.test_models.Watermelon

    @Test
    public void shouldAdvanceVersionWhenRecordIsUpdated(){

        deleteAndPopulateTable("watermelons");
        Watermelon m = new Watermelon();
        m.set("melon_type", "dark_green");
        m.saveIt();

        m = Watermelon.findById(1);
        m.set("melon_type", "red").saveIt();
        a(m.get("record_version")).shouldBeEqual(2);// this will ensure that the value is updated in the model itself
        m = Watermelon.findById(1);
        a(m.get("record_version")).shouldBeEqual(2);

        m = Watermelon.findById(1);
        m.set("melon_type", "green").saveIt();
        m = Watermelon.findById(1);
        a(m.get("record_version")).shouldBeEqual(3);

        m = Watermelon.findById(1);
        m.set("melon_type", "yellow").saveIt();
        m = Watermelon.findById(1);
        a(m.get("record_version")).shouldBeEqual(4);
    }
View Full Code Here

Examples of org.javalite.activejdbc.test_models.Watermelon

    }

    @Test(expected = StaleModelException.class)
    public void shouldThrowExceptionWhenVersionCollisionHappens(){
        deleteAndPopulateTable("watermelons");
        Watermelon m = new Watermelon();
        m.set("melon_type", "dark_green");
        m.saveIt();

        Watermelon m1 = Watermelon.findById(1);
        Watermelon m2 = Watermelon.findById(1);

        m1.set("melon_type", "red");
        m1.saveIt();

        m2.set("melon_type", "yellow");
        m2.saveIt()//<<<<================ this will cause the StaleModelException
    }
View Full Code Here

Examples of org.javalite.activejdbc.test_models.Watermelon

    @Test
    public void should(){
        deleteAndPopulateTable("watermelons");

        Watermelon m = new Watermelon();
        m.set("melon_type", "dark_green");
        m.saveIt();

        m.set("melon_type", "light_green");
        m.saveIt();

        m.set("melon_type", "super_green");
        m.saveIt();

        m.set("melon_type", "dark_red");
        m.saveIt();
    }
View Full Code Here

Examples of org.mule.tck.testmodels.fruit.WaterMelon

    public void testExplicitMethodMatch() throws Exception
    {
        try
        {
            LegacyEntryPointResolverSet resolver = new LegacyEntryPointResolverSet();
            resolver.invoke(new WaterMelon(), getTestEventContext("blah"));
        }
        catch (MuleException e)
        {
            fail("Test should have passed: " + e);
        }
View Full Code Here

Examples of org.mule.tck.testmodels.fruit.WaterMelon

    public void testPoolStart() throws Exception
    {
        DefaultLifecycleEnabledObjectPool pool = createObjectPool();

        // pool was not started yet, objects must be uninitialized
        WaterMelon borrowed = borrow(pool);
        assertEquals("void", borrowed.getState());

        pool.start();
        assertEquals("started", borrowed.getState());
    }
View Full Code Here

Examples of org.mule.tck.testmodels.fruit.WaterMelon

    public void testPoolStop() throws Exception
    {
        DefaultLifecycleEnabledObjectPool pool = createObjectPool();
        pool.start();
       
        WaterMelon borrowed = borrow(pool);
       
        pool.stop();
        assertEquals("stopped", borrowed.getState());
    }
View Full Code Here

Examples of org.mule.tck.testmodels.fruit.WaterMelon

{

    public void testExplicitMethodMatch() throws Exception
    {
        ReflectionEntryPointResolver resolver = new ReflectionEntryPointResolver();
        InvocationResult result = resolver.invoke(new WaterMelon(), getTestEventContext("blah"));
        assertEquals(result.getState(), InvocationResult.State.SUCCESSFUL);
    }
View Full Code Here

Examples of org.mule.tck.testmodels.fruit.WaterMelon

    public void testMulticating() throws Exception
    {
        List fruit = new ArrayList();
        Apple apple = new Apple();
        Banana banana = new Banana();
        WaterMelon melon = new WaterMelon();
        fruit.add(apple);
        fruit.add(banana);
        fruit.add(melon);

        Fruit caster = (Fruit)Multicaster.create(Fruit.class, fruit);
        caster.bite();

        assertTrue(apple.isBitten());
        assertTrue(banana.isBitten());
        assertTrue(melon.isBitten());
    }
View Full Code Here

Examples of org.mule.tck.testmodels.fruit.WaterMelon

public class CallableEntryPointDiscoveryTestCase extends AbstractMuleTestCase
{
    public void testBadMatch() throws Exception
    {
        CallableEntryPointResolver resolver = new CallableEntryPointResolver();
        InvocationResult result = resolver.invoke(new WaterMelon(), getTestEventContext(new StringBuffer("foo")));
        assertEquals("Service doesn't implement Callable", result.getState(), InvocationResult.State.NOT_SUPPORTED);
    }
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.