Package com.netflix.genie.server.repository.jpa

Examples of com.netflix.genie.server.repository.jpa.JobRepository


    /**
     * Test running the job. Mock interactions as this isn't integration test.
     */
    @Test
    public void testCreateJobThrowsRandomException() {
        final JobRepository jobRepo = Mockito.mock(JobRepository.class);
        final GenieNodeStatistics stats = Mockito.mock(GenieNodeStatistics.class);
        final JobManagerFactory jobManagerFactory = Mockito.mock(JobManagerFactory.class);
        final JobServiceJPAImpl impl = new JobServiceJPAImpl(jobRepo, stats, jobManagerFactory);

        final Job job = Mockito.mock(Job.class);
        Mockito.when(job.getId()).thenReturn(JOB_1_ID);
        Mockito.when(jobRepo.exists(JOB_1_ID)).thenReturn(false);
        Mockito.when(jobRepo.save(job)).thenThrow(new RuntimeException("junk"));

        try {
            impl.createJob(job);
            Assert.fail();
        } catch (final GenieException ge) {
View Full Code Here


     *
     * @throws GenieException
     */
    @Test
    public void testRunJob() throws GenieException {
        final JobRepository jobRepo = Mockito.mock(JobRepository.class);
        final GenieNodeStatistics stats = Mockito.mock(GenieNodeStatistics.class);
        final JobManagerFactory jobManagerFactory = Mockito.mock(JobManagerFactory.class);
        final JobServiceJPAImpl impl = new JobServiceJPAImpl(jobRepo, stats, jobManagerFactory);

        final Job job = Mockito.mock(Job.class);
        Mockito.when(job.getId()).thenReturn(JOB_1_ID);
        Mockito.when(jobRepo.findOne(JOB_1_ID)).thenReturn(job);

        final JobManager manager = Mockito.mock(JobManager.class);
        Mockito.when(jobManagerFactory.getJobManager(job)).thenReturn(manager);

        impl.runJob(job);
View Full Code Here

     *
     * @throws GenieException
     */
    @Test(expected = GenieException.class)
    public void testRunJobThrowsException() throws GenieException {
        final JobRepository jobRepo = Mockito.mock(JobRepository.class);
        final GenieNodeStatistics stats = Mockito.mock(GenieNodeStatistics.class);
        final JobManagerFactory jobManagerFactory = Mockito.mock(JobManagerFactory.class);
        final JobServiceJPAImpl impl = new JobServiceJPAImpl(jobRepo, stats, jobManagerFactory);

        final Job job = Mockito.mock(Job.class);
        Mockito.when(job.getId()).thenReturn(JOB_1_ID);
        Mockito.when(jobRepo.findOne(JOB_1_ID)).thenReturn(job);

        final JobManager manager = Mockito.mock(JobManager.class);
        Mockito.when(jobManagerFactory.getJobManager(job))
                .thenThrow(new GenieException(
                                HttpURLConnection.HTTP_NOT_FOUND,
View Full Code Here

TOP

Related Classes of com.netflix.genie.server.repository.jpa.JobRepository

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.