Commit f0b2fe89 authored by Nicola Fulvio Calabria's avatar Nicola Fulvio Calabria
Browse files

Urgent bugfix: async methods pull/push in jobservice class

MUST LEAVE the job phase on EXECUTING
parent d3d2e313
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -65,12 +65,9 @@ public class JobService {
                    throw new UnsupportedOperationException("Not implemented yet");
            }

            job.setPhase(ExecutionPhase.COMPLETED);

        } catch (VoSpaceErrorSummarizableException e) {
            job.setPhase(ExecutionPhase.ERROR);
            job.setErrorSummary(ErrorSummaryFactory.newErrorSummary(e.getFault()));
        } finally {
            jobDAO.updateJob(job);
        }
    }
+3 −3
Original line number Diff line number Diff line
@@ -143,9 +143,9 @@ public class TransferControllerTest {

        verify(nodeDao, times(1)).setNodeLocation(eq("/portalnode"), eq(2), eq("lbcr.20130512.060722.fits.gz"));

        verify(jobDao, times(2)).updateJob(argThat(j -> {
        verify(jobDao, times(1)).updateJob(argThat(j -> {
            assertTrue(j.getResults().get(0).getHref().startsWith("http://archive.lbto.org"));
            assertEquals(ExecutionPhase.COMPLETED, j.getPhase());
            assertEquals(ExecutionPhase.EXECUTING, j.getPhase());
            return true;
        }));
    }
@@ -187,7 +187,7 @@ public class TransferControllerTest {
                .andExpect(status().is3xxRedirection())
                .andReturn().getResponse().getHeader("Location");

        verify(jobDao, times(2)).updateJob(any());
        verify(jobDao, times(1)).updateJob(any());

        assertThat(redirect, matchesPattern("^/transfers/.*"));
    }