List of usage examples for java.lang Iterable iterator
Iterator<T> iterator();
From source file:com.xy.inc.repository.POIRepositoryIT.java
/** * Test of findAll method, of class POIService. *//*from w w w .j a v a 2 s .c o m*/ @Test public void testFindAll() { System.out.println("findAll"); Iterable result = instance.findAll(); assertTrue(result.iterator().hasNext()); }
From source file:com.xeiam.datasets.hjabirdsong.bootstrap.RawData2DBTenFold.java
private void go(String dataFile) throws IOException { List<String> lines = FileUtils.readLines(new File(dataFile), "UTF-8"); for (String line : lines) { System.out.println(line); Iterable<String> splitLine = Splitter.on(",").split(line); Iterator<String> itr = splitLine.iterator(); String bagid = itr.next(); String fold = itr.next(); try {// ww w. j a va 2 s. c o m TenFold tenFold = new TenFold(); tenFold.setBagid(Integer.parseInt(bagid)); tenFold.setFold(Integer.parseInt(fold)); TenFoldDAO.insert(tenFold); System.out.println(tenFold.toString()); idx++; } catch (Exception e) { // e.printStackTrace(); // eat it. skip first line in file. } } System.out.println("Number parsed: " + idx); }
From source file:org.openbaton.vnfm.repositories.ApplicationRepositoryImpl.java
@Override public void deleteAppsByVnfrId(String vnfrId) throws NotFoundException { Iterable<Application> entities = findAppByVnfrId(vnfrId); if (!entities.iterator().hasNext()) { throw new NotFoundException("Not Found any Applications running on VNFR with id: " + vnfrId); } else {//from w w w . j a v a2 s .c om applicationRepository.delete(entities); } }
From source file:org.openbaton.vnfm.repositories.MediaServerRepositoryImpl.java
@Override public void deleteByVnfrId(String vnfrId) throws NotFoundException { Iterable<MediaServer> entities = findAllByVnrfId(vnfrId); if (!entities.iterator().hasNext()) { throw new NotFoundException( "Not found any MediaServer for VNFR with id: " + vnfrId + "managed by this VNFM"); } else {/*from w ww.j ava2 s .c o m*/ mediaServerRepository.delete(entities); } }
From source file:com.groupdocs.comparison.config.Config.java
public String getStoragePath() { Iterable<Map.Entry<String, String>> elem = assets.getOverrides(); String path = elem.iterator().next().getValue(); if (!path.endsWith("/") && !path.endsWith("\\")) { path += "\\"; }//w ww . j a va2 s. co m return path; }
From source file:com.marvelution.jira.plugins.hudson.streams.HudsonStreamsCommentHandler.java
/** * {@inheritDoc}/*from www . j a v a2 s . co m*/ */ @Override public Either<PostReplyError, URI> postReply(Iterable<String> itemPath, String comment) { logger.debug("Accessing postReply for " + StringUtils.join(itemPath.iterator(), ", ")); return null; }
From source file:com.bxtel.security5.auth.impl.SecurityMetadataSourceImpl.java
@Override public void afterPropertiesSet() throws Exception { Iterable<SecurityData> i = dao.findAll(); if (!i.iterator().hasNext()) { SecurityData sd = new SecurityData(); sd.setPath("/sms/**"); sd.setRolelist("USER,ADMIN"); dao.save(sd);//from w ww . j ava 2 s .c o m } buildRequestMap(); }
From source file:net.tirasa.jpasqlazure.BasicCRUDTest.java
@Test public void run() throws UnsupportedEncodingException { Person user = new Person(); user.setUsername("Bob"); user.setPassword("password"); user.setGender(Gender.M);//from w ww . ja v a2 s . c o m user.setPicture("picture".getBytes()); user.setInfo("some info"); user = repository.save(user); assertNotNull(user); assertEquals("picture", new String(user.getPicture(), "UTF-8")); user = repository.findOne(user.getId()); assertNotNull(user); user.setInfo("other info"); user = repository.save(user); assertNotNull(user); assertEquals("other info", user.getInfo()); Iterable<Person> iter = repository.findAll(); assertTrue(iter.iterator().hasNext()); for (Person person : iter) { assertNotNull(person); } repository.delete(user); Person found = repository.findOne(user.getId()); assertNull(found); }
From source file:de.msg.repository.RouteRepositoryTest.java
@Test public void findAll() throws Exception { Iterable<Route> actual = repository.findAll(); int size = 0; for (Iterator<Route> iterator = actual.iterator(); iterator.hasNext(); ++size, iterator.next()) ;/*w w w .ja v a 2 s. c o m*/ Assert.assertNotNull(actual.iterator().hasNext()); Assert.assertEquals(2, size); }
From source file:org.openbaton.vnfm.core.VirtualNetworkFunctionRecordManagement.java
public Set<ManagedVNFR> query(String vnfrId) throws NotFoundException { Iterable<ManagedVNFR> managedVNFRsIterbale = managedVNFRRepository.findByVnfrId(vnfrId); if (!managedVNFRsIterbale.iterator().hasNext()) { throw new NotFoundException("Not found any VNFR with id: " + vnfrId + " managed by this VNFM"); }// ww w . jav a2s.c o m return fromIterbaleToSet(managedVNFRsIterbale); }