org.springframework.batch.item.NonTransientResourceException Java Examples
The following examples show how to use
org.springframework.batch.item.NonTransientResourceException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LecturerMappingReaderTest.java From olat with Apache License 2.0 | 9 votes |
@Test public void read_twoLecturersList() throws UnexpectedInputException, ParseException, NonTransientResourceException, Exception { List<Lecturer> twoLecturersList = new ArrayList<Lecturer>(); Lecturer lecturerMock1 = mock(Lecturer.class); Lecturer lecturerMock2 = mock(Lecturer.class); twoLecturersList.add(lecturerMock1); twoLecturersList.add(lecturerMock2); when(daoManagerMock.getAllLecturers()).thenReturn(twoLecturersList); lecturerMappingReaderTestObject.init(); // The first read delivers the first lecturer assertNotNull(lecturerMappingReaderTestObject.read()); // The second read delivers the second lecturer assertNotNull(lecturerMappingReaderTestObject.read()); // The third read delivers null assertNull(lecturerMappingReaderTestObject.read()); }
Example #2
Source File: SynchronizationReaderTest.java From olat with Apache License 2.0 | 6 votes |
@Test public void read_twoCoursesList() throws UnexpectedInputException, ParseException, NonTransientResourceException, Exception { when(daoManagerMock.chekImportedData()).thenReturn(true); List<Long> CreatedSapCourcesIds = new ArrayList<Long>(); CreatedSapCourcesIds.add(100L); CreatedSapCourcesIds.add(200L); when(daoManagerMock.getAllCreatedSapCourcesIds()).thenReturn(CreatedSapCourcesIds); CampusCourseImportTO courseMock1 = mock(CampusCourseImportTO.class); CampusCourseImportTO courseMock2 = mock(CampusCourseImportTO.class); when(daoManagerMock.getSapCampusCourse(100L)).thenReturn(courseMock1); when(daoManagerMock.getSapCampusCourse(200L)).thenReturn(courseMock2); synchronizationReaderTestObject.init(); // The first read delivers the first course assertNotNull(synchronizationReaderTestObject.read()); // The second read delivers the second course assertNotNull(synchronizationReaderTestObject.read()); // The third read delivers null assertNull(synchronizationReaderTestObject.read()); }
Example #3
Source File: StudentMappingReaderTest.java From olat with Apache License 2.0 | 6 votes |
@Test public void read_twoStudentsList() throws UnexpectedInputException, ParseException, NonTransientResourceException, Exception { List<Student> twoStudentsList = new ArrayList<Student>(); Student studentMock1 = mock(Student.class); Student studentMock2 = mock(Student.class); twoStudentsList.add(studentMock1); twoStudentsList.add(studentMock2); when(daoManagerMock.getAllStudents()).thenReturn(twoStudentsList); studentMappingReaderTestObject.init(); // The first read delivers the first student assertNotNull(studentMappingReaderTestObject.read()); // The second read delivers the second student assertNotNull(studentMappingReaderTestObject.read()); // The third read delivers null assertNull(studentMappingReaderTestObject.read()); }
Example #4
Source File: MetricsTestItemReader.java From spring-boot-starter-batch-web with Apache License 2.0 | 6 votes |
@Override public Item read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException { if (readerTransactional) { businessMetrics.increment(MetricNames.READ_COUNT.getName()); businessMetrics.submit(MetricNames.READ_GAUGE.getName(), 5); } else { businessMetrics.incrementNonTransactional(MetricNames.READ_COUNT.getName()); businessMetrics.submitNonTransactional(MetricNames.READ_GAUGE.getName(), 5); } Item item = delegate.read(); if (item != null && item.getActions().contains(Action.FAIL_ON_READ)) { throw new MetricsTestException(Action.FAIL_ON_READ); } LOGGER.debug("Read item: {}", item); return item; }
Example #5
Source File: SkipItemReader.java From spring-cloud-task with Apache License 2.0 | 5 votes |
@Override public Object read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException { String result = "1"; if (this.failCount < 2) { this.failCount++; throw new IllegalStateException("Reader FOOBAR"); } if (this.finished) { result = null; } this.finished = true; return result; }
Example #6
Source File: SynchronizationReader.java From olat with Apache License 2.0 | 5 votes |
/** * Reads a {@link CampusCourseImportTo} via the {@link DaoManager} with the given course id from the list of the sapCoursesIds. <br> * It returns null at the end of the list of the sapCoursesIds */ public CampusCourseImportTO read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException { if (ListUtil.isNotBlank(sapCoursesIds)) { return daoManager.getSapCampusCourse(sapCoursesIds.remove(0)); } return null; }
Example #7
Source File: SynchronizationReaderTest.java From olat with Apache License 2.0 | 4 votes |
@Test public void read_nullCoursesList() throws UnexpectedInputException, ParseException, NonTransientResourceException, Exception { when(daoManagerMock.getAllCreatedSapCources()).thenReturn(null); synchronizationReaderTestObject.init(); assertNull(synchronizationReaderTestObject.read()); }
Example #8
Source File: SynchronizationReaderTest.java From olat with Apache License 2.0 | 4 votes |
@Test public void read_emptyCoursesList() throws UnexpectedInputException, ParseException, NonTransientResourceException, Exception { when(daoManagerMock.getAllCreatedSapCources()).thenReturn(Collections.emptyList()); synchronizationReaderTestObject.init(); assertNull(synchronizationReaderTestObject.read()); }
Example #9
Source File: StudentMappingReaderTest.java From olat with Apache License 2.0 | 4 votes |
@Test public void read_nullStudentsList() throws UnexpectedInputException, ParseException, NonTransientResourceException, Exception { when(daoManagerMock.getAllStudents()).thenReturn(null); studentMappingReaderTestObject.init(); assertNull(studentMappingReaderTestObject.read()); }
Example #10
Source File: StudentMappingReaderTest.java From olat with Apache License 2.0 | 4 votes |
@Test public void read_emptyStudentsList() throws UnexpectedInputException, ParseException, NonTransientResourceException, Exception { when(daoManagerMock.getAllStudents()).thenReturn(Collections.emptyList()); studentMappingReaderTestObject.init(); assertNull(studentMappingReaderTestObject.read()); }
Example #11
Source File: LecturerMappingReaderTest.java From olat with Apache License 2.0 | 4 votes |
@Test public void read_nullLecturersList() throws UnexpectedInputException, ParseException, NonTransientResourceException, Exception { when(daoManagerMock.getAllLecturers()).thenReturn(null); lecturerMappingReaderTestObject.init(); assertNull(lecturerMappingReaderTestObject.read()); }
Example #12
Source File: LecturerMappingReaderTest.java From olat with Apache License 2.0 | 4 votes |
@Test public void read_emptyLecturersList() throws UnexpectedInputException, ParseException, NonTransientResourceException, Exception { when(daoManagerMock.getAllLecturers()).thenReturn(Collections.emptyList()); lecturerMappingReaderTestObject.init(); assertNull(lecturerMappingReaderTestObject.read()); }
Example #13
Source File: AgentCountReader.java From pinpoint with Apache License 2.0 | 4 votes |
@Override public ApplicationAgentsList read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException { return queue.poll(); }