List of usage examples for org.springframework.util Assert isTrue
@Deprecated public static void isTrue(boolean expression)
From source file:net.chrisrichardson.bankingExample.domain.jdbc.JdbcAccountDao.java
public void addAccount(Account account) { logger.debug("adding account"); int count = jdbcTemplate.update( "INSERT INTO BANK_ACCOUNT(accountId, BALANCE, overdraftPolicy, dateOpened, requiredYearsOpen, limit) values(?, ?, ?, ?, ?, ?)", new Object[] { account.getAccountId(), account.getBalance(), account.getOverdraftPolicy(), new Timestamp(account.getDateOpened().getTime()), account.getRequiredYearsOpen(), account.getLimit() }, new int[] { Types.VARCHAR, Types.DOUBLE, Types.INTEGER, Types.TIMESTAMP, Types.DOUBLE, Types.DOUBLE }); Assert.isTrue(count == 1); }
From source file:org.oncoblocks.centromere.sql.test.GenericJdbcRepositoryTests.java
@Test public void findOneTest() { Subject subject = subjectRepository.findOne(1L); Assert.notNull(subject);/*from ww w .ja v a 2s.c om*/ Assert.isTrue(subject.getId().equals(1L)); Assert.isTrue(subject.getName().equals("PersonA")); }
From source file:it.inserpio.mapillary.gopro.importer.GoProTimeLapseShotsMapillaryImporter.java
/** * @param bikeMateProGPXFileName/* ww w . j a v a 2 s . c o m*/ * @param goProImagesDirectoryName * @throws ParseException * @throws IOException * @throws GPXParsingException * @throws XmlMappingException * @throws CoordinatesNotFoundException * @throws ImageReadException * @throws ImageWriteException */ public static void uploadToMapillary(String bikeMateProGPXFileName, String goProImagesDirectoryName) throws XmlMappingException, GPXParsingException, IOException, ParseException, ImageReadException, CoordinatesNotFoundException, ImageWriteException { // Get Date-Time Points from GPX file // ------------------------------------------------------------------------------------------ GPXParser gpxParser = new BikeMateProGPXParser(); List<GPXDateTimePoint> gpxDateTimePoints = gpxParser.parse(new File(bikeMateProGPXFileName)); File goProImagesDirectory = new File(goProImagesDirectoryName); Assert.isTrue(goProImagesDirectory.isDirectory()); File destinationDirectory = new File( goProImagesDirectory.getParent() + File.separator + "uploadable-images"); if (!destinationDirectory.exists()) { destinationDirectory.mkdir(); } File[] imageFiles = goProImagesDirectory.listFiles(); // It sets gps coordinates for every GoPro time-lapse shot and upload to Mapillary // ------------------------------------------------------------------------------------------ for (int imageIndex = 0; imageIndex < imageFiles.length; imageIndex++) { File imageFile = imageFiles[imageIndex]; System.out.println("Managing image " + imageFile); Coordinates coordinates = Image2GeoMatcher.findCoordinatesByImageOriginalDateTime(imageFile, gpxDateTimePoints, 0); File modifiedImageFile = new File(destinationDirectory, imageFile.getName()); EXIFPropertyWriter.setExifGPSTag(imageFile, modifiedImageFile, coordinates); UploadToMapillary.upload(modifiedImageFile, "", "", ""); // TODO upload not yet implemented } }
From source file:com.pw.ism.heartbeat.InMemoryHeartbeatRepositoryTest.java
@Test public void shouldRemoveHeartbeats() { Heartbeat hb1 = new Heartbeat(); hb1.setCustomer("TEST1"); hb1.setNetwork("NETWORK1"); repo.addHeartbeat(hb1, Instant.now().minusSeconds(5)); List<Heartbeat> list = repo.getExpiredHeartbeats(3); Assert.isTrue(list.contains(hb1)); Heartbeat hb2 = new Heartbeat(); hb2.setCustomer("TEST1"); hb2.setNetwork("NETWORK1"); Assert.isTrue(hb1.equals(hb2));/*from w w w .ja v a 2 s .c om*/ repo.removeHeartbeat(hb2); list = repo.getExpiredHeartbeats(3); //Assert.isTrue(list.contains(hb1)); Assert.isTrue(list.isEmpty()); }
From source file:org.oncoblocks.centromere.web.test.security.TokenTests.java
@Test public void validateToken() { String token = tokenOperations.createToken(user); Assert.isTrue(tokenOperations.validateToken(token, user)); token = "user:345983520:tnu49ng4ug4tgbu4gug4u"; Assert.isTrue(!tokenOperations.validateToken(token, user)); }
From source file:org.geowebcache.diskquota.storage.TilePageCalculator.java
public int[] pageIndexForTile(final TileSet tileSet, final long[] tileIndex, int[] pageIndexTarget) { Assert.notNull(tileSet);/*from w w w. j a v a2 s . c om*/ Assert.notNull(tileIndex); Assert.isTrue(pageIndexTarget != null && pageIndexTarget.length > 2); PagePyramid pagePyramid = getPagePyramid(tileSet); pagePyramid.pageIndexForTile(tileIndex[0], tileIndex[1], (int) tileIndex[2], pageIndexTarget); return pageIndexTarget; }
From source file:org.spring.beans.factory.config.BeanDependencyOrderVerificationBeanPostProcessor.java
@Override public Object postProcessBeforeInitialization(final Object bean, final String beanName) throws BeansException { if (bean instanceof TestBean) { System.out.printf("Post Processing Bean with Name (%1$s)%n", beanName); Assert.isTrue(beanNameOrderList.get(index.getAndIncrement()).equals(beanName)); }/*w ww . j ava 2s . c o m*/ return bean; }
From source file:org.opencredo.twitter.si.FilterTwitterStreamInboundChannelAdapter.java
private void initialize(String screenName, String password, String[] followIds, String[] trackKeywords, int numberOfHistoricStatusesToLoad) throws TwitterException { Assert.notNull(followIds);/*from w w w . j ava2 s . c o m*/ Assert.isTrue(followIds.length > 0); setTwitterStreamConfiguration(new FilterTwitterStreamConfiguration( new TwitterCredentials(screenName, password), followIds, null, 0)); }
From source file:org.esco.portlet.flashinfo.FlashInfoServiceTest.java
@Test public void test1() throws Exception { MockRenderRequest request = new MockRenderRequest(); request.setServerName("edu.internal.fr"); request.setServerPort(8443);//from w w w . j av a 2 s .c om request.setContextPath("/portal"); request.setScheme("http"); request.addParameter("param1", "value"); MockPortletPreferences prefs = new MockPortletPreferences(); prefs.setValue(FlashInfoServiceImpl.getPrefFlashUrl(), "/test/{ESCOUAICourant}"); request.setPreferences(prefs); List<FlashInfo> fil = flashInfoService.retrieveFlashInfos(request); Assert.notNull(fil); Assert.notEmpty(fil); Assert.isTrue(fil.size() == 5); //Assert.assertEquals(url,"http://edu.internal.fr:8443/portal/test/" + MockUserResourceImpl.getESCOUAICourant().get(0)); }
From source file:com.alibaba.otter.node.etl.common.db.dialect.mysql.MysqlDialect.java
private void initShardColumns() { this.shardColumns = OtterMigrateMap.makeSoftValueComputingMap(new Function<List<String>, String>() { public String apply(List<String> names) { Assert.isTrue(names.size() == 2); try { String result = DdlUtils.getShardKeyByDRDS(jdbcTemplate, names.get(0), names.get(0), names.get(1));//from w w w . j a v a 2 s .c om if (StringUtils.isEmpty(result)) { return ""; } else { return result; } } catch (Exception e) { throw new NestableRuntimeException( "find table [" + names.get(0) + "." + names.get(1) + "] error", e); } } }); }