List of usage examples for org.springframework.util Assert notEmpty
@Deprecated public static void notEmpty(@Nullable Map<?, ?> map)
From source file:org.oncoblocks.centromere.core.test.DataImportTests.java
@Test public void geneInfoReaderTest() throws Exception { GeneInfoReader reader = new GeneInfoReader(); List<EntrezGene> genes = new ArrayList<>(); try {//w w w. j a va 2 s. c om reader.open(geneInfoPath); EntrezGene gene = reader.readRecord(); while (gene != null) { genes.add(gene); gene = reader.readRecord(); } } finally { reader.close(); } Assert.notEmpty(genes); Assert.isTrue(genes.size() == 5); Assert.isTrue(genes.get(4).getEntrezGeneId().equals(10L)); }
From source file:io.twipple.springframework.data.clusterpoint.core.support.LoadBalancingClusterpointConnectionFactory.java
/** * Construct this {@link ClusterpointConnectionFactory} with given configuration options. * * @param hosts the list of Clusterpoint database host names * @param storage the storage name to connect to * @param username the user name for authenticating with the storage * @param password the password for authenticating with the storage * @param account the cloud account Id * @param documentRootXpath the document root tag name * @param documentIdXpath the document id tag Xpath expression *///from ww w . ja va 2s .com public LoadBalancingClusterpointConnectionFactory(@NotNull List<String> hosts, @NotNull LoadBalancingStrategy loadBalancingStrategy, @NotNull String storage, @NotNull String username, @NotNull String password, @NotNull String account, @NotNull String documentRootXpath, @NotNull String documentIdXpath) { Assert.notEmpty(hosts); Assert.notNull(loadBalancingStrategy); Assert.notNull(storage); Assert.notNull(username); Assert.notNull(password); Assert.notNull(account); Assert.notNull(documentRootXpath); Assert.notNull(documentIdXpath); this.hosts = hosts; this.loadBalancingStrategy = loadBalancingStrategy; this.storage = storage; this.username = username; this.password = password; this.account = account; this.documentRootXpath = documentRootXpath; this.documentIdXpath = documentIdXpath; }
From source file:com.github.lynxdb.server.core.Aggregator.java
protected TimeSerie doInterpolate(List<TimeSerie> _series, Reducer _reducer) { Assert.notEmpty(_series); List<SuperIterator> sil = new ArrayList<>(); _series.forEach((TimeSerie t) -> { if (t.hasNext()) { SuperIterator<Entry> si = new SuperIterator<>(t); si.next();//from ww w.j a v a 2 s.co m sil.add(si); } }); Map<String, String> tags = new HashMap<>(); tags.putAll(_series.get(0).getTags()); _series.forEach((TimeSerie t) -> { Iterator<Map.Entry<String, String>> i = tags.entrySet().iterator(); while (i.hasNext()) { Map.Entry<String, String> e = i.next(); if (!t.getTags().containsKey(e.getKey()) || !t.getTags().get(e.getKey()).equals(e.getValue())) { i.remove(); } } }); return new TimeSerie(_series.get(0).getName(), tags, new ChainableIterator<Entry>() { @Override public boolean hasNext() { return sil.stream().anyMatch((SuperIterator t) -> t.hasNext() || t.getCurrent() != null); } @Override public Entry next() { _reducer.reset(); Iterator<SuperIterator> rr = sil.iterator(); while (rr.hasNext()) { if (rr.next().getCurrent() == null) { rr.remove(); } } int max = Integer.MIN_VALUE; for (SuperIterator<Entry> r : sil) { max = Integer.max(max, r.getCurrent().getTime()); } for (SuperIterator<Entry> r : sil) { if (r.getCurrent().getTime() == max) { _reducer.update(r.getCurrent()); r.next(); } else if (r.getPrevious() != null) { _reducer.update(new Entry(max, interpolate(r.getCurrent(), r.getPrevious(), max))); } } return new Entry(max, _reducer.result()); } }); }
From source file:org.appverse.web.framework.backend.persistence.services.integration.impl.test.UserRepositoryImplTest.java
@Override @Test//w ww .ja va 2 s.c om public void deleteAll() throws Exception { retrieveAll(); List<UserDTO> list = userRepository.retrieveList(); Assert.notEmpty(list); userRepository.deleteAll(); list = userRepository.retrieveList(); Assert.isTrue(list.isEmpty()); }
From source file:org.esco.portlet.flashinfo.FlashInfoDaoTest.java
@Test public void testGson() throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(resource.getInputStream())); StringBuilder stringBuilder = new StringBuilder(); String line;// www . j a v a 2 s . co m while ((line = br.readLine()) != null) { stringBuilder.append(line).append('\n'); } br.close(); List<FlashInfo> fil = flashInfoResourceGson.retrieveInfos(stringBuilder.toString()); //flashInfoResourceGson.retrieveInfos("https://test-lycee.reciaent.fr/static/mockGuestService"); Assert.notNull(fil); Assert.notEmpty(fil); Assert.isTrue(fil.size() == 4); }
From source file:org.oncoblocks.centromere.jpa.test.JpaRepositoryTests.java
@Test public void findAllTest() { List<EntrezGene> genes = (List<EntrezGene>) geneRepository.findAll(); Assert.notNull(genes);/* w w w . j a v a 2 s. co m*/ Assert.notEmpty(genes); Assert.isTrue(genes.size() == 5); EntrezGene gene = genes.get(0); Assert.notNull(gene); Assert.isTrue(gene.getEntrezGeneId().equals(1L)); Assert.isTrue("GeneA".equals(gene.getPrimaryGeneSymbol())); Assert.notNull(gene.getAliases()); Assert.notEmpty(gene.getAliases()); Assert.isTrue(gene.getAliases().size() == 1); System.out.println(gene.toString()); }
From source file:com.google.code.guice.repository.SimpleBatchStoreJpaRepository.java
@Override public void saveInBatch(Iterable<T> entities) { Collection<T> list = Lists.newArrayList(entities); Assert.notEmpty(list); Iterable<T> saved = save(list); flush();//from ww w .j av a2 s .c o m for (T t : saved) { entityManager.detach(t); } }
From source file:org.oncoblocks.centromere.mongodb.test.MongoImportTests.java
@Test public void repositoryWriterTest() throws Exception { repository.deleteAll();/*from w w w. ja va 2 s .co m*/ RepositoryRecordWriter<EntrezGene> writer = new RepositoryRecordWriter<>(repository); for (EntrezGene gene : genes) { writer.writeRecord(gene); } List<EntrezGene> geneList = repository.findAll(); Assert.notNull(geneList); Assert.notEmpty(geneList); Assert.isTrue(geneList.size() == 5); }
From source file:org.oncoblocks.centromere.sql.test.SqlBuilderTests.java
@Test public void simpleOrQueryTest() { SqlBuilder sqlBuilder = new SqlBuilder(tableDescription); sqlBuilder.where(or(equal("name", "Joe"), equal("species", "human"))); String sql = sqlBuilder.toSql(); System.out.println(sql);//www. jav a 2 s . c om Assert.notNull(sql); List<Object> values = sqlBuilder.getQueryParameterValues(); Assert.notNull(values); Assert.notEmpty(values); Assert.isTrue(values.size() == 2); String name = (String) values.get(0); Assert.isTrue("Joe".equals(name)); }
From source file:org.agatom.springatom.data.oid.impl.SOidServiceImpl.java
@PostConstruct @SuppressWarnings("ConstantConditions") private void readOidCreators() { Assert.notEmpty(oidCreators); final Map<OidCreatorKey, SOidCreator<?>> localMap = Maps .newHashMapWithExpectedSize(this.oidCreators.size()); for (final SOidCreator<?> oidCreator : oidCreators) { final Class<?> supportedType = resolveTypeArgument(oidCreator.getClass(), SOidCreator.class); final String prefix = findAnnotation(oidCreator.getClass(), OidProvider.class).prefix(); localMap.put(new OidCreatorKey().setPrefix(prefix).setSupportedClass(supportedType), oidCreator); }//from ww w.j a v a 2s .co m this.oidCreatorsMap = Collections.unmodifiableMap(localMap); }