@Test public void testYampFileWithPersistence() throws Exception { String conveyor_db_path = "c9"; String blog_db_path = "parts.blog"; File f = new File(conveyor_db_path); try { FileUtils.deleteDirectory(f); System.out.println("Directory c9 has been deleted!"); } catch (IOException e) { System.err.println("Problem occurs when deleting the directory : " + conveyor_db_path); e.printStackTrace(); } f = new File(blog_db_path); try { f.delete(); System.out.println("Directory backup has been deleted!"); } catch (Exception e) { System.err.println("Problem occurs when deleting the directory : " + blog_db_path); e.printStackTrace(); } ConveyorConfiguration.build("CLASSPATH:test9.yml"); Conveyor<Integer, NameLabel, String> c = Conveyor.byName("c9-1"); assertNotNull(c); assertTrue(c.isRunning()); CompletableFuture<Boolean> lastPart = null; for(int i = 0; i < 100; i++) { c.part().id(i).label(NameLabel.FIRST).value("FIRST_"+i).place(); lastPart = c.part().id(i).label(NameLabel.LAST).value("LAST_"+i).place(); } assertTrue(lastPart.get()); Thread.sleep(1000); File dir = new File("./"); AtomicInteger found = new AtomicInteger(0); Arrays.stream(dir.listFiles()) .map(file->file.getName()) .filter(name->(name.endsWith(".blog")||name.endsWith(".blog.zip"))) .forEach( file->{ System.out.println("Found "+file); found.incrementAndGet(); } ); assertEquals(2, found.get()); }
public static void build(String conf, String... moreConf) throws Exception { Objects.requireNonNull(conf, "At least one configuration file must be provided"); processConfFile(conf); if (moreConf != null) { for (String file : moreConf) { processConfFile(file); } } Conveyor<String, String, Conveyor> buildingConveyor = getBuildingConveyor(); Map<String,String> env = System.getenv(); env.forEach((key,value)->{ processPair(buildingConveyor, key, value); }); Properties p = System.getProperties(); p.forEach((key,value)->{ processPair(buildingConveyor, ""+key, ""+value); }); buildingConveyor.part().foreach().label("complete_configuration").value(true).place(); buildingConveyor.completeAndStop().get(); Conveyor.unRegister(buildingConveyor.getName()); }
ConveyorConfiguration { public static void build(String conf, String... moreConf) throws Exception { Objects.requireNonNull(conf, "At least one configuration file must be provided"); processConfFile(conf); if (moreConf != null) { for (String file : moreConf) { processConfFile(file); } } Conveyor<String, String, Conveyor> buildingConveyor = getBuildingConveyor(); Map<String,String> env = System.getenv(); env.forEach((key,value)->{ processPair(buildingConveyor, key, value); }); Properties p = System.getProperties(); p.forEach((key,value)->{ processPair(buildingConveyor, ""+key, ""+value); }); buildingConveyor.part().foreach().label("complete_configuration").value(true).place(); buildingConveyor.completeAndStop().get(); Conveyor.unRegister(buildingConveyor.getName()); } }
ConveyorConfiguration { public static void build(String conf, String... moreConf) throws Exception { Objects.requireNonNull(conf, "At least one configuration file must be provided"); processConfFile(conf); if (moreConf != null) { for (String file : moreConf) { processConfFile(file); } } Conveyor<String, String, Conveyor> buildingConveyor = getBuildingConveyor(); Map<String,String> env = System.getenv(); env.forEach((key,value)->{ processPair(buildingConveyor, key, value); }); Properties p = System.getProperties(); p.forEach((key,value)->{ processPair(buildingConveyor, ""+key, ""+value); }); buildingConveyor.part().foreach().label("complete_configuration").value(true).place(); buildingConveyor.completeAndStop().get(); Conveyor.unRegister(buildingConveyor.getName()); } private  ConveyorConfiguration(); }
ConveyorConfiguration { public static void build(String conf, String... moreConf) throws Exception { Objects.requireNonNull(conf, "At least one configuration file must be provided"); processConfFile(conf); if (moreConf != null) { for (String file : moreConf) { processConfFile(file); } } Conveyor<String, String, Conveyor> buildingConveyor = getBuildingConveyor(); Map<String,String> env = System.getenv(); env.forEach((key,value)->{ processPair(buildingConveyor, key, value); }); Properties p = System.getProperties(); p.forEach((key,value)->{ processPair(buildingConveyor, ""+key, ""+value); }); buildingConveyor.part().foreach().label("complete_configuration").value(true).place(); buildingConveyor.completeAndStop().get(); Conveyor.unRegister(buildingConveyor.getName()); } private  ConveyorConfiguration(); static void build(String conf, String... moreConf); @Override String toString(); }
ConveyorConfiguration { public static void build(String conf, String... moreConf) throws Exception { Objects.requireNonNull(conf, "At least one configuration file must be provided"); processConfFile(conf); if (moreConf != null) { for (String file : moreConf) { processConfFile(file); } } Conveyor<String, String, Conveyor> buildingConveyor = getBuildingConveyor(); Map<String,String> env = System.getenv(); env.forEach((key,value)->{ processPair(buildingConveyor, key, value); }); Properties p = System.getProperties(); p.forEach((key,value)->{ processPair(buildingConveyor, ""+key, ""+value); }); buildingConveyor.part().foreach().label("complete_configuration").value(true).place(); buildingConveyor.completeAndStop().get(); Conveyor.unRegister(buildingConveyor.getName()); } private  ConveyorConfiguration(); static void build(String conf, String... moreConf); @Override String toString(); static String SCRIPT_ENGINE; static String PROPERTY_PREFIX; static String PERSISTENCE_PREFIX; static String PROPERTY_DELIMITER; static long DEFAULT_TIMEOUT_MSEC; }