Search in sources :

Example 6 with Event

use of com.enonic.xp.event.Event in project xp by enonic.

the class NodeEventsTest method testCreated.

@Test
public void testCreated() {
    final Node created = createNode("created", NodePath.create("/mynode1/child1").build(), "id");
    Event event = NodeEvents.created(created);
    assertNotNull(event);
    assertTrue(event.isDistributed());
    assertEquals("[{id=id, path=/mynode1/child1/created, branch=draft, repo=com.enonic.cms.default}]", event.getValue("nodes").get().toString());
}
Also used : Node(com.enonic.xp.node.Node) Event(com.enonic.xp.event.Event) Test(org.junit.jupiter.api.Test)

Example 7 with Event

use of com.enonic.xp.event.Event in project xp by enonic.

the class NodeEventsTest method testUpdated.

@Test
public void testUpdated() {
    final Node updated = createNode("updated", NodePath.create("/mynode1/child1").build(), "myId");
    Event event = NodeEvents.updated(updated);
    assertNotNull(event);
    assertTrue(event.isDistributed());
    assertEquals(NodeEvents.NODE_UPDATED_EVENT, event.getType());
    assertEquals("[{id=myId, path=/mynode1/child1/updated, branch=draft, repo=com.enonic.cms.default}]", event.getValue("nodes").get().toString());
}
Also used : Node(com.enonic.xp.node.Node) Event(com.enonic.xp.event.Event) Test(org.junit.jupiter.api.Test)

Example 8 with Event

use of com.enonic.xp.event.Event in project xp by enonic.

the class NodeEventsTest method testNullArguments.

@Test
public void testNullArguments() {
    Event eventCreated = NodeEvents.created(null);
    Event eventDeleted = NodeEvents.deleted(null);
    assertNull(eventCreated);
    assertNull(eventDeleted);
}
Also used : Event(com.enonic.xp.event.Event) Test(org.junit.jupiter.api.Test)

Example 9 with Event

use of com.enonic.xp.event.Event in project xp by enonic.

the class NodeEventsTest method testDeleted.

@Test
public void testDeleted() {
    final Node deleted = createNode("deleted", NodePath.create("/mynode1/child1").build(), "myId");
    Event event = NodeEvents.created(deleted);
    assertNotNull(event);
    assertTrue(event.isDistributed());
    assertEquals("[{id=myId, path=/mynode1/child1/deleted, branch=draft, repo=com.enonic.cms.default}]", event.getValue("nodes").get().toString());
}
Also used : Node(com.enonic.xp.node.Node) Event(com.enonic.xp.event.Event) Test(org.junit.jupiter.api.Test)

Example 10 with Event

use of com.enonic.xp.event.Event in project xp by enonic.

the class RepositoryEventsTest method testRestored.

@Test
public void testRestored() {
    Event event = RepositoryEvents.restored();
    assertNotNull(event);
    assertTrue(event.isDistributed());
    assertEquals(RepositoryEvents.RESTORED_EVENT_TYPE, event.getType());
}
Also used : Event(com.enonic.xp.event.Event) Test(org.junit.jupiter.api.Test)

Aggregations

Event (com.enonic.xp.event.Event)48 Test (org.junit.jupiter.api.Test)46 Node (com.enonic.xp.node.Node)12 NodeId (com.enonic.xp.node.NodeId)7 NodePath (com.enonic.xp.node.NodePath)7 InternalContext (com.enonic.xp.repo.impl.InternalContext)7 EventListener (com.enonic.xp.event.EventListener)6 TaskInfo (com.enonic.xp.task.TaskInfo)6 NodeBranchEntry (com.enonic.xp.node.NodeBranchEntry)3 ScriptEventListener (com.enonic.xp.script.event.ScriptEventListener)3 Branch (com.enonic.xp.branch.Branch)2 PushNodeEntries (com.enonic.xp.node.PushNodeEntries)2 NodeMovedParams (com.enonic.xp.repo.impl.storage.NodeMovedParams)2 RepositoryId (com.enonic.xp.repository.RepositoryId)2 JsonMapGenerator (com.enonic.xp.script.serializer.JsonMapGenerator)2 MapSerializable (com.enonic.xp.script.serializer.MapSerializable)2 AuthenticationInfo (com.enonic.xp.security.auth.AuthenticationInfo)2 Member (com.hazelcast.core.Member)2 Message (com.hazelcast.core.Message)2 List (java.util.List)2