List of usage examples for org.springframework.util Assert isTrue
public static void isTrue(boolean expression, Supplier<String> messageSupplier)
From source file:de.extra.client.core.builder.impl.ExtraRequestBuilder.java
@Override public RequestTransport buildExtraRequestMessage(final IInputDataContainer senderData, final IExtraProfileConfiguration config) { Assert.notNull(senderData, "SenderData is null"); Assert.notNull(config, "ConfigFileBean is null"); final String rootElementName = config.getRootElement(); Assert.isTrue(requestTransportBuilder.getXmlType().equals(rootElementName), "Unexpected RootElement " + rootElementName + "expected: " + requestTransportBuilder.getXmlType()); final RequestTransport rootXmlFragment = requestTransportBuilder.buildRequestTransport(config); buildXmlMessage(rootXmlFragment, rootElementName, config, senderData); return rootXmlFragment; }
From source file:io.kahu.hawaii.runtime.RuntimeFeaturesHolder.java
@SuppressWarnings("unchecked") private void process(Map<String, Object> source, String key, Map<String, RuntimeFeature> result) { for (Map.Entry<String, Object> entry : source.entrySet()) { String newKey = key == null ? entry.getKey() : key + '.' + entry.getKey(); if (entry.getValue() instanceof Map) { process((Map) entry.getValue(), newKey, result); } else if (entry.getValue() instanceof RuntimeFeature) { String storedKey = ((RuntimeFeature) entry.getValue()).getName(); Assert.isTrue(newKey.equals(storedKey), "Resolved and stored key are different! '" + newKey + "' != '" + storedKey + "'"); result.put(newKey, (RuntimeFeature) entry.getValue()); } else {//from w w w . ja v a 2 s . c o m throw new IllegalArgumentException("Unsupported class: " + entry.getValue().getClass().getName()); } } }
From source file:com.athena.dolly.web.aws.s3.S3Controller.java
/** * <pre>//from w w w. ja v a 2s .c o m * List objects specified bucket * </pre> * @param jsonRes * @param bucketName * @return * @throws Exception */ @RequestMapping("/list") public @ResponseBody GridJsonResponse list(GridJsonResponse jsonRes, @RequestParam String bucketName, String key) throws Exception { Assert.isTrue(!StringUtils.isEmpty(bucketName), "bucketName must not be null."); logger.debug("Bucket Name: " + bucketName + ", key: " + key); List<S3Dto> list = s3Service.listBucket(bucketName, key); jsonRes.setTotal(list.size()); jsonRes.setList(list); return jsonRes; }
From source file:sample.GemFireCacheServerReadyBeanPostProcessor.java
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { if (bean instanceof PoolFactoryBean || bean instanceof Pool) { String host = getServerHost(DEFAULT_SERVER_HOST); Assert.isTrue(waitForCacheServerToStart(host, this.port), String.format("GemFire Server failed to start [host: '%1$s', port: %2$d]%n", host, this.port)); }/* w w w . ja v a 2s .c o m*/ return bean; }
From source file:com.crossover.trial.weather.domain.DataPoint.java
Measurement createMeasurement(Airport airport) { Assert.isTrue(airport != null, "airport is required"); if (type.isInsideRange(mean)) return new Measurement(airport, this); return null;// w ww . j av a 2 s . c o m }
From source file:de.extra.client.plugins.responseprocessplugin.filesystem.ExtraMessageReturnDataExtractor.java
/** * Liefert ReportDaten. Vorraussetzung ist gibt genau ein FlagType in dem * FlagList/*from w w w . j a v a 2 s . co m*/ * * Eine Default Implementirung fr die vorab Version * * @param report * @return */ public SingleReportData extractReportData(final ReportType report) { Assert.notNull(report, "Report in der Acknowledge ist leer"); final List<FlagType> flagList = report.getFlag(); Assert.notNull(flagList, "Report Flag ist null"); Assert.isTrue(flagList.size() == 1, "FlagType is empty or has "); final FlagType flagType = flagList.get(0); Assert.notNull(flagType, "FlagType ist null"); final FlagCodeType flagCodeType = flagType.getCode(); Assert.notNull(flagCodeType, "FlagCode ist null"); final String returnCode = flagCodeType.getValue(); final TextType text = flagType.getText(); String returnText = null; if (text != null) { returnText = text.getValue(); } return new SingleReportData(returnText, returnCode); }
From source file:com.stehno.sjdbcx.RepositoryFactory.java
@Override public void afterPropertiesSet() throws Exception { Assert.notNull(objectType, MISSING_TYPE_MSG); Assert.isTrue(objectType.isAnnotationPresent(JdbcRepository.class), String.format(MISSING_ANNOTATION_MSG, objectType)); Assert.isTrue(objectType.isInterface() || Modifier.isAbstract(objectType.getModifiers()), INVALID_CLASS_MSG);//from w ww . j ava2 s . c om if (implementationProviderClass == null) { implementationProviderClass = ReflectionImplementationProvider.class; } super.afterPropertiesSet(); }
From source file:org.apache.cxf.fediz.service.idp.service.jpa.ApplicationDAOJPATest.java
@Test public void testReadExistingApplicationEmbeddedAll() { Application application = applicationDAO.getApplication("urn:org:apache:cxf:fediz:fedizhelloworld", Arrays.asList("all")); Assert.isTrue(application.getLifeTime() == 3600, "LifeTime doesn't match"); Assert.isTrue("http://docs.oasis-open.org/wsfed/federation/200706".equals(application.getProtocol()), "Protocol doesn't match"); Assert.isTrue("urn:org:apache:cxf:fediz:fedizhelloworld".equals(application.getRealm()), "Realm doesn't match"); Assert.isTrue("ApplicationServiceType".equals(application.getRole()), "Role doesn't match"); Assert.isTrue("Web Application to illustrate WS-Federation".equals(application.getServiceDescription()), "ServiceDescription doesn't match"); Assert.isTrue("Fedizhelloworld".equals(application.getServiceDisplayName()), "ServiceDisplayName doesn't match"); Assert.isTrue("http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0" .equals(application.getTokenType()), "TokenType doesn't match"); Assert.isTrue(4 == application.getRequestedClaims().size(), "Number of claims doesn't match [" + application.getRequestedClaims().size() + "]"); }
From source file:org.netxilia.spi.impl.storage.db.ddl.schema.DbColumn.java
/** Has no effect if column's type has fixed size. However, the value is recorded. */ public void setSize(Integer size) { Assert.isTrue((size == null) || (size.intValue() > 0), "Column size must be > 0"); this.size = size; }