org.springframework.test.annotation.Rollback Java Examples
The following examples show how to use
org.springframework.test.annotation.Rollback.
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: DispatcherDaoTests.java From OpenCue with Apache License 2.0 | 6 votes |
@Test @Transactional @Rollback(true) public void testFindNextDispatchFrameByHost() { DispatchHost host = getHost(); JobDetail job = getJob1(); for (LayerDetail layer: layerDao.getLayerDetails(job)) { assertTrue(layer.tags.contains("general")); } assertTrue(jdbcTemplate.queryForObject( "SELECT str_tags FROM host WHERE pk_host=?",String.class, host.id).contains("general")); DispatchFrame frame = dispatcherDao.findNextDispatchFrame(job, host); assertNotNull(frame); assertEquals(frame.name, "0001-pass_1"); }
Example #2
Source File: CommentDaoTests.java From OpenCue with Apache License 2.0 | 6 votes |
@Test @Transactional @Rollback(true) public void testGetComment() { JobDetail job = jobManager.findJobDetail("pipe-dev.cue-testuser_shell_v1"); CommentDetail d = new CommentDetail(); d.message = "a message"; d.subject = "a subject"; d.user = "user"; commentDao.insertComment(job, d); CommentDetail nd = commentDao.getCommentDetail(d.getId()); assertEquals(d.message,nd.message); assertEquals(d.subject,nd.subject); assertEquals(d.user,nd.user); }
Example #3
Source File: FrameDaoTests.java From OpenCue with Apache License 2.0 | 6 votes |
@Test @Transactional @Rollback(true) public void testGetDispatchFrame() { DispatchHost host = createHost(); JobDetail job = launchJob(); FrameDetail frame = frameDao.findFrameDetail(job, "0001-pass_1"); VirtualProc proc = new VirtualProc(); proc.allocationId = host.allocationId; proc.coresReserved = 100; proc.hostId = host.id; proc.hostName = host.name; proc.jobId = job.id; proc.frameId = frame.id; proc.layerId = frame.layerId; proc.showId = frame.showId; procDao.insertVirtualProc(proc); procDao.verifyRunningProc(proc.getId(), frame.getId()); DispatchFrame dframe = frameDao.getDispatchFrame(frame.id); assertEquals(dframe.id, frame.id); }
Example #4
Source File: JpaWidgetRepositoryTest.java From attic-rave with Apache License 2.0 | 6 votes |
@Test @Transactional(readOnly = false) @Rollback public void saveWidgetWithLongDescription() { final String url = "http://example.com/doesnotexistyet"; final String longDescription = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc dictum sodales erat consequat pulvinar. Pellentesque ut massa mi, sit amet imperdiet diam. Morbi nec magna quis nisi bibendum dignissim. Fusce et rhoncus turpis. Integer mollis magna sit amet nulla convallis placerat dignissim lorem blandit. Nulla magna justo, cursus ac semper sed, pulvinar in turpis. Donec ultricies nibh sed nulla congue ullamcorper. Fusce commodo ultrices nunc, interdum lacinia elit faucibus at. Fusce laoreet ultricies volutpat. "; Widget doesnotexist = repository.getByUrl(url); assertNull(doesnotexist); Widget widget = new JpaWidget(); widget.setTitle("Widget with long description"); widget.setUrl(url); widget.setDescription(longDescription); widget = repository.save(widget); assertNotNull(widget.getId()); assertEquals(longDescription, widget.getDescription()); }
Example #5
Source File: GroupDaoTests.java From OpenCue with Apache License 2.0 | 6 votes |
@Test @Transactional @Rollback(true) public void testUpdateMaxCores() { GroupDetail group = createGroup(); assertEquals(Integer.valueOf(-1), jdbcTemplate.queryForObject( "SELECT int_max_cores FROM folder_resource WHERE pk_folder=?", Integer.class, group.getGroupId())); groupDao.updateMaxCores(group, 100); assertEquals(Integer.valueOf(100), jdbcTemplate.queryForObject( "SELECT int_max_cores FROM folder_resource WHERE pk_folder=?", Integer.class, group.getGroupId())); groupDao.updateMaxCores(group, -5); assertEquals(Integer.valueOf(-1), jdbcTemplate.queryForObject( "SELECT int_max_cores FROM folder_resource WHERE pk_folder=?", Integer.class, group.getGroupId())); }
Example #6
Source File: GroupDaoTests.java From OpenCue with Apache License 2.0 | 6 votes |
@Test @Transactional @Rollback(true) public void testUpdateGroupParent() { GroupDetail group = createGroup(); GroupDetail subgroup = createSubGroup(group); groupDao.updateGroupParent(subgroup, groupDao.getGroupDetail( groupDao.getRootGroupId(getShow()))); assertEquals(Integer.valueOf(1),jdbcTemplate.queryForObject( "SELECT int_level FROM folder_level WHERE pk_folder=?", Integer.class, subgroup.getId())); groupDao.updateGroupParent(subgroup, group); assertEquals(Integer.valueOf(2),jdbcTemplate.queryForObject( "SELECT int_level FROM folder_level WHERE pk_folder=?", Integer.class, subgroup.getId())); }
Example #7
Source File: TestDBHelperInterceptor.java From nimble-orm with GNU General Public License v2.0 | 6 votes |
@Test @Rollback(false) public void testCustomsUpdateDelete() { StudentDO studentDO = new StudentDO(); studentDO.setName("nick"); studentDO.setAge(29); dbHelper.insert(studentDO); dbHelper.updateCustom(studentDO, "age=age+1"); dbHelper.delete(StudentDO.class, "where 1=1"); studentDO = new StudentDO(); studentDO.setName("nick"); studentDO.setAge(29); dbHelper.insert(studentDO); dbHelper.updateAll(StudentDO.class, "age=age+1", "where 1=1"); }
Example #8
Source File: OwnerDaoTests.java From OpenCue with Apache License 2.0 | 6 votes |
@Test @Transactional @Rollback(true) public void testUpdateShow() { ShowInterface show = adminManager.findShowEntity("pipe"); OwnerEntity o = new OwnerEntity(); o.name = "spongebob"; ownerDao.insertOwner(o, show); ShowInterface newShow = adminManager.findShowEntity("edu"); ownerDao.updateShow(o, newShow); assertEquals(newShow.getShowId(), jdbcTemplate.queryForObject( "SELECT pk_show FROM owner WHERE pk_owner=?", String.class, o.id)); }
Example #9
Source File: DeedDaoTests.java From OpenCue with Apache License 2.0 | 6 votes |
@Test @Transactional @Rollback(true) public void testInsertDeed() { DispatchHost host = createHost(); ShowInterface s = adminManager.findShowEntity("pipe"); OwnerEntity o = ownerManager.createOwner("squarepants", s); DeedEntity d = deedDao.insertDeed(o, host); assertEquals(Integer.valueOf(1), jdbcTemplate.queryForObject( "SELECT COUNT(1) FROM deed WHERE pk_deed=?", Integer.class, d.getId())); assertEquals(host.getName(), d.host); }
Example #10
Source File: LayerDaoTests.java From OpenCue with Apache License 2.0 | 6 votes |
@Test @Transactional @Rollback(true) public void testGetLayerDetail() { LayerDetail layer = getLayer(); assertEquals(LAYER_NAME, layer.name); assertEquals(layer.chunkSize, 1); assertEquals(layer.dispatchOrder,2); assertNotNull(layer.id); assertNotNull(layer.jobId); assertEquals(layer.showId,ROOT_SHOW); LayerDetail l2 = layerDao.getLayerDetail(layer); LayerDetail l3 = layerDao.getLayerDetail(layer.id); assertEquals(l2, l3); }
Example #11
Source File: WhiteboardDaoTests.java From OpenCue with Apache License 2.0 | 6 votes |
@Test @Transactional @Rollback(true) public void testGetFramesByFrameSearch() { JobEntity job = launchJob(); FrameSearchInterface r = frameSearchFactory.create(job); FrameSearchCriteria criteria = r.getCriteria(); r.setCriteria(criteria.toBuilder() .setPage(1) .setLimit(5) .addLayers("pass_1") .build()); assertEquals(5, whiteboardDao.getFrames(r).getFramesCount()); for (Frame f: whiteboardDao.getFrames(r).getFramesList()) { assertEquals(f.getLayerName(), "pass_1"); } }
Example #12
Source File: PointDaoTests.java From OpenCue with Apache License 2.0 | 6 votes |
@Test @Transactional @Rollback(true) public void insertDepartmentConfig() { ShowEntity show = new ShowEntity(); show.name = "testtest"; adminManager.createShow(show); DepartmentInterface dept = departmentDao.findDepartment("Lighting"); PointInterface d = pointDao.insertPointConf(show, dept); assertEquals(show.id, jdbcTemplate.queryForObject( "SELECT pk_show FROM point WHERE pk_point=?", String.class, d.getPointId())); assertEquals(dept.getDepartmentId(), jdbcTemplate.queryForObject( "SELECT pk_dept FROM point WHERE pk_point=?", String.class, d.getPointId())); }
Example #13
Source File: DependDaoTests.java From OpenCue with Apache License 2.0 | 6 votes |
@Test @Transactional @Rollback(true) public void testGetWhatDependsOnLayer() { JobDetail job_a = getJobA(); JobDetail job_b = getJobB(); LayerInterface layer_a = layerDao.findLayer(job_a, "pass_1"); LayerInterface layer_b = layerDao.findLayer(job_b, "pass_1"); LayerOnLayer depend = new LayerOnLayer(layer_a, layer_b); dependDao.insertDepend(depend); assertEquals(1, dependDao.getWhatDependsOn(layer_b).size()); assertEquals(0, dependDao.getWhatDependsOn(layer_a).size()); }
Example #14
Source File: SubscriptionDaoTests.java From OpenCue with Apache License 2.0 | 6 votes |
@Test @Transactional @Rollback(true) public void testIsShowOverSize() { SubscriptionEntity sub = buildSubscription(getShow(), alloc); subscriptionDao.insertSubscription(sub); assertFalse(this.subscriptionDao.isShowOverSize(getShow(), alloc)); jdbcTemplate.update( "UPDATE subscription SET int_cores = ? WHERE pk_subscription = ?", 100, sub.getSubscriptionId()); assertFalse(subscriptionDao.isShowOverSize(getShow(), alloc)); jdbcTemplate.update( "UPDATE subscription SET int_cores = ? WHERE pk_subscription = ?", 101, sub.getSubscriptionId()); assertEquals(true, subscriptionDao.isShowOverSize(getShow(), alloc)); }
Example #15
Source File: TransactionalTestExecutionListener.java From java-technology-stack with MIT License | 6 votes |
/** * Determine whether or not to rollback transactions for the supplied * {@linkplain TestContext test context} by taking into consideration the * {@linkplain #isDefaultRollback(TestContext) default rollback} flag and a * possible method-level override via the {@link Rollback @Rollback} * annotation. * @param testContext the test context for which the rollback flag * should be retrieved * @return the <em>rollback</em> flag for the supplied test context * @throws Exception if an error occurs while determining the rollback flag */ protected final boolean isRollback(TestContext testContext) throws Exception { boolean rollback = isDefaultRollback(testContext); Rollback rollbackAnnotation = AnnotatedElementUtils.findMergedAnnotation(testContext.getTestMethod(), Rollback.class); if (rollbackAnnotation != null) { boolean rollbackOverride = rollbackAnnotation.value(); if (logger.isDebugEnabled()) { logger.debug(String.format( "Method-level @Rollback(%s) overrides default rollback [%s] for test context %s.", rollbackOverride, rollback, testContext)); } rollback = rollbackOverride; } else { if (logger.isDebugEnabled()) { logger.debug(String.format( "No method-level @Rollback override: using default rollback [%s] for test context %s.", rollback, testContext)); } } return rollback; }
Example #16
Source File: DependDaoTests.java From OpenCue with Apache License 2.0 | 6 votes |
@Test @Transactional @Rollback(true) public void testInsertFrameOnFrame() { JobDetail job_a = getJobA(); JobDetail job_b = getJobB(); FrameDetail frame_a = frameDao.findFrameDetail(job_a, "0001-pass_1"); FrameDetail frame_b = frameDao.findFrameDetail(job_b, "0001-pass_1"); FrameOnFrame depend = new FrameOnFrame(frame_a, frame_b); dependDao.insertDepend(depend); LightweightDependency lwd = dependDao.getDepend(depend.getId()); assertEquals(depend.getId(), lwd.getId()); assertEquals(DependType.FRAME_ON_FRAME, lwd.type); assertEquals(DependTarget.EXTERNAL, lwd.target); assertTrue(lwd.active); assertFalse(lwd.anyFrame); }
Example #17
Source File: DependDaoTests.java From OpenCue with Apache License 2.0 | 6 votes |
@Test @Transactional @Rollback(true) public void testInsertJobOnJob() { JobDetail job_a = getJobA(); JobDetail job_b = getJobB(); JobOnJob depend = new JobOnJob(job_a, job_b); dependDao.insertDepend(depend); LightweightDependency lwd = dependDao.getDepend(depend.getId()); assertEquals(depend.getId(), lwd.getId()); assertEquals(DependType.JOB_ON_JOB, lwd.type); assertEquals(DependTarget.EXTERNAL, lwd.target); assertTrue(lwd.active); assertFalse(lwd.anyFrame); }
Example #18
Source File: LayerDaoTests.java From OpenCue with Apache License 2.0 | 5 votes |
@Test @Transactional @Rollback(true) public void testFindPastNewVersionTimeStampMaxRSS() { getLayer(); jobDao.updateState(getJob(), JobState.FINISHED); assertEquals(JobState.FINISHED, getJob().state); JobDetail lastJob = null; lastJob = jobDao.findLastJob("pipe-dev.cue-testuser_shell_v2_2011_05_03_16_03"); long maxRss = layerDao.findPastMaxRSS(lastJob, "pass_1"); }
Example #19
Source File: WhiteboardDaoTests.java From OpenCue with Apache License 2.0 | 5 votes |
@Test @Transactional @Rollback(true) public void testGetMatcher() { FilterEntity f = createFilter(); MatcherEntity m = createMatcher(f); whiteboardDao.getMatcher(m); }
Example #20
Source File: LimitDaoTests.java From OpenCue with Apache License 2.0 | 5 votes |
@Test @Transactional @Rollback(true) public void testGetLimit() { String limitId = limitDao.createLimit(LIMIT_NAME, LIMIT_MAX_VALUE); LimitEntity limit = limitDao.getLimit(limitId); assertEquals(limit.name, LIMIT_NAME); assertEquals(limit.maxValue, LIMIT_MAX_VALUE); }
Example #21
Source File: TestDBHelper.java From nimble-orm with GNU General Public License v2.0 | 5 votes |
@Test @Rollback(false) public void testExcludeInheritedColumn() { StudentDO studentDO = CommonOps.insertOne(dbHelper); StudentCalVO db = dbHelper.getByKey(StudentCalVO.class, studentDO.getId()); Assert.assertTrue(db != null); Assert.assertTrue(db.getId() == null); Assert.assertTrue(db.getNameWithHi() != null && db.getNameWithHi().endsWith("hi")); }
Example #22
Source File: FrameDaoTests.java From OpenCue with Apache License 2.0 | 5 votes |
@Test @Transactional @Rollback(true) public void testFailUpdateFrameState() { JobDetail job = launchJob(); FrameInterface f = frameDao.findFrame(job, "0001-pass_1"); /** Change the version so the update fails **/ jdbcTemplate.update( "UPDATE frame SET int_version = int_version + 1 WHERE pk_frame=?", f.getFrameId()); assertEquals(false, frameDao.updateFrameState(f, FrameState.RUNNING)); }
Example #23
Source File: JobDaoTests.java From OpenCue with Apache License 2.0 | 5 votes |
@Test @Transactional @Rollback(true) public void testUpdateJobMaxRetries() { JobDetail job = insertJob(); jobDao.updateMaxFrameRetries(job,10); assertEquals(Integer.valueOf(10), jdbcTemplate.queryForObject( "SELECT int_max_retries FROM job WHERE pk_job=?", Integer.class, job.getJobId())); }
Example #24
Source File: BookingDaoTests.java From OpenCue with Apache License 2.0 | 5 votes |
@Test @Transactional @Rollback(true) public void updateMaxCores() { DispatchHost h = createHost(); JobDetail j = launchJob(); LocalHostAssignment lja = new LocalHostAssignment(); lja.setMaxCoreUnits(200); lja.setMaxMemory(CueUtil.GB4); lja.setThreads(2); lja.setMaxGpu(1); bookingDao.insertLocalHostAssignment(h, j, lja); assertTrue(bookingDao.updateMaxCores(lja, 100)); assertEquals(Integer.valueOf(100), jdbcTemplate.queryForObject( "SELECT int_cores_max FROM host_local WHERE pk_host=?", Integer.class, h.getHostId())); LocalHostAssignment lj2 = bookingDao.getLocalJobAssignment(lja.id); assertEquals(100, lj2.getIdleCoreUnits()); assertEquals(100, lj2.getMaxCoreUnits()); bookingDao.updateMaxCores(lja, 200); lj2 = bookingDao.getLocalJobAssignment(lja.id); assertEquals(200, lj2.getIdleCoreUnits()); assertEquals(200, lj2.getMaxCoreUnits()); }
Example #25
Source File: HealthCheckDaoTest.java From kardio with Apache License 2.0 | 5 votes |
@Test @Transactional @Rollback(true) public void testUpdateHealthCheck() { String envName = "updatehealthcheck"; HealthCheckVO hcv = daoService.getHealthCheck(envName); Environment env = daoService.createEnvironment(envName, 0); hcv.setEnvironmentId(TestDaoService.getLastCreatedEnvironmentID()); healthCheckDao.editHealthCheck(hcv); TestDaoService.healthCheckID++; }
Example #26
Source File: HealthCheckDaoTest.java From kardio with Apache License 2.0 | 5 votes |
@Test(expected = ValidationFailedException.class) @Transactional @Rollback(true) public void testUpdateHealthCheck_EnvIDZero() { HealthCheckVO hc = new HealthCheckVO(); hc.setEnvironmentId(0); healthCheckDao.editHealthCheck(hc); }
Example #27
Source File: AdminManagerTests.java From OpenCue with Apache License 2.0 | 5 votes |
@Test @Transactional @Rollback(true) public void findLimit() { String limitName = "testlimit"; adminManager.createLimit(limitName, 42); adminManager.findLimit(limitName); }
Example #28
Source File: JobManagerTests.java From OpenCue with Apache License 2.0 | 5 votes |
@Test @Transactional @Rollback(true) public void testShowAlias() { JobSpec spec = jobLauncher.parse(new File("src/test/resources/conf/jobspec/show_alias.xml")); jobLauncher.launch(spec); }
Example #29
Source File: HealthCheckDaoTest.java From kardio with Apache License 2.0 | 5 votes |
@Test @Transactional @Rollback(true) public void testDeleteHealthCheck() { String envName = "deletehealthcheck"; daoService.createHealthCheck(envName); healthCheckDao.deleteHealthCheck(TestDaoService.healthCheckID); }
Example #30
Source File: FrameSearchTests.java From OpenCue with Apache License 2.0 | 5 votes |
@Test @Transactional @Rollback public void testGetCriteria() { JobInterface job = jobDao.findJob("pipe-dev.cue-testuser_depend_test_a"); FrameSearchCriteria criteria = FrameSearchInterface.criteriaFactory(); FrameSearchInterface frameSearch = frameSearchFactory.create(job, criteria); assertEquals(criteria, frameSearch.getCriteria()); }