@Test public void testPush() { try { Prodigy.push(null, null); fail(); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), is("Parameter 'name' is required")); } try { Prodigy.push("push-handler-test.zip", null); fail(); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), is("Parameter 'name' must be *.jar")); } Repository repository = mock(Repository.class); doNothing().when(repository).save(anyString(), ArgumentMatchers.any(InputStream.class)); Prodigy.container(new Container(mock(Scheduler.class), repository)); Prodigy.push("push-handler-test.jar", null); }
public static void push(String name, InputStream jar) { if (name == null) { throw new IllegalArgumentException("Parameter 'name' is required"); } if (!name.endsWith(".jar")) { throw new IllegalArgumentException("Parameter 'name' must be *.jar"); } log.info("Pushing fault jar [" + name + "]"); Prodigy.container().repository().save(name, jar); log.info("Fault jar [" + name + "] pushed"); }
Prodigy { public static void push(String name, InputStream jar) { if (name == null) { throw new IllegalArgumentException("Parameter 'name' is required"); } if (!name.endsWith(".jar")) { throw new IllegalArgumentException("Parameter 'name' must be *.jar"); } log.info("Pushing fault jar [" + name + "]"); Prodigy.container().repository().save(name, jar); log.info("Fault jar [" + name + "] pushed"); } }
Prodigy { public static void push(String name, InputStream jar) { if (name == null) { throw new IllegalArgumentException("Parameter 'name' is required"); } if (!name.endsWith(".jar")) { throw new IllegalArgumentException("Parameter 'name' must be *.jar"); } log.info("Pushing fault jar [" + name + "]"); Prodigy.container().repository().save(name, jar); log.info("Fault jar [" + name + "] pushed"); } private  Prodigy(); }
Prodigy { public static void push(String name, InputStream jar) { if (name == null) { throw new IllegalArgumentException("Parameter 'name' is required"); } if (!name.endsWith(".jar")) { throw new IllegalArgumentException("Parameter 'name' must be *.jar"); } log.info("Pushing fault jar [" + name + "]"); Prodigy.container().repository().save(name, jar); log.info("Fault jar [" + name + "] pushed"); } private  Prodigy(); @SuppressWarnings("unchecked") static T adapt(T target); static String inject(String name, String params); static void eject(String id); static Map<String, Class<? extends Fault>> faults(); static Entry status(String id); static List<Entry> status(); static void push(String name, InputStream jar); }
Prodigy { public static void push(String name, InputStream jar) { if (name == null) { throw new IllegalArgumentException("Parameter 'name' is required"); } if (!name.endsWith(".jar")) { throw new IllegalArgumentException("Parameter 'name' must be *.jar"); } log.info("Pushing fault jar [" + name + "]"); Prodigy.container().repository().save(name, jar); log.info("Fault jar [" + name + "] pushed"); } private  Prodigy(); @SuppressWarnings("unchecked") static T adapt(T target); static String inject(String name, String params); static void eject(String id); static Map<String, Class<? extends Fault>> faults(); static Entry status(String id); static List<Entry> status(); static void push(String name, InputStream jar);  }