Examples of findJobs()


Examples of org.apache.sling.event.jobs.JobManager.findJobs()

        try {
            final JobManager jobManager = this.getJobManager();
            jobManager.addJob(TOPIC, "myid3", null);
            cb.block();

            assertEquals(1, jobManager.findJobs(JobManager.QueryType.ALL, "sling/test", -1, (Map<String, Object>[])null).size());
            // job is currently sleeping, but force cancel always waits!
            final Event e = jobManager.findJob("sling/test", Collections.singletonMap(JobUtil.PROPERTY_JOB_NAME, (Object)"myid3"));
            assertNotNull(e);
            jobManager.forceRemoveJob((String)e.getProperty(ResourceHelper.PROPERTY_JOB_ID));
            // the job is now removed
View Full Code Here

Examples of org.apache.sling.event.jobs.JobManager.findJobs()

            // job is currently sleeping, but force cancel always waits!
            final Event e = jobManager.findJob("sling/test", Collections.singletonMap(JobUtil.PROPERTY_JOB_NAME, (Object)"myid3"));
            assertNotNull(e);
            jobManager.forceRemoveJob((String)e.getProperty(ResourceHelper.PROPERTY_JOB_ID));
            // the job is now removed
            assertEquals(0, jobManager.findJobs(JobManager.QueryType.ALL, "sling/test", -1, (Map<String, Object>[])null).size());
            final Collection<Job> col = jobManager.findJobs(JobManager.QueryType.HISTORY, "sling/test", -1, (Map<String, Object>[])null);
            try {
                assertEquals(1, col.size());
            } finally {
                for(final Job j : col) {
View Full Code Here

Examples of org.apache.sling.event.jobs.JobManager.findJobs()

            final Event e = jobManager.findJob("sling/test", Collections.singletonMap(JobUtil.PROPERTY_JOB_NAME, (Object)"myid3"));
            assertNotNull(e);
            jobManager.forceRemoveJob((String)e.getProperty(ResourceHelper.PROPERTY_JOB_ID));
            // the job is now removed
            assertEquals(0, jobManager.findJobs(JobManager.QueryType.ALL, "sling/test", -1, (Map<String, Object>[])null).size());
            final Collection<Job> col = jobManager.findJobs(JobManager.QueryType.HISTORY, "sling/test", -1, (Map<String, Object>[])null);
            try {
                assertEquals(1, col.size());
            } finally {
                for(final Job j : col) {
                    jobManager.removeJobById(j.getId());
View Full Code Here

Examples of org.apache.sling.event.jobs.JobManager.findJobs()

        Job job = mock(Job.class);
        when(job.getId()).thenReturn("id-123");
        when(builder.add()).thenReturn(job);
        String topic = JobHandlingReplicationQueue.REPLICATION_QUEUE_TOPIC + "/aname";
        when(jobManager.createJob(topic)).thenReturn(builder);
        when(jobManager.findJobs(JobManager.QueryType.ALL, topic, -1)).thenReturn(Collections.<Job>emptySet());
        when(builder.properties(any(Map.class))).thenReturn(builder);
        ReplicationQueue queue = new JobHandlingReplicationQueue("aname", topic, jobManager);
        ReplicationQueueItem pkg = mock(ReplicationQueueItem.class);
        assertTrue(queue.add(pkg));
    }
View Full Code Here

Examples of org.apache.sling.event.jobs.JobManager.findJobs()

        Job job = mock(Job.class);
        when(job.getId()).thenReturn("id-123");
        when(builder.add()).thenReturn(job);
        String topic = JobHandlingReplicationQueue.REPLICATION_QUEUE_TOPIC + "/aname";
        when(jobManager.createJob(topic)).thenReturn(builder);
        when(jobManager.findJobs(JobManager.QueryType.ALL, topic, -1)).thenReturn(Collections.<Job>emptySet());
        when(builder.properties(any(Map.class))).thenReturn(builder);
        ReplicationQueue queue = new JobHandlingReplicationQueue("aname", topic, jobManager);
        ReplicationQueueItem pkg = mock(ReplicationQueueItem.class);
        assertTrue(queue.add(pkg));
        ReplicationQueueItemState status = queue.getStatus(pkg);
View Full Code Here

Examples of org.apache.sling.event.jobs.JobManager.findJobs()

        try {
            final JobManager jobManager = this.getJobManager();
            jobManager.addJob(TOPIC, Collections.singletonMap("id", (Object)"myid2"));
            cb.block();

            assertEquals(1, jobManager.findJobs(JobManager.QueryType.ALL, TOPIC, -1, (Map<String, Object>[])null).size());
            // job is currently waiting, therefore cancel fails
            final Job e1 = jobManager.getJob(TOPIC, Collections.singletonMap("id", (Object)"myid2"));
            assertNotNull(e1);
            cb2.block(); // and continue job
View Full Code Here

Examples of org.apache.sling.event.jobs.JobManager.findJobs()

            // the job is now in the queue again
            final Job e2 = jobManager.getJob(TOPIC, Collections.singletonMap("id", (Object)"myid2"));
            assertNotNull(e2);
            assertTrue(jobManager.removeJobById(e2.getId()));
            assertEquals(0, jobManager.findJobs(JobManager.QueryType.ALL, TOPIC, -1, (Map<String, Object>[])null).size());
            final Collection<Job> col = jobManager.findJobs(JobManager.QueryType.HISTORY, TOPIC, -1, (Map<String, Object>[])null);
            try {
                assertEquals(1, col.size());
            } finally {
                for(final Job j : col) {
View Full Code Here

Examples of org.apache.sling.event.jobs.JobManager.findJobs()

            // the job is now in the queue again
            final Job e2 = jobManager.getJob(TOPIC, Collections.singletonMap("id", (Object)"myid2"));
            assertNotNull(e2);
            assertTrue(jobManager.removeJobById(e2.getId()));
            assertEquals(0, jobManager.findJobs(JobManager.QueryType.ALL, TOPIC, -1, (Map<String, Object>[])null).size());
            final Collection<Job> col = jobManager.findJobs(JobManager.QueryType.HISTORY, TOPIC, -1, (Map<String, Object>[])null);
            try {
                assertEquals(1, col.size());
            } finally {
                for(final Job j : col) {
                    jobManager.removeJobById(j.getId());
View Full Code Here

Examples of org.apache.sling.event.jobs.JobManager.findJobs()

            assertEquals("Finished count", 4, finished.size());
            assertEquals("Cancelled count", 1, cancelled.size());
            assertEquals("Started count", 10, started.size());
            assertEquals("Failed count", 5, failed.size());
        } finally {
            final Collection<Job> col = jobManager.findJobs(JobManager.QueryType.HISTORY, "sling/test", -1, (Map<String, Object>[])null);
            for(final Job j : col) {
                jobManager.removeJobById(j.getId());
            }
            jcReg.unregister();
            eh1Reg.unregister();
View Full Code Here

Examples of org.apache.sling.event.jobs.JobManager.findJobs()

            // unprocessed count should be 0 as there is no job consumer for this job
            assertEquals("Unprocessed count", 0, jobManager.getStatistics().getNumberOfJobs());
            assertEquals("Finished count", COUNT / 2, jobManager.getStatistics().getNumberOfFinishedJobs());

            // now remove jobs
            for(final Job j : jobManager.findJobs(JobManager.QueryType.ALL, TOPIC + "2", -1, (Map<String, Object>[])null)) {
                jobManager.removeJobById(j.getId());
            }
        } finally {
            eh1.unregister();
        }
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.