Package net.greghaines.jesque

Examples of net.greghaines.jesque.Job


   
    @Test(expected = ClassCastException.class)
    public void testMaterializeJob_Types_NotRunnable() throws Exception {
        final Map<String, Class<?>> jobTypes = new HashMap<String, Class<?>>();
        jobTypes.put("TestBadJob", TestBadJob.class);
        JesqueUtils.materializeJob(new Job("TestBadJob"), jobTypes);
    }
View Full Code Here


*/
public class TestJsonSerialization {
   
    @Test
    public void serializeJob() throws Exception {
        assertSerializeRoundTrip(new Job("foo"));
        assertSerializeRoundTrip(new Job("TestAction",
                new Object[] { 1, 2.3, true, "test", Arrays.asList("inner", 4.5) }));
        assertSerializeRoundTrip(new Job("TestAction",
                map(entry("foo", "bar"), entry("baz", 123), entry("key3", Arrays.asList("inner2", 6.7, false)))));
        assertSerializeRoundTrip(new Job("TestAction",
                new Object[] { 1, 2.3, true, "test", Arrays.asList("inner", 4.5) },
                map(entry("foo", "bar"), entry("baz", 123), entry("key3", Arrays.asList("inner2", 6.7, false)))));
    }
View Full Code Here

                map(entry("foo", "bar"), entry("baz", 123), entry("key3", Arrays.asList("inner2", 6.7, false)))));
    }

    @Test
    public void serializeJobException() throws Exception {
        final Job job = new Job("TestAction", new Object[] { 1, 2.3, true, "test", Arrays.asList("inner", 4.5) });
        final Exception e = new Exception("Whoopie!");
        e.fillInStackTrace();
        final JobFailure jobFailure = new JobFailure();
        assertSerializeRoundTrip(jobFailure);
        jobFailure.setPayload(job);
View Full Code Here

        assertSerializeRoundTrip(jobFailure);
    }

    @Test
    public void serializeJobError() throws Exception {
        final Job job = new Job("TestAction", new Object[] { 1, 2.3, true, "test", Arrays.asList("inner", 4.5) });
        final Error e = new Error("Whoopie!");
        e.fillInStackTrace();
        final JobFailure jobFailure = new JobFailure();
        assertSerializeRoundTrip(jobFailure);
        jobFailure.setPayload(job);
View Full Code Here

        assertSerializeRoundTrip(jobFailure);
    }

    @Test
    public void serializeWorkerStatus() throws Exception {
        final Job job = new Job("TestAction", new Object[] { 1, 2.3, true, "test", Arrays.asList("inner", 4.5) });
        final WorkerStatus workerStatus = new WorkerStatus();
        assertSerializeRoundTrip(workerStatus);
        workerStatus.setPayload(job);
        workerStatus.setQueue("foo");
        workerStatus.setRunAt(new Date());
View Full Code Here

        Assert.assertEquals(name, qInfo.getName());
        Assert.assertEquals(name, qInfo.toString());
        final Long size = 3l;
        qInfo.setSize(size);
        Assert.assertEquals(size, qInfo.getSize());
        final List<Job> jobs = Arrays.asList(new Job());
        qInfo.setJobs(jobs);
        Assert.assertEquals(jobs, qInfo.getJobs());
    }
View Full Code Here

    }
   
    @Test
    public void testEnqueue() throws IOException {
        final String queue = "queue1";
        final Job job = new Job("foo");
        final String jobJson = ObjectMapperFactory.get().writeValueAsString(job);
        this.mockCtx.checking(new Expectations(){{
            oneOf(jedis).sadd(QUEUES_KEY, queue);
            oneOf(jedis).rpush("resque:queue:" + queue, jobJson);
        }});
View Full Code Here

        this.failureDAO.enqueue(this.jedis, queue, job);
    }
   
    @Test(expected = IllegalArgumentException.class)
    public void testEnqueue_NullQueue() throws IOException {
        this.failureDAO.enqueue(this.jedis, null, new Job("foo"));
    }
View Full Code Here

        this.failureDAO.enqueue(this.jedis, null, new Job("foo"));
    }
   
    @Test(expected = IllegalArgumentException.class)
    public void testEnqueue_EmptyQueue() throws IOException {
        this.failureDAO.enqueue(this.jedis, "", new Job("foo"));
    }
View Full Code Here

        this.failureDAO.enqueue(this.jedis, "foo", null);
    }
   
    @Test(expected = IllegalStateException.class)
    public void testEnqueue_InvalidJob() throws IOException {
        this.failureDAO.enqueue(this.jedis, "foo", new Job());
    }
View Full Code Here

TOP

Related Classes of net.greghaines.jesque.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.