Package org.apache.sling.event.jobs

Examples of org.apache.sling.event.jobs.Job


    public void testJobWithUnsuccessfulAgent() throws Exception {
        ReplicationQueueProcessor queueProcessor = mock(ReplicationQueueProcessor.class);
        when(queueProcessor.process(anyString(), any(ReplicationQueueItem.class))).thenReturn(false);

        ReplicationAgentJobConsumer replicationAgentJobConsumer = new ReplicationAgentJobConsumer(queueProcessor);
        Job job = mock(Job.class);
        JobConsumer.JobResult jobResult = replicationAgentJobConsumer.process(job);
        assertEquals(JobConsumer.JobResult.FAILED, jobResult);
    }
View Full Code Here


    @Test
    public void testPackageAddition() throws Exception {
        JobManager jobManager = mock(JobManager.class);
        JobBuilder builder = mock(JobBuilder.class);
        when(builder.properties(any(Map.class))).thenReturn(builder);
        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);
View Full Code Here

    @Test
    public void testPackageAdditionAndStatusCheck() throws Exception {
        JobManager jobManager = mock(JobManager.class);
        JobBuilder builder = mock(JobBuilder.class);
        when(builder.properties(any(Map.class))).thenReturn(builder);
        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);
View Full Code Here

            }

            @Override
            public Event next() {
                index++;
                final Job job = iter.next();
                return Utility.toEvent(job);
            }

            @Override
            public boolean hasNext() {
View Full Code Here

    }

    @Override
    public Event findJob(final String topic, final Map<String, Object> template) {
        Utility.logDeprecated(logger, "Deprecated JobManager.findJob(...) is called.");
        final Job job = this.getJob(topic, template);
        if ( job != null ) {
            return Utility.toEvent(job);
        }
        return null;
    }
View Full Code Here

            return null;
        }
        if ( name != null ) {
            Utility.logDeprecated(logger, "Job is using deprecated name feature: " + Utility.toString(topic, name, properties));
        }
        Job result = this.addJobInteral(topic, name, properties, errors);
        if ( result == null && name != null ) {
            result = this.getJobByName(name);
        }
        return result;
    }
View Full Code Here

            if ( jobProperties == null ) {
                jobProps = new HashMap<String, Object>();
            } else {
                jobProps = jobProperties;
            }
            final Job job = new JobImpl(jobTopic, jobName, "<unknown>", jobProps);
            sendNotificationInternal(eventAdmin, eventTopic, job, time);
        }
    }
View Full Code Here

            final String eventTopic,
            final Job job,
            final Long time) {
        if ( eventAdmin != null ) {
            // create new copy of job object
            final Job jobCopy = new JobImpl(job.getTopic(), job.getName(), job.getId(), ((JobImpl)job).getProperties());
            sendNotificationInternal(eventAdmin, eventTopic, jobCopy, time);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.sling.event.jobs.Job

Copyright © 2018 www.massapicom. 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.