Search in sources :

Example 1 with MapEvent

use of org.apache.cayenne.map.event.MapEvent in project cayenne by apache.

the class DataNodeEventTest method testNoNameChange.

@Test
public void testNoNameChange() throws Exception {
    MapEvent event = new DataNodeEvent(new Object(), new DataNodeDescriptor("someName"));
    assertFalse(event.isNameChange());
    event.setOldName("someOldName");
    assertTrue(event.isNameChange());
}
Also used : MapEvent(org.apache.cayenne.map.event.MapEvent) DataNodeDescriptor(org.apache.cayenne.configuration.DataNodeDescriptor) Test(org.junit.Test)

Example 2 with MapEvent

use of org.apache.cayenne.map.event.MapEvent in project cayenne by apache.

the class DataNodeEventTest method testNewName.

@Test
public void testNewName() throws Exception {
    MapEvent event = new DataNodeEvent(new Object(), new DataNodeDescriptor("someName"));
    assertEquals("someName", event.getNewName());
}
Also used : MapEvent(org.apache.cayenne.map.event.MapEvent) DataNodeDescriptor(org.apache.cayenne.configuration.DataNodeDescriptor) Test(org.junit.Test)

Example 3 with MapEvent

use of org.apache.cayenne.map.event.MapEvent in project cayenne by apache.

the class DataNodeEventTest method testNameChange.

@Test
public void testNameChange() throws Exception {
    MapEvent event = new DataNodeEvent(new Object(), new DataNodeDescriptor("someName"), "someOldName");
    assertEquals("someName", event.getNewName());
    assertTrue(event.isNameChange());
}
Also used : MapEvent(org.apache.cayenne.map.event.MapEvent) DataNodeDescriptor(org.apache.cayenne.configuration.DataNodeDescriptor) Test(org.junit.Test)

Example 4 with MapEvent

use of org.apache.cayenne.map.event.MapEvent in project cayenne by apache.

the class ModelerEventTest method testConstructor1.

@Test
public void testConstructor1() throws Exception {
    Object src = new Object();
    MapEvent e = new TestMapEvent(src);
    assertSame(src, e.getSource());
}
Also used : MapEvent(org.apache.cayenne.map.event.MapEvent) Test(org.junit.Test)

Example 5 with MapEvent

use of org.apache.cayenne.map.event.MapEvent in project cayenne by apache.

the class ModelerEventTest method testId.

@Test
public void testId() throws Exception {
    MapEvent e = new TestMapEvent(new Object());
    assertEquals(MapEvent.CHANGE, e.getId());
    e.setId(MapEvent.ADD);
    assertEquals(MapEvent.ADD, e.getId());
}
Also used : MapEvent(org.apache.cayenne.map.event.MapEvent) Test(org.junit.Test)

Aggregations

MapEvent (org.apache.cayenne.map.event.MapEvent)5 Test (org.junit.Test)5 DataNodeDescriptor (org.apache.cayenne.configuration.DataNodeDescriptor)3