target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void urlAsMavenUrl() { assertThat( "Scan features url", new FeaturesScannerProvisionOption( maven().groupId( "bar" ).artifactId( "foo" ).classifier( "features" ).type( "xml" ), "f1", "f2/1.0.0" ).getURL(), is( equalTo( "scan-features:mvn:bar/foo ); } | public String getURL() { final StringBuilder url = new StringBuilder() .append( SCHEMA ) .append( SEPARATOR_SCHEME ) .append( super.getURL() ) .append( SEPARATOR_FILTER ); boolean first = true; for( String feature : m_features ) { if( !first ) { url.append( FEATURE_SEPARATOR ); } first = false; url.append( feature ); }... | FeaturesScannerProvisionOption extends AbstractUrlProvisionOption<FeaturesScannerProvisionOption> implements Scanner { public String getURL() { final StringBuilder url = new StringBuilder() .append( SCHEMA ) .append( SEPARATOR_SCHEME ) .append( super.getURL() ) .append( SEPARATOR_FILTER ); boolean first = true; for( St... | FeaturesScannerProvisionOption extends AbstractUrlProvisionOption<FeaturesScannerProvisionOption> implements Scanner { public String getURL() { final StringBuilder url = new StringBuilder() .append( SCHEMA ) .append( SEPARATOR_SCHEME ) .append( super.getURL() ) .append( SEPARATOR_FILTER ); boolean first = true; for( St... | FeaturesScannerProvisionOption extends AbstractUrlProvisionOption<FeaturesScannerProvisionOption> implements Scanner { public String getURL() { final StringBuilder url = new StringBuilder() .append( SCHEMA ) .append( SEPARATOR_SCHEME ) .append( super.getURL() ) .append( SEPARATOR_FILTER ); boolean first = true; for( St... | FeaturesScannerProvisionOption extends AbstractUrlProvisionOption<FeaturesScannerProvisionOption> implements Scanner { public String getURL() { final StringBuilder url = new StringBuilder() .append( SCHEMA ) .append( SEPARATOR_SCHEME ) .append( super.getURL() ) .append( SEPARATOR_FILTER ); boolean first = true; for( St... |
@Test public void urlAsMavenUrlViaFactoryMethod() { assertThat( "Scan features url", scanFeatures( maven().groupId( "bar" ).artifactId( "foo" ).classifier( "features" ).type( "xml" ), "f1", "f2/1.0.0" ).getURL(), is( equalTo( "scan-features:mvn:bar/foo ); } | public String getURL() { final StringBuilder url = new StringBuilder() .append( SCHEMA ) .append( SEPARATOR_SCHEME ) .append( super.getURL() ) .append( SEPARATOR_FILTER ); boolean first = true; for( String feature : m_features ) { if( !first ) { url.append( FEATURE_SEPARATOR ); } first = false; url.append( feature ); }... | FeaturesScannerProvisionOption extends AbstractUrlProvisionOption<FeaturesScannerProvisionOption> implements Scanner { public String getURL() { final StringBuilder url = new StringBuilder() .append( SCHEMA ) .append( SEPARATOR_SCHEME ) .append( super.getURL() ) .append( SEPARATOR_FILTER ); boolean first = true; for( St... | FeaturesScannerProvisionOption extends AbstractUrlProvisionOption<FeaturesScannerProvisionOption> implements Scanner { public String getURL() { final StringBuilder url = new StringBuilder() .append( SCHEMA ) .append( SEPARATOR_SCHEME ) .append( super.getURL() ) .append( SEPARATOR_FILTER ); boolean first = true; for( St... | FeaturesScannerProvisionOption extends AbstractUrlProvisionOption<FeaturesScannerProvisionOption> implements Scanner { public String getURL() { final StringBuilder url = new StringBuilder() .append( SCHEMA ) .append( SEPARATOR_SCHEME ) .append( super.getURL() ) .append( SEPARATOR_FILTER ); boolean first = true; for( St... | FeaturesScannerProvisionOption extends AbstractUrlProvisionOption<FeaturesScannerProvisionOption> implements Scanner { public String getURL() { final StringBuilder url = new StringBuilder() .append( SCHEMA ) .append( SEPARATOR_SCHEME ) .append( super.getURL() ) .append( SEPARATOR_FILTER ); boolean first = true; for( St... |
@Test public void urlAsString() { assertThat( "Scan composite url", new CompositeScannerProvisionOption( "file:foo.composite" ).getURL(), is( equalTo( "scan-composite:file:foo.composite@update" ) ) ); } | public String getURL() { return new StringBuilder() .append( SCHEMA ) .append( SEPARATOR_SCHEME ) .append( super.getURL() ) .append( getOptions( this ) ) .toString(); } | CompositeScannerProvisionOption extends AbstractUrlProvisionOption<CompositeScannerProvisionOption> implements Scanner { public String getURL() { return new StringBuilder() .append( SCHEMA ) .append( SEPARATOR_SCHEME ) .append( super.getURL() ) .append( getOptions( this ) ) .toString(); } } | CompositeScannerProvisionOption extends AbstractUrlProvisionOption<CompositeScannerProvisionOption> implements Scanner { public String getURL() { return new StringBuilder() .append( SCHEMA ) .append( SEPARATOR_SCHEME ) .append( super.getURL() ) .append( getOptions( this ) ) .toString(); } CompositeScannerProvisionOptio... | CompositeScannerProvisionOption extends AbstractUrlProvisionOption<CompositeScannerProvisionOption> implements Scanner { public String getURL() { return new StringBuilder() .append( SCHEMA ) .append( SEPARATOR_SCHEME ) .append( super.getURL() ) .append( getOptions( this ) ) .toString(); } CompositeScannerProvisionOptio... | CompositeScannerProvisionOption extends AbstractUrlProvisionOption<CompositeScannerProvisionOption> implements Scanner { public String getURL() { return new StringBuilder() .append( SCHEMA ) .append( SEPARATOR_SCHEME ) .append( super.getURL() ) .append( getOptions( this ) ) .toString(); } CompositeScannerProvisionOptio... |
@Test public void urlAsStringViaFactoryMethod() { assertThat( "Scan composite url", scanComposite( "file:foo.composite" ).getURL(), is( equalTo( "scan-composite:file:foo.composite@update" ) ) ); } | public String getURL() { return new StringBuilder() .append( SCHEMA ) .append( SEPARATOR_SCHEME ) .append( super.getURL() ) .append( getOptions( this ) ) .toString(); } | CompositeScannerProvisionOption extends AbstractUrlProvisionOption<CompositeScannerProvisionOption> implements Scanner { public String getURL() { return new StringBuilder() .append( SCHEMA ) .append( SEPARATOR_SCHEME ) .append( super.getURL() ) .append( getOptions( this ) ) .toString(); } } | CompositeScannerProvisionOption extends AbstractUrlProvisionOption<CompositeScannerProvisionOption> implements Scanner { public String getURL() { return new StringBuilder() .append( SCHEMA ) .append( SEPARATOR_SCHEME ) .append( super.getURL() ) .append( getOptions( this ) ) .toString(); } CompositeScannerProvisionOptio... | CompositeScannerProvisionOption extends AbstractUrlProvisionOption<CompositeScannerProvisionOption> implements Scanner { public String getURL() { return new StringBuilder() .append( SCHEMA ) .append( SEPARATOR_SCHEME ) .append( super.getURL() ) .append( getOptions( this ) ) .toString(); } CompositeScannerProvisionOptio... | CompositeScannerProvisionOption extends AbstractUrlProvisionOption<CompositeScannerProvisionOption> implements Scanner { public String getURL() { return new StringBuilder() .append( SCHEMA ) .append( SEPARATOR_SCHEME ) .append( super.getURL() ) .append( getOptions( this ) ) .toString(); } CompositeScannerProvisionOptio... |
@Test public void urlAsReference() { assertThat( "Scan composite url", new CompositeScannerProvisionOption( url( "file:foo.composite" ) ).getURL(), is( equalTo( "scan-composite:file:foo.composite@update" ) ) ); } | public String getURL() { return new StringBuilder() .append( SCHEMA ) .append( SEPARATOR_SCHEME ) .append( super.getURL() ) .append( getOptions( this ) ) .toString(); } | CompositeScannerProvisionOption extends AbstractUrlProvisionOption<CompositeScannerProvisionOption> implements Scanner { public String getURL() { return new StringBuilder() .append( SCHEMA ) .append( SEPARATOR_SCHEME ) .append( super.getURL() ) .append( getOptions( this ) ) .toString(); } } | CompositeScannerProvisionOption extends AbstractUrlProvisionOption<CompositeScannerProvisionOption> implements Scanner { public String getURL() { return new StringBuilder() .append( SCHEMA ) .append( SEPARATOR_SCHEME ) .append( super.getURL() ) .append( getOptions( this ) ) .toString(); } CompositeScannerProvisionOptio... | CompositeScannerProvisionOption extends AbstractUrlProvisionOption<CompositeScannerProvisionOption> implements Scanner { public String getURL() { return new StringBuilder() .append( SCHEMA ) .append( SEPARATOR_SCHEME ) .append( super.getURL() ) .append( getOptions( this ) ) .toString(); } CompositeScannerProvisionOptio... | CompositeScannerProvisionOption extends AbstractUrlProvisionOption<CompositeScannerProvisionOption> implements Scanner { public String getURL() { return new StringBuilder() .append( SCHEMA ) .append( SEPARATOR_SCHEME ) .append( super.getURL() ) .append( getOptions( this ) ) .toString(); } CompositeScannerProvisionOptio... |
@Test public void testGetDefaultAppPro(){ ConfigurationManager.setEnableDefaultload(true); System.out.println(ConfigurationManager.class.getProtectionDomain().getCodeSource().getLocation().toString()); URL url = getClass().getProtectionDomain().getCodeSource().getLocation(); try { InputStream in = ConfigurationManager.... | static void setEnableDefaultload(boolean enabled){ enableDefaultload =enabled; } | ConfigurationManager { static void setEnableDefaultload(boolean enabled){ enableDefaultload =enabled; } } | ConfigurationManager { static void setEnableDefaultload(boolean enabled){ enableDefaultload =enabled; } } | ConfigurationManager { static void setEnableDefaultload(boolean enabled){ enableDefaultload =enabled; } static Map<String,Map<String,String>> getAllProperties(); static Map<String,String> getPropertiesByConfigName(String configName); static Set<String> getConfigKeys(String configName); static synchronized boolean isCo... | ConfigurationManager { static void setEnableDefaultload(boolean enabled){ enableDefaultload =enabled; } static Map<String,Map<String,String>> getAllProperties(); static Map<String,String> getPropertiesByConfigName(String configName); static Set<String> getConfigKeys(String configName); static synchronized boolean isCo... |
@Test public void testLoadProperties() throws Exception { ConfigurationManager.loadPropertiesFromResources("test.properties"); assertEquals("9", ConfigurationManager.getConfigInstance().getProperty("com.ctrip.config.samples.needCount")); assertEquals("9", ConfigurationManager.getConfigInstance().getString("com.ctrip.co... | static void loadProperties(Properties properties) throws InitConfigurationException { if (instance == null) { instance = getConfigInstance(); } ConfigurationUtils.loadProperties(properties, instance); } | ConfigurationManager { static void loadProperties(Properties properties) throws InitConfigurationException { if (instance == null) { instance = getConfigInstance(); } ConfigurationUtils.loadProperties(properties, instance); } } | ConfigurationManager { static void loadProperties(Properties properties) throws InitConfigurationException { if (instance == null) { instance = getConfigInstance(); } ConfigurationUtils.loadProperties(properties, instance); } } | ConfigurationManager { static void loadProperties(Properties properties) throws InitConfigurationException { if (instance == null) { instance = getConfigInstance(); } ConfigurationUtils.loadProperties(properties, instance); } static Map<String,Map<String,String>> getAllProperties(); static Map<String,String> getProper... | ConfigurationManager { static void loadProperties(Properties properties) throws InitConfigurationException { if (instance == null) { instance = getConfigInstance(); } ConfigurationUtils.loadProperties(properties, instance); } static Map<String,Map<String,String>> getAllProperties(); static Map<String,String> getProper... |
@Test public void testNumberProperties() throws Exception { Configuration config = ConfigurationManager.getConfigInstance(); double val = 12.3; config.setProperty("test-double",val); assertTrue(val == config.getDouble("test-double")); config.setProperty("test-int",10); assertTrue(10 == config.getDouble("test-int")); as... | public static Configuration getConfigInstance() throws InitConfigurationException { if (instance == null) { synchronized (ConfigurationManager.class) { if (instance == null) { instance = createDefaultConfigInstance(); try { customProperties = Tools.loadPropertiesFromFile(TEMPFILENAME); } catch (Throwable e) { logger.er... | ConfigurationManager { public static Configuration getConfigInstance() throws InitConfigurationException { if (instance == null) { synchronized (ConfigurationManager.class) { if (instance == null) { instance = createDefaultConfigInstance(); try { customProperties = Tools.loadPropertiesFromFile(TEMPFILENAME); } catch (T... | ConfigurationManager { public static Configuration getConfigInstance() throws InitConfigurationException { if (instance == null) { synchronized (ConfigurationManager.class) { if (instance == null) { instance = createDefaultConfigInstance(); try { customProperties = Tools.loadPropertiesFromFile(TEMPFILENAME); } catch (T... | ConfigurationManager { public static Configuration getConfigInstance() throws InitConfigurationException { if (instance == null) { synchronized (ConfigurationManager.class) { if (instance == null) { instance = createDefaultConfigInstance(); try { customProperties = Tools.loadPropertiesFromFile(TEMPFILENAME); } catch (T... | ConfigurationManager { public static Configuration getConfigInstance() throws InitConfigurationException { if (instance == null) { synchronized (ConfigurationManager.class) { if (instance == null) { instance = createDefaultConfigInstance(); try { customProperties = Tools.loadPropertiesFromFile(TEMPFILENAME); } catch (T... |
@Test public void testLoadCascadedProperties() throws Exception { ConfigurationManager.loadCascadedPropertiesFromResources("config/test"); assertEquals("7", ConfigurationManager.getConfigInstance().getProperty("com.ctrip.config.samples.needCount")); assertEquals("1", ConfigurationManager.getConfigInstance().getProperty... | private static Properties loadCascadedProperties(String configName) throws IOException { String defaultConfigFileName = configName + ".properties"; ClassLoader loader = Thread.currentThread().getContextClassLoader(); URL url = loader.getResource(defaultConfigFileName); if (url == null) { throw new IOException("Cannot l... | ConfigurationManager { private static Properties loadCascadedProperties(String configName) throws IOException { String defaultConfigFileName = configName + ".properties"; ClassLoader loader = Thread.currentThread().getContextClassLoader(); URL url = loader.getResource(defaultConfigFileName); if (url == null) { throw ne... | ConfigurationManager { private static Properties loadCascadedProperties(String configName) throws IOException { String defaultConfigFileName = configName + ".properties"; ClassLoader loader = Thread.currentThread().getContextClassLoader(); URL url = loader.getResource(defaultConfigFileName); if (url == null) { throw ne... | ConfigurationManager { private static Properties loadCascadedProperties(String configName) throws IOException { String defaultConfigFileName = configName + ".properties"; ClassLoader loader = Thread.currentThread().getContextClassLoader(); URL url = loader.getResource(defaultConfigFileName); if (url == null) { throw ne... | ConfigurationManager { private static Properties loadCascadedProperties(String configName) throws IOException { String defaultConfigFileName = configName + ".properties"; ClassLoader loader = Thread.currentThread().getContextClassLoader(); URL url = loader.getResource(defaultConfigFileName); if (url == null) { throw ne... |
@Test public void testConfig(){ String path = "/config/all"; VIApiHandler.ExeResult rtn = handler.executeService(path, user, null); Map<String,Object> data = (Map<String, Object>) rtn.getData(); assertTrue(data.size()>0); assertTrue(data.containsKey("test")); } | public ExeResult executeService(String path,String user,Map<String,Object> params){ long startTime = System.nanoTime(); Object rtn=null; int responseCode = SC_OK; int permission = Permission.ALL.getValue(); EventLogger eventLogger = EventLoggerFactory.getTransLogger(getClass()); if(path == null){ return new ExeResult("... | VIApiHandler { public ExeResult executeService(String path,String user,Map<String,Object> params){ long startTime = System.nanoTime(); Object rtn=null; int responseCode = SC_OK; int permission = Permission.ALL.getValue(); EventLogger eventLogger = EventLoggerFactory.getTransLogger(getClass()); if(path == null){ return ... | VIApiHandler { public ExeResult executeService(String path,String user,Map<String,Object> params){ long startTime = System.nanoTime(); Object rtn=null; int responseCode = SC_OK; int permission = Permission.ALL.getValue(); EventLogger eventLogger = EventLoggerFactory.getTransLogger(getClass()); if(path == null){ return ... | VIApiHandler { public ExeResult executeService(String path,String user,Map<String,Object> params){ long startTime = System.nanoTime(); Object rtn=null; int responseCode = SC_OK; int permission = Permission.ALL.getValue(); EventLogger eventLogger = EventLoggerFactory.getTransLogger(getClass()); if(path == null){ return ... | VIApiHandler { public ExeResult executeService(String path,String user,Map<String,Object> params){ long startTime = System.nanoTime(); Object rtn=null; int responseCode = SC_OK; int permission = Permission.ALL.getValue(); EventLogger eventLogger = EventLoggerFactory.getTransLogger(getClass()); if(path == null){ return ... |
@Test public void testThreading(){ String path = "/threading/all"; VIApiHandler.ExeResult rtn = handler.executeService(path, user, null); List<ThreadingManager.TInfo> data = (List<ThreadingManager.TInfo>) rtn.getData(); assertTrue(data.size()>0); } | public ExeResult executeService(String path,String user,Map<String,Object> params){ long startTime = System.nanoTime(); Object rtn=null; int responseCode = SC_OK; int permission = Permission.ALL.getValue(); EventLogger eventLogger = EventLoggerFactory.getTransLogger(getClass()); if(path == null){ return new ExeResult("... | VIApiHandler { public ExeResult executeService(String path,String user,Map<String,Object> params){ long startTime = System.nanoTime(); Object rtn=null; int responseCode = SC_OK; int permission = Permission.ALL.getValue(); EventLogger eventLogger = EventLoggerFactory.getTransLogger(getClass()); if(path == null){ return ... | VIApiHandler { public ExeResult executeService(String path,String user,Map<String,Object> params){ long startTime = System.nanoTime(); Object rtn=null; int responseCode = SC_OK; int permission = Permission.ALL.getValue(); EventLogger eventLogger = EventLoggerFactory.getTransLogger(getClass()); if(path == null){ return ... | VIApiHandler { public ExeResult executeService(String path,String user,Map<String,Object> params){ long startTime = System.nanoTime(); Object rtn=null; int responseCode = SC_OK; int permission = Permission.ALL.getValue(); EventLogger eventLogger = EventLoggerFactory.getTransLogger(getClass()); if(path == null){ return ... | VIApiHandler { public ExeResult executeService(String path,String user,Map<String,Object> params){ long startTime = System.nanoTime(); Object rtn=null; int responseCode = SC_OK; int permission = Permission.ALL.getValue(); EventLogger eventLogger = EventLoggerFactory.getTransLogger(getClass()); if(path == null){ return ... |
@Test public void testGetThreadInfo(){ long threadId = 1; String path = "/threading/detail/"+threadId; VIApiHandler.ExeResult rtn = handler.executeService(path, user, null); ThreadInfo info = (ThreadInfo) rtn.getData(); assertEquals(threadId, info.getThreadId()); assertEquals("main", info.getThreadName()); final int ma... | public ExeResult executeService(String path,String user,Map<String,Object> params){ long startTime = System.nanoTime(); Object rtn=null; int responseCode = SC_OK; int permission = Permission.ALL.getValue(); EventLogger eventLogger = EventLoggerFactory.getTransLogger(getClass()); if(path == null){ return new ExeResult("... | VIApiHandler { public ExeResult executeService(String path,String user,Map<String,Object> params){ long startTime = System.nanoTime(); Object rtn=null; int responseCode = SC_OK; int permission = Permission.ALL.getValue(); EventLogger eventLogger = EventLoggerFactory.getTransLogger(getClass()); if(path == null){ return ... | VIApiHandler { public ExeResult executeService(String path,String user,Map<String,Object> params){ long startTime = System.nanoTime(); Object rtn=null; int responseCode = SC_OK; int permission = Permission.ALL.getValue(); EventLogger eventLogger = EventLoggerFactory.getTransLogger(getClass()); if(path == null){ return ... | VIApiHandler { public ExeResult executeService(String path,String user,Map<String,Object> params){ long startTime = System.nanoTime(); Object rtn=null; int responseCode = SC_OK; int permission = Permission.ALL.getValue(); EventLogger eventLogger = EventLoggerFactory.getTransLogger(getClass()); if(path == null){ return ... | VIApiHandler { public ExeResult executeService(String path,String user,Map<String,Object> params){ long startTime = System.nanoTime(); Object rtn=null; int responseCode = SC_OK; int permission = Permission.ALL.getValue(); EventLogger eventLogger = EventLoggerFactory.getTransLogger(getClass()); if(path == null){ return ... |
@Test public void testThreadStats(){ String path = "/threading/stats"; VIApiHandler.ExeResult rtn = handler.executeService(path, user, null); Map<String,Number> info = (Map<String, Number>) rtn.getData(); assertTrue(info.containsKey("currentThreadCount")); assertTrue(info.get("currentThreadCount").intValue()>0); assert... | public ExeResult executeService(String path,String user,Map<String,Object> params){ long startTime = System.nanoTime(); Object rtn=null; int responseCode = SC_OK; int permission = Permission.ALL.getValue(); EventLogger eventLogger = EventLoggerFactory.getTransLogger(getClass()); if(path == null){ return new ExeResult("... | VIApiHandler { public ExeResult executeService(String path,String user,Map<String,Object> params){ long startTime = System.nanoTime(); Object rtn=null; int responseCode = SC_OK; int permission = Permission.ALL.getValue(); EventLogger eventLogger = EventLoggerFactory.getTransLogger(getClass()); if(path == null){ return ... | VIApiHandler { public ExeResult executeService(String path,String user,Map<String,Object> params){ long startTime = System.nanoTime(); Object rtn=null; int responseCode = SC_OK; int permission = Permission.ALL.getValue(); EventLogger eventLogger = EventLoggerFactory.getTransLogger(getClass()); if(path == null){ return ... | VIApiHandler { public ExeResult executeService(String path,String user,Map<String,Object> params){ long startTime = System.nanoTime(); Object rtn=null; int responseCode = SC_OK; int permission = Permission.ALL.getValue(); EventLogger eventLogger = EventLoggerFactory.getTransLogger(getClass()); if(path == null){ return ... | VIApiHandler { public ExeResult executeService(String path,String user,Map<String,Object> params){ long startTime = System.nanoTime(); Object rtn=null; int responseCode = SC_OK; int permission = Permission.ALL.getValue(); EventLogger eventLogger = EventLoggerFactory.getTransLogger(getClass()); if(path == null){ return ... |
@Test public void testVIServer() throws Exception { int port = 1998; VIServer server = new VIServer(port); server.start(); URL url = new URL("http: Gson gson = new Gson(); List<CInfo> infos= new ArrayList<>(); String content = IOUtils.readAll((InputStream)url.getContent()); System.out.println(IgniteManager.getStatus().... | public VIServer(int listenPort,boolean useVIAuthentication) throws Exception { server = new Server(listenPort); handler = bind(server, String.valueOf(listenPort),useVIAuthentication); } | VIServer { public VIServer(int listenPort,boolean useVIAuthentication) throws Exception { server = new Server(listenPort); handler = bind(server, String.valueOf(listenPort),useVIAuthentication); } } | VIServer { public VIServer(int listenPort,boolean useVIAuthentication) throws Exception { server = new Server(listenPort); handler = bind(server, String.valueOf(listenPort),useVIAuthentication); } VIServer(int listenPort,boolean useVIAuthentication); VIServer(int listenPort); } | VIServer { public VIServer(int listenPort,boolean useVIAuthentication) throws Exception { server = new Server(listenPort); handler = bind(server, String.valueOf(listenPort),useVIAuthentication); } VIServer(int listenPort,boolean useVIAuthentication); VIServer(int listenPort); static ServletHandler bind(Server server,S... | VIServer { public VIServer(int listenPort,boolean useVIAuthentication) throws Exception { server = new Server(listenPort); handler = bind(server, String.valueOf(listenPort),useVIAuthentication); } VIServer(int listenPort,boolean useVIAuthentication); VIServer(int listenPort); static ServletHandler bind(Server server,S... |
@Test public void testDispatch_withArgumentAndExistingMethod_willSuccess() { testEventBus.testEventWithArgument(THE_ARG); replay(testEventBus); eventBusDispatcher.dispatch("testEventWithArgument", THE_ARG); verify(testEventBus); } | @Override public void dispatch(String name, Object event) { logger.debug("DispatchEvent: {} ({})", name, event); final Object[] args = event!=null?new Object[]{event}:new Object[]{}; dispatch(name, args); } | EventBusDispatcher implements IEventDispatcher { @Override public void dispatch(String name, Object event) { logger.debug("DispatchEvent: {} ({})", name, event); final Object[] args = event!=null?new Object[]{event}:new Object[]{}; dispatch(name, args); } } | EventBusDispatcher implements IEventDispatcher { @Override public void dispatch(String name, Object event) { logger.debug("DispatchEvent: {} ({})", name, event); final Object[] args = event!=null?new Object[]{event}:new Object[]{}; dispatch(name, args); } EventBusDispatcher(EventBusManager ebManager, EventBus eb); } | EventBusDispatcher implements IEventDispatcher { @Override public void dispatch(String name, Object event) { logger.debug("DispatchEvent: {} ({})", name, event); final Object[] args = event!=null?new Object[]{event}:new Object[]{}; dispatch(name, args); } EventBusDispatcher(EventBusManager ebManager, EventBus eb); @Ove... | EventBusDispatcher implements IEventDispatcher { @Override public void dispatch(String name, Object event) { logger.debug("DispatchEvent: {} ({})", name, event); final Object[] args = event!=null?new Object[]{event}:new Object[]{}; dispatch(name, args); } EventBusDispatcher(EventBusManager ebManager, EventBus eb); @Ove... |
@Test public void testBindUiFields() throws Exception { UiBinderView view = instance.bind(UiBinderView.class, new Locale("en"), null); assertNotNull("button ui field not bound", view.save); assertNotNull("label ui field not bound", view.labelOne); assertNotNull("label ui field not bound", view.labelTwo); } | public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintException("Fail... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... |
@Test public void testBindTranslations() throws Exception { UiBinderView view = instance.bind(UiBinderView.class, new Locale("en"), null); Label l = view.title; String caption = l.getCaption(); assertNotNull("caption is null", caption); assertEquals("wrong caption", "This is the view title", caption); assertEquals("de ... | public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintException("Fail... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... |
@Test public void testBindSimpleComponentsInitialized() throws UiBinderException { UiBinderViewInit root = instance.bind(UiBinderViewInit.class, new Locale("en"), null); assertNotNull("component is null", root); assertTrue("component is not initialzed", root.initialized); } | public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintException("Fail... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... |
@Test public void testGetMessageStringLocale() { String message = instance.getMessage("message.key", new Locale("de")); assertNotNull(message); assertEquals("Hier ein kleiner Text um die Sache zu erläutern.", message); } | @Override public String getMessage(String key, Locale locale) { ResourceBundle bundle = getBundle(locale); if (bundle.containsKey(key)) { return bundle.getString(key); } return "{{ message missing: " + key + "}}"; } | ResourceBundleUiMessageSource implements IUiMessageSource { @Override public String getMessage(String key, Locale locale) { ResourceBundle bundle = getBundle(locale); if (bundle.containsKey(key)) { return bundle.getString(key); } return "{{ message missing: " + key + "}}"; } } | ResourceBundleUiMessageSource implements IUiMessageSource { @Override public String getMessage(String key, Locale locale) { ResourceBundle bundle = getBundle(locale); if (bundle.containsKey(key)) { return bundle.getString(key); } return "{{ message missing: " + key + "}}"; } ResourceBundleUiMessageSource(String baseNam... | ResourceBundleUiMessageSource implements IUiMessageSource { @Override public String getMessage(String key, Locale locale) { ResourceBundle bundle = getBundle(locale); if (bundle.containsKey(key)) { return bundle.getString(key); } return "{{ message missing: " + key + "}}"; } ResourceBundleUiMessageSource(String baseNam... | ResourceBundleUiMessageSource implements IUiMessageSource { @Override public String getMessage(String key, Locale locale) { ResourceBundle bundle = getBundle(locale); if (bundle.containsKey(key)) { return bundle.getString(key); } return "{{ message missing: " + key + "}}"; } ResourceBundleUiMessageSource(String baseNam... |
@Test public void testGetMessageStringLocaleDefault() { String message = instance.getMessage("message.default", new Locale("en")); assertNotNull(message); assertEquals("Dieser Text steht nur in deutsch", message); } | @Override public String getMessage(String key, Locale locale) { ResourceBundle bundle = getBundle(locale); if (bundle.containsKey(key)) { return bundle.getString(key); } return "{{ message missing: " + key + "}}"; } | ResourceBundleUiMessageSource implements IUiMessageSource { @Override public String getMessage(String key, Locale locale) { ResourceBundle bundle = getBundle(locale); if (bundle.containsKey(key)) { return bundle.getString(key); } return "{{ message missing: " + key + "}}"; } } | ResourceBundleUiMessageSource implements IUiMessageSource { @Override public String getMessage(String key, Locale locale) { ResourceBundle bundle = getBundle(locale); if (bundle.containsKey(key)) { return bundle.getString(key); } return "{{ message missing: " + key + "}}"; } ResourceBundleUiMessageSource(String baseNam... | ResourceBundleUiMessageSource implements IUiMessageSource { @Override public String getMessage(String key, Locale locale) { ResourceBundle bundle = getBundle(locale); if (bundle.containsKey(key)) { return bundle.getString(key); } return "{{ message missing: " + key + "}}"; } ResourceBundleUiMessageSource(String baseNam... | ResourceBundleUiMessageSource implements IUiMessageSource { @Override public String getMessage(String key, Locale locale) { ResourceBundle bundle = getBundle(locale); if (bundle.containsKey(key)) { return bundle.getString(key); } return "{{ message missing: " + key + "}}"; } ResourceBundleUiMessageSource(String baseNam... |
@Test public void testGetMessageStringObjectArrayLocale() { String message = instance.getMessage("message.args", new Object[] {"PARAM"}, new Locale("de")); assertNotNull(message); assertEquals("Hier eine Nachricht mit Parametern... PARAM wurde eingegeben.", message); } | @Override public String getMessage(String key, Locale locale) { ResourceBundle bundle = getBundle(locale); if (bundle.containsKey(key)) { return bundle.getString(key); } return "{{ message missing: " + key + "}}"; } | ResourceBundleUiMessageSource implements IUiMessageSource { @Override public String getMessage(String key, Locale locale) { ResourceBundle bundle = getBundle(locale); if (bundle.containsKey(key)) { return bundle.getString(key); } return "{{ message missing: " + key + "}}"; } } | ResourceBundleUiMessageSource implements IUiMessageSource { @Override public String getMessage(String key, Locale locale) { ResourceBundle bundle = getBundle(locale); if (bundle.containsKey(key)) { return bundle.getString(key); } return "{{ message missing: " + key + "}}"; } ResourceBundleUiMessageSource(String baseNam... | ResourceBundleUiMessageSource implements IUiMessageSource { @Override public String getMessage(String key, Locale locale) { ResourceBundle bundle = getBundle(locale); if (bundle.containsKey(key)) { return bundle.getString(key); } return "{{ message missing: " + key + "}}"; } ResourceBundleUiMessageSource(String baseNam... | ResourceBundleUiMessageSource implements IUiMessageSource { @Override public String getMessage(String key, Locale locale) { ResourceBundle bundle = getBundle(locale); if (bundle.containsKey(key)) { return bundle.getString(key); } return "{{ message missing: " + key + "}}"; } ResourceBundleUiMessageSource(String baseNam... |
@Test public void getTargetNamespace() { assertEquals("urn:org.vaadin.mvp.uibinder.method", instance.getTargetNamespace()); } | @Override public String getTargetNamespace() { return "urn:org.vaadin.mvp.uibinder.method"; } | MethodHandler implements TargetHandler { @Override public String getTargetNamespace() { return "urn:org.vaadin.mvp.uibinder.method"; } } | MethodHandler implements TargetHandler { @Override public String getTargetNamespace() { return "urn:org.vaadin.mvp.uibinder.method"; } MethodHandler(ComponentHandler ch); } | MethodHandler implements TargetHandler { @Override public String getTargetNamespace() { return "urn:org.vaadin.mvp.uibinder.method"; } MethodHandler(ComponentHandler ch); @Override String getTargetNamespace(); @Override void handleElementOpen(String uri, String name); @Override void handleElementClose(); @Override void... | MethodHandler implements TargetHandler { @Override public String getTargetNamespace() { return "urn:org.vaadin.mvp.uibinder.method"; } MethodHandler(ComponentHandler ch); @Override String getTargetNamespace(); @Override void handleElementOpen(String uri, String name); @Override void handleElementClose(); @Override void... |
@Test public void handleElementOpen() { instance.handleElementOpen("", "addComponent"); Method m = ch.getCurrentMethod(); assertNotNull(m); assertEquals("addComponent", m.getName()); assertEquals(1, m.getParameterTypes().length); } | @Override public void handleElementOpen(String uri, String name) { method = findMethod(ch.getCurrent().getClass(), name); if (method == null) { throw new IllegalArgumentException("The method " + name + " is missing in " + ch.getCurrent().getClass()); } ch.setCurrentMethod(method); } | MethodHandler implements TargetHandler { @Override public void handleElementOpen(String uri, String name) { method = findMethod(ch.getCurrent().getClass(), name); if (method == null) { throw new IllegalArgumentException("The method " + name + " is missing in " + ch.getCurrent().getClass()); } ch.setCurrentMethod(method... | MethodHandler implements TargetHandler { @Override public void handleElementOpen(String uri, String name) { method = findMethod(ch.getCurrent().getClass(), name); if (method == null) { throw new IllegalArgumentException("The method " + name + " is missing in " + ch.getCurrent().getClass()); } ch.setCurrentMethod(method... | MethodHandler implements TargetHandler { @Override public void handleElementOpen(String uri, String name) { method = findMethod(ch.getCurrent().getClass(), name); if (method == null) { throw new IllegalArgumentException("The method " + name + " is missing in " + ch.getCurrent().getClass()); } ch.setCurrentMethod(method... | MethodHandler implements TargetHandler { @Override public void handleElementOpen(String uri, String name) { method = findMethod(ch.getCurrent().getClass(), name); if (method == null) { throw new IllegalArgumentException("The method " + name + " is missing in " + ch.getCurrent().getClass()); } ch.setCurrentMethod(method... |
@Test (expected = IllegalArgumentException.class) public void handleElementOpenFail() { instance.handleElementOpen("", "nirvanaMethod"); } | @Override public void handleElementOpen(String uri, String name) { method = findMethod(ch.getCurrent().getClass(), name); if (method == null) { throw new IllegalArgumentException("The method " + name + " is missing in " + ch.getCurrent().getClass()); } ch.setCurrentMethod(method); } | MethodHandler implements TargetHandler { @Override public void handleElementOpen(String uri, String name) { method = findMethod(ch.getCurrent().getClass(), name); if (method == null) { throw new IllegalArgumentException("The method " + name + " is missing in " + ch.getCurrent().getClass()); } ch.setCurrentMethod(method... | MethodHandler implements TargetHandler { @Override public void handleElementOpen(String uri, String name) { method = findMethod(ch.getCurrent().getClass(), name); if (method == null) { throw new IllegalArgumentException("The method " + name + " is missing in " + ch.getCurrent().getClass()); } ch.setCurrentMethod(method... | MethodHandler implements TargetHandler { @Override public void handleElementOpen(String uri, String name) { method = findMethod(ch.getCurrent().getClass(), name); if (method == null) { throw new IllegalArgumentException("The method " + name + " is missing in " + ch.getCurrent().getClass()); } ch.setCurrentMethod(method... | MethodHandler implements TargetHandler { @Override public void handleElementOpen(String uri, String name) { method = findMethod(ch.getCurrent().getClass(), name); if (method == null) { throw new IllegalArgumentException("The method " + name + " is missing in " + ch.getCurrent().getClass()); } ch.setCurrentMethod(method... |
@Test public void findMethod() throws SecurityException, NoSuchMethodException { Method m = instance.findMethod(VerticalLayout.class, "addComponent"); assertNotNull(m); assertEquals("addComponent", m.getName()); assertEquals(1, m.getParameterTypes().length); } | protected Method findMethod(Class<?> clazz, String name) { Class<?> searchType = clazz; while (searchType != null) { Method[] methods = (searchType.isInterface() ? searchType.getMethods() : searchType.getDeclaredMethods()); for (Method method : methods) { if (name.equals(method.getName()) && method.getParameterTypes().... | MethodHandler implements TargetHandler { protected Method findMethod(Class<?> clazz, String name) { Class<?> searchType = clazz; while (searchType != null) { Method[] methods = (searchType.isInterface() ? searchType.getMethods() : searchType.getDeclaredMethods()); for (Method method : methods) { if (name.equals(method.... | MethodHandler implements TargetHandler { protected Method findMethod(Class<?> clazz, String name) { Class<?> searchType = clazz; while (searchType != null) { Method[] methods = (searchType.isInterface() ? searchType.getMethods() : searchType.getDeclaredMethods()); for (Method method : methods) { if (name.equals(method.... | MethodHandler implements TargetHandler { protected Method findMethod(Class<?> clazz, String name) { Class<?> searchType = clazz; while (searchType != null) { Method[] methods = (searchType.isInterface() ? searchType.getMethods() : searchType.getDeclaredMethods()); for (Method method : methods) { if (name.equals(method.... | MethodHandler implements TargetHandler { protected Method findMethod(Class<?> clazz, String name) { Class<?> searchType = clazz; while (searchType != null) { Method[] methods = (searchType.isInterface() ? searchType.getMethods() : searchType.getDeclaredMethods()); for (Method method : methods) { if (name.equals(method.... |
@Test public void testDispatch_withoutArgumentAndExistingMethod_willSuccess() { testEventBus.testEventWithoutArgument(); replay(testEventBus); eventBusDispatcher.dispatch("testEventWithoutArgument"); verify(testEventBus); } | @Override public void dispatch(String name, Object event) { logger.debug("DispatchEvent: {} ({})", name, event); final Object[] args = event!=null?new Object[]{event}:new Object[]{}; dispatch(name, args); } | EventBusDispatcher implements IEventDispatcher { @Override public void dispatch(String name, Object event) { logger.debug("DispatchEvent: {} ({})", name, event); final Object[] args = event!=null?new Object[]{event}:new Object[]{}; dispatch(name, args); } } | EventBusDispatcher implements IEventDispatcher { @Override public void dispatch(String name, Object event) { logger.debug("DispatchEvent: {} ({})", name, event); final Object[] args = event!=null?new Object[]{event}:new Object[]{}; dispatch(name, args); } EventBusDispatcher(EventBusManager ebManager, EventBus eb); } | EventBusDispatcher implements IEventDispatcher { @Override public void dispatch(String name, Object event) { logger.debug("DispatchEvent: {} ({})", name, event); final Object[] args = event!=null?new Object[]{event}:new Object[]{}; dispatch(name, args); } EventBusDispatcher(EventBusManager ebManager, EventBus eb); @Ove... | EventBusDispatcher implements IEventDispatcher { @Override public void dispatch(String name, Object event) { logger.debug("DispatchEvent: {} ({})", name, event); final Object[] args = event!=null?new Object[]{event}:new Object[]{}; dispatch(name, args); } EventBusDispatcher(EventBusManager ebManager, EventBus eb); @Ove... |
@Test public void findMethodNotFound() throws SecurityException, NoSuchMethodException { Method m = instance.findMethod(VerticalLayout.class, "nirvanaMethod"); assertNull(m); } | protected Method findMethod(Class<?> clazz, String name) { Class<?> searchType = clazz; while (searchType != null) { Method[] methods = (searchType.isInterface() ? searchType.getMethods() : searchType.getDeclaredMethods()); for (Method method : methods) { if (name.equals(method.getName()) && method.getParameterTypes().... | MethodHandler implements TargetHandler { protected Method findMethod(Class<?> clazz, String name) { Class<?> searchType = clazz; while (searchType != null) { Method[] methods = (searchType.isInterface() ? searchType.getMethods() : searchType.getDeclaredMethods()); for (Method method : methods) { if (name.equals(method.... | MethodHandler implements TargetHandler { protected Method findMethod(Class<?> clazz, String name) { Class<?> searchType = clazz; while (searchType != null) { Method[] methods = (searchType.isInterface() ? searchType.getMethods() : searchType.getDeclaredMethods()); for (Method method : methods) { if (name.equals(method.... | MethodHandler implements TargetHandler { protected Method findMethod(Class<?> clazz, String name) { Class<?> searchType = clazz; while (searchType != null) { Method[] methods = (searchType.isInterface() ? searchType.getMethods() : searchType.getDeclaredMethods()); for (Method method : methods) { if (name.equals(method.... | MethodHandler implements TargetHandler { protected Method findMethod(Class<?> clazz, String name) { Class<?> searchType = clazz; while (searchType != null) { Method[] methods = (searchType.isInterface() ? searchType.getMethods() : searchType.getDeclaredMethods()); for (Method method : methods) { if (name.equals(method.... |
@Test public void testFindApplicableSetterMethodStringArg() throws SecurityException, NoSuchMethodException { Method m = instance.findApplicableSetterMethod(bean, "height", "67%"); assertEquals("wrong setter selected", VerticalLayout.class.getMethod("setHeight", String.class), m); } | protected Method findApplicableSetterMethod(Object target, String propertyName, Object value) { String methodName = "set" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1); Method[] methods = target.getClass().getMethods(); if (value.getClass().isArray()) { } else { Method method = MethodUtils.ge... | ComponentHandler implements TargetHandler { protected Method findApplicableSetterMethod(Object target, String propertyName, Object value) { String methodName = "set" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1); Method[] methods = target.getClass().getMethods(); if (value.getClass().isArray(... | ComponentHandler implements TargetHandler { protected Method findApplicableSetterMethod(Object target, String propertyName, Object value) { String methodName = "set" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1); Method[] methods = target.getClass().getMethods(); if (value.getClass().isArray(... | ComponentHandler implements TargetHandler { protected Method findApplicableSetterMethod(Object target, String propertyName, Object value) { String methodName = "set" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1); Method[] methods = target.getClass().getMethods(); if (value.getClass().isArray(... | ComponentHandler implements TargetHandler { protected Method findApplicableSetterMethod(Object target, String propertyName, Object value) { String methodName = "set" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1); Method[] methods = target.getClass().getMethods(); if (value.getClass().isArray(... |
@Ignore("Currently not supported, introduce expressions, e.g. MVEL to support this.") @Test public void testFindApplicableSetterMethodFloatIntArg() throws SecurityException, NoSuchMethodException { Method m = instance.findApplicableSetterMethod(bean, "height", "67, #UNITS_PERCENTAGE"); assertEquals("wrong setter select... | protected Method findApplicableSetterMethod(Object target, String propertyName, Object value) { String methodName = "set" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1); Method[] methods = target.getClass().getMethods(); if (value.getClass().isArray()) { } else { Method method = MethodUtils.ge... | ComponentHandler implements TargetHandler { protected Method findApplicableSetterMethod(Object target, String propertyName, Object value) { String methodName = "set" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1); Method[] methods = target.getClass().getMethods(); if (value.getClass().isArray(... | ComponentHandler implements TargetHandler { protected Method findApplicableSetterMethod(Object target, String propertyName, Object value) { String methodName = "set" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1); Method[] methods = target.getClass().getMethods(); if (value.getClass().isArray(... | ComponentHandler implements TargetHandler { protected Method findApplicableSetterMethod(Object target, String propertyName, Object value) { String methodName = "set" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1); Method[] methods = target.getClass().getMethods(); if (value.getClass().isArray(... | ComponentHandler implements TargetHandler { protected Method findApplicableSetterMethod(Object target, String propertyName, Object value) { String methodName = "set" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1); Method[] methods = target.getClass().getMethods(); if (value.getClass().isArray(... |
@Test public void testFindApplicableSetterMethodNoArg() throws SecurityException, NoSuchMethodException { Method m = instance.findApplicableSetterMethod(bean, "sizeFull", ""); assertEquals("wrong setter selected", VerticalLayout.class.getMethod("setSizeFull"), m); } | protected Method findApplicableSetterMethod(Object target, String propertyName, Object value) { String methodName = "set" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1); Method[] methods = target.getClass().getMethods(); if (value.getClass().isArray()) { } else { Method method = MethodUtils.ge... | ComponentHandler implements TargetHandler { protected Method findApplicableSetterMethod(Object target, String propertyName, Object value) { String methodName = "set" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1); Method[] methods = target.getClass().getMethods(); if (value.getClass().isArray(... | ComponentHandler implements TargetHandler { protected Method findApplicableSetterMethod(Object target, String propertyName, Object value) { String methodName = "set" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1); Method[] methods = target.getClass().getMethods(); if (value.getClass().isArray(... | ComponentHandler implements TargetHandler { protected Method findApplicableSetterMethod(Object target, String propertyName, Object value) { String methodName = "set" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1); Method[] methods = target.getClass().getMethods(); if (value.getClass().isArray(... | ComponentHandler implements TargetHandler { protected Method findApplicableSetterMethod(Object target, String propertyName, Object value) { String methodName = "set" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1); Method[] methods = target.getClass().getMethods(); if (value.getClass().isArray(... |
@Test public void testNamespaceUriToPackageName() throws UiConstraintException { String pkg = instance.namespaceUriToPackageName("urn:import:org.vaadin.test"); assertEquals("invalid conversion of namespace to package", "org.vaadin.test", pkg); } | protected String namespaceUriToPackageName(String uri) throws UiConstraintException { if (packages.containsKey(uri)) { return packages.get(uri); } try { URI nsUri = new URI(uri); String pkg = null; String scheme = nsUri.getScheme(); if ("urn".equals(scheme)) { pkg = nsUri.getSchemeSpecificPart(); } else if ("http".equa... | ComponentHandler implements TargetHandler { protected String namespaceUriToPackageName(String uri) throws UiConstraintException { if (packages.containsKey(uri)) { return packages.get(uri); } try { URI nsUri = new URI(uri); String pkg = null; String scheme = nsUri.getScheme(); if ("urn".equals(scheme)) { pkg = nsUri.get... | ComponentHandler implements TargetHandler { protected String namespaceUriToPackageName(String uri) throws UiConstraintException { if (packages.containsKey(uri)) { return packages.get(uri); } try { URI nsUri = new URI(uri); String pkg = null; String scheme = nsUri.getScheme(); if ("urn".equals(scheme)) { pkg = nsUri.get... | ComponentHandler implements TargetHandler { protected String namespaceUriToPackageName(String uri) throws UiConstraintException { if (packages.containsKey(uri)) { return packages.get(uri); } try { URI nsUri = new URI(uri); String pkg = null; String scheme = nsUri.getScheme(); if ("urn".equals(scheme)) { pkg = nsUri.get... | ComponentHandler implements TargetHandler { protected String namespaceUriToPackageName(String uri) throws UiConstraintException { if (packages.containsKey(uri)) { return packages.get(uri); } try { URI nsUri = new URI(uri); String pkg = null; String scheme = nsUri.getScheme(); if ("urn".equals(scheme)) { pkg = nsUri.get... |
@Test public void testNamespaceUriToPackageNameHttp() throws UiConstraintException { String pkg = instance.namespaceUriToPackageName("http: assertEquals("invalid conversion of namespace to package", "org.vaadin.test.some.pkg", pkg); } | protected String namespaceUriToPackageName(String uri) throws UiConstraintException { if (packages.containsKey(uri)) { return packages.get(uri); } try { URI nsUri = new URI(uri); String pkg = null; String scheme = nsUri.getScheme(); if ("urn".equals(scheme)) { pkg = nsUri.getSchemeSpecificPart(); } else if ("http".equa... | ComponentHandler implements TargetHandler { protected String namespaceUriToPackageName(String uri) throws UiConstraintException { if (packages.containsKey(uri)) { return packages.get(uri); } try { URI nsUri = new URI(uri); String pkg = null; String scheme = nsUri.getScheme(); if ("urn".equals(scheme)) { pkg = nsUri.get... | ComponentHandler implements TargetHandler { protected String namespaceUriToPackageName(String uri) throws UiConstraintException { if (packages.containsKey(uri)) { return packages.get(uri); } try { URI nsUri = new URI(uri); String pkg = null; String scheme = nsUri.getScheme(); if ("urn".equals(scheme)) { pkg = nsUri.get... | ComponentHandler implements TargetHandler { protected String namespaceUriToPackageName(String uri) throws UiConstraintException { if (packages.containsKey(uri)) { return packages.get(uri); } try { URI nsUri = new URI(uri); String pkg = null; String scheme = nsUri.getScheme(); if ("urn".equals(scheme)) { pkg = nsUri.get... | ComponentHandler implements TargetHandler { protected String namespaceUriToPackageName(String uri) throws UiConstraintException { if (packages.containsKey(uri)) { return packages.get(uri); } try { URI nsUri = new URI(uri); String pkg = null; String scheme = nsUri.getScheme(); if ("urn".equals(scheme)) { pkg = nsUri.get... |
@Test(expected = IllegalArgumentException.class) public void testGetEventBus_privateEventBus_NotSupported() { eventBusManager.getEventBus(StubPrivateEventBus.class); } | public <T extends EventBus> T getEventBus(Class<T> busType) { if (isPrivateEventBus(busType)) { throw new IllegalArgumentException("The bus " + busType + " is marked as private and it can be retrieved only from his presenter"); } assertEventBus(busType); EventBus eventBus = eventBusses.get(busType); return busType.cast... | EventBusManager { public <T extends EventBus> T getEventBus(Class<T> busType) { if (isPrivateEventBus(busType)) { throw new IllegalArgumentException("The bus " + busType + " is marked as private and it can be retrieved only from his presenter"); } assertEventBus(busType); EventBus eventBus = eventBusses.get(busType); r... | EventBusManager { public <T extends EventBus> T getEventBus(Class<T> busType) { if (isPrivateEventBus(busType)) { throw new IllegalArgumentException("The bus " + busType + " is marked as private and it can be retrieved only from his presenter"); } assertEventBus(busType); EventBus eventBus = eventBusses.get(busType); r... | EventBusManager { public <T extends EventBus> T getEventBus(Class<T> busType) { if (isPrivateEventBus(busType)) { throw new IllegalArgumentException("The bus " + busType + " is marked as private and it can be retrieved only from his presenter"); } assertEventBus(busType); EventBus eventBus = eventBusses.get(busType); r... | EventBusManager { public <T extends EventBus> T getEventBus(Class<T> busType) { if (isPrivateEventBus(busType)) { throw new IllegalArgumentException("The bus " + busType + " is marked as private and it can be retrieved only from his presenter"); } assertEventBus(busType); EventBus eventBus = eventBusses.get(busType); r... |
@Test public void testGetEventBus_NonPrivateEventBus_Supported() { eventBusManager.getEventBus(StubEventBus.class); } | public <T extends EventBus> T getEventBus(Class<T> busType) { if (isPrivateEventBus(busType)) { throw new IllegalArgumentException("The bus " + busType + " is marked as private and it can be retrieved only from his presenter"); } assertEventBus(busType); EventBus eventBus = eventBusses.get(busType); return busType.cast... | EventBusManager { public <T extends EventBus> T getEventBus(Class<T> busType) { if (isPrivateEventBus(busType)) { throw new IllegalArgumentException("The bus " + busType + " is marked as private and it can be retrieved only from his presenter"); } assertEventBus(busType); EventBus eventBus = eventBusses.get(busType); r... | EventBusManager { public <T extends EventBus> T getEventBus(Class<T> busType) { if (isPrivateEventBus(busType)) { throw new IllegalArgumentException("The bus " + busType + " is marked as private and it can be retrieved only from his presenter"); } assertEventBus(busType); EventBus eventBus = eventBusses.get(busType); r... | EventBusManager { public <T extends EventBus> T getEventBus(Class<T> busType) { if (isPrivateEventBus(busType)) { throw new IllegalArgumentException("The bus " + busType + " is marked as private and it can be retrieved only from his presenter"); } assertEventBus(busType); EventBus eventBus = eventBusses.get(busType); r... | EventBusManager { public <T extends EventBus> T getEventBus(Class<T> busType) { if (isPrivateEventBus(busType)) { throw new IllegalArgumentException("The bus " + busType + " is marked as private and it can be retrieved only from his presenter"); } assertEventBus(busType); EventBus eventBus = eventBusses.get(busType); r... |
@Test public void testRegister_NonPrivateEventBus_mustReturnSameBus() { EventBus eventBus = eventBusManager.register(StubEventBus.class,new Object()); EventBus eventBus2 = eventBusManager.register(StubEventBus.class,new Object()); Assert.assertSame("Different event bus instances",eventBus,eventBus2); } | public <T extends EventBus> T register(Class<T> busType, Object subscriber) { return this.register(busType,subscriber,null); } | EventBusManager { public <T extends EventBus> T register(Class<T> busType, Object subscriber) { return this.register(busType,subscriber,null); } } | EventBusManager { public <T extends EventBus> T register(Class<T> busType, Object subscriber) { return this.register(busType,subscriber,null); } EventBusManager(); } | EventBusManager { public <T extends EventBus> T register(Class<T> busType, Object subscriber) { return this.register(busType,subscriber,null); } EventBusManager(); T register(Class<T> busType, Object subscriber); T register(Class<T> busType, Object subscriber,EventBus parentEventBus); void addSubscriber(Object subscrib... | EventBusManager { public <T extends EventBus> T register(Class<T> busType, Object subscriber) { return this.register(busType,subscriber,null); } EventBusManager(); T register(Class<T> busType, Object subscriber); T register(Class<T> busType, Object subscriber,EventBus parentEventBus); void addSubscriber(Object subscrib... |
@Test public void testRegister_NonPrivateEventBus_mustReturnDifferentBus() { EventBus eventBus = eventBusManager.register(StubPrivateEventBus.class,new Object()); EventBus eventBus2 = eventBusManager.register(StubPrivateEventBus.class,new Object()); Assert.assertNotSame("Same event bus instances",eventBus,eventBus2); } | public <T extends EventBus> T register(Class<T> busType, Object subscriber) { return this.register(busType,subscriber,null); } | EventBusManager { public <T extends EventBus> T register(Class<T> busType, Object subscriber) { return this.register(busType,subscriber,null); } } | EventBusManager { public <T extends EventBus> T register(Class<T> busType, Object subscriber) { return this.register(busType,subscriber,null); } EventBusManager(); } | EventBusManager { public <T extends EventBus> T register(Class<T> busType, Object subscriber) { return this.register(busType,subscriber,null); } EventBusManager(); T register(Class<T> busType, Object subscriber); T register(Class<T> busType, Object subscriber,EventBus parentEventBus); void addSubscriber(Object subscrib... | EventBusManager { public <T extends EventBus> T register(Class<T> busType, Object subscriber) { return this.register(busType,subscriber,null); } EventBusManager(); T register(Class<T> busType, Object subscriber); T register(Class<T> busType, Object subscriber,EventBus parentEventBus); void addSubscriber(Object subscrib... |
@Test(expected = Exception.class) public void testDispatch_withoutArgument_exceptionOccurred_willBeRaised() { testEventBus.testEventWithoutArgument(); expectLastCall().andThrow(new RuntimeException("Faking an exception")); replay(testEventBus); eventBusDispatcher.dispatch("testEventWithoutArgument"); verify(testEventBu... | @Override public void dispatch(String name, Object event) { logger.debug("DispatchEvent: {} ({})", name, event); final Object[] args = event!=null?new Object[]{event}:new Object[]{}; dispatch(name, args); } | EventBusDispatcher implements IEventDispatcher { @Override public void dispatch(String name, Object event) { logger.debug("DispatchEvent: {} ({})", name, event); final Object[] args = event!=null?new Object[]{event}:new Object[]{}; dispatch(name, args); } } | EventBusDispatcher implements IEventDispatcher { @Override public void dispatch(String name, Object event) { logger.debug("DispatchEvent: {} ({})", name, event); final Object[] args = event!=null?new Object[]{event}:new Object[]{}; dispatch(name, args); } EventBusDispatcher(EventBusManager ebManager, EventBus eb); } | EventBusDispatcher implements IEventDispatcher { @Override public void dispatch(String name, Object event) { logger.debug("DispatchEvent: {} ({})", name, event); final Object[] args = event!=null?new Object[]{event}:new Object[]{}; dispatch(name, args); } EventBusDispatcher(EventBusManager ebManager, EventBus eb); @Ove... | EventBusDispatcher implements IEventDispatcher { @Override public void dispatch(String name, Object event) { logger.debug("DispatchEvent: {} ({})", name, event); final Object[] args = event!=null?new Object[]{event}:new Object[]{}; dispatch(name, args); } EventBusDispatcher(EventBusManager ebManager, EventBus eb); @Ove... |
@Test public void testParentFallbackEventsDelivery_notExistingEventOnChildWillBeForwarded() throws Exception{ StubPrivateEventBus parentEventBus = createNiceMock(StubPrivateEventBus.class); parentEventBus.niceEvent(); replay(mainEventReceiverRegistry, parentEventBus); StubEventBus eventBus = EventBusHandlerProxyFactory... | @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ("toString".equals(method.getName())) { return "EventBus<" + busName + ">"; } logger.info("Event received: {}", method.getName()); Event eventDef = method.getAnnotation(Event.class); logger.info("Event annotation: {}", even... | EventBusHandler implements InvocationHandler { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ("toString".equals(method.getName())) { return "EventBus<" + busName + ">"; } logger.info("Event received: {}", method.getName()); Event eventDef = method.getAnnotation(Event.c... | EventBusHandler implements InvocationHandler { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ("toString".equals(method.getName())) { return "EventBus<" + busName + ">"; } logger.info("Event received: {}", method.getName()); Event eventDef = method.getAnnotation(Event.c... | EventBusHandler implements InvocationHandler { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ("toString".equals(method.getName())) { return "EventBus<" + busName + ">"; } logger.info("Event received: {}", method.getName()); Event eventDef = method.getAnnotation(Event.c... | EventBusHandler implements InvocationHandler { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ("toString".equals(method.getName())) { return "EventBus<" + busName + ">"; } logger.info("Event received: {}", method.getName()); Event eventDef = method.getAnnotation(Event.c... |
@Test(expected = Exception.class) public void testParentFallbackEventsDelivery_notExistingEventOnChildWillBeForwarded_exceptionIsThrown() throws Exception{ StubPrivateEventBus parentEventBus = createNiceMock(StubPrivateEventBus.class); parentEventBus.niceEvent(); expectLastCall().andThrow(new RuntimeException()); repla... | @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ("toString".equals(method.getName())) { return "EventBus<" + busName + ">"; } logger.info("Event received: {}", method.getName()); Event eventDef = method.getAnnotation(Event.class); logger.info("Event annotation: {}", even... | EventBusHandler implements InvocationHandler { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ("toString".equals(method.getName())) { return "EventBus<" + busName + ">"; } logger.info("Event received: {}", method.getName()); Event eventDef = method.getAnnotation(Event.c... | EventBusHandler implements InvocationHandler { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ("toString".equals(method.getName())) { return "EventBus<" + busName + ">"; } logger.info("Event received: {}", method.getName()); Event eventDef = method.getAnnotation(Event.c... | EventBusHandler implements InvocationHandler { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ("toString".equals(method.getName())) { return "EventBus<" + busName + ">"; } logger.info("Event received: {}", method.getName()); Event eventDef = method.getAnnotation(Event.c... | EventBusHandler implements InvocationHandler { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ("toString".equals(method.getName())) { return "EventBus<" + busName + ">"; } logger.info("Event received: {}", method.getName()); Event eventDef = method.getAnnotation(Event.c... |
@Test public void testCreate() { IPresenter<?, ? extends EventBus> presenter = instance.createPresenter("spring"); assertNotNull("created presenter is null", presenter); assertNotNull("presenters view is null", presenter.getView()); assertTrue("presenters bind() method has not been called", ((SpringPresenter)presenter)... | @SuppressWarnings("unchecked") public IPresenter<?, ? extends EventBus> create(Object name,EventBus parentEventBus) { if (!(name instanceof String)) { throw new IllegalArgumentException("Argument is expected to be a bean name (string)"); } String beanName = (String) name; if (applicationContext.containsBean(beanName)) ... | SpringPresenterFactory extends AbstractPresenterFactory implements ApplicationContextAware { @SuppressWarnings("unchecked") public IPresenter<?, ? extends EventBus> create(Object name,EventBus parentEventBus) { if (!(name instanceof String)) { throw new IllegalArgumentException("Argument is expected to be a bean name (... | SpringPresenterFactory extends AbstractPresenterFactory implements ApplicationContextAware { @SuppressWarnings("unchecked") public IPresenter<?, ? extends EventBus> create(Object name,EventBus parentEventBus) { if (!(name instanceof String)) { throw new IllegalArgumentException("Argument is expected to be a bean name (... | SpringPresenterFactory extends AbstractPresenterFactory implements ApplicationContextAware { @SuppressWarnings("unchecked") public IPresenter<?, ? extends EventBus> create(Object name,EventBus parentEventBus) { if (!(name instanceof String)) { throw new IllegalArgumentException("Argument is expected to be a bean name (... | SpringPresenterFactory extends AbstractPresenterFactory implements ApplicationContextAware { @SuppressWarnings("unchecked") public IPresenter<?, ? extends EventBus> create(Object name,EventBus parentEventBus) { if (!(name instanceof String)) { throw new IllegalArgumentException("Argument is expected to be a bean name (... |
@Test(expected = Exception.class) public void testDispatch_witArgument_exceptionOccurred_willBeRaised() { testEventBus.testEventWithArgument(THE_ARG); expectLastCall().andThrow(new RuntimeException("Faking an exception")); replay(testEventBus); eventBusDispatcher.dispatch("testEventWithArgument",THE_ARG); verify(testEv... | @Override public void dispatch(String name, Object event) { logger.debug("DispatchEvent: {} ({})", name, event); final Object[] args = event!=null?new Object[]{event}:new Object[]{}; dispatch(name, args); } | EventBusDispatcher implements IEventDispatcher { @Override public void dispatch(String name, Object event) { logger.debug("DispatchEvent: {} ({})", name, event); final Object[] args = event!=null?new Object[]{event}:new Object[]{}; dispatch(name, args); } } | EventBusDispatcher implements IEventDispatcher { @Override public void dispatch(String name, Object event) { logger.debug("DispatchEvent: {} ({})", name, event); final Object[] args = event!=null?new Object[]{event}:new Object[]{}; dispatch(name, args); } EventBusDispatcher(EventBusManager ebManager, EventBus eb); } | EventBusDispatcher implements IEventDispatcher { @Override public void dispatch(String name, Object event) { logger.debug("DispatchEvent: {} ({})", name, event); final Object[] args = event!=null?new Object[]{event}:new Object[]{}; dispatch(name, args); } EventBusDispatcher(EventBusManager ebManager, EventBus eb); @Ove... | EventBusDispatcher implements IEventDispatcher { @Override public void dispatch(String name, Object event) { logger.debug("DispatchEvent: {} ({})", name, event); final Object[] args = event!=null?new Object[]{event}:new Object[]{}; dispatch(name, args); } EventBusDispatcher(EventBusManager ebManager, EventBus eb); @Ove... |
@Test public void testDispatch_notExistingMethod() { replay(testEventBus); eventBusDispatcher.dispatch("notExistingMethod",THE_ARG); verify(testEventBus); } | @Override public void dispatch(String name, Object event) { logger.debug("DispatchEvent: {} ({})", name, event); final Object[] args = event!=null?new Object[]{event}:new Object[]{}; dispatch(name, args); } | EventBusDispatcher implements IEventDispatcher { @Override public void dispatch(String name, Object event) { logger.debug("DispatchEvent: {} ({})", name, event); final Object[] args = event!=null?new Object[]{event}:new Object[]{}; dispatch(name, args); } } | EventBusDispatcher implements IEventDispatcher { @Override public void dispatch(String name, Object event) { logger.debug("DispatchEvent: {} ({})", name, event); final Object[] args = event!=null?new Object[]{event}:new Object[]{}; dispatch(name, args); } EventBusDispatcher(EventBusManager ebManager, EventBus eb); } | EventBusDispatcher implements IEventDispatcher { @Override public void dispatch(String name, Object event) { logger.debug("DispatchEvent: {} ({})", name, event); final Object[] args = event!=null?new Object[]{event}:new Object[]{}; dispatch(name, args); } EventBusDispatcher(EventBusManager ebManager, EventBus eb); @Ove... | EventBusDispatcher implements IEventDispatcher { @Override public void dispatch(String name, Object event) { logger.debug("DispatchEvent: {} ({})", name, event); final Object[] args = event!=null?new Object[]{event}:new Object[]{}; dispatch(name, args); } EventBusDispatcher(EventBusManager ebManager, EventBus eb); @Ove... |
@Test public void testBindSimpleComponents() throws UiBinderException { UiBinderView root = instance.bind(UiBinderView.class, new Locale("en"), null); assertNotNull("component is null", root); boolean isPanel = root instanceof Panel; assertTrue("not a panel", isPanel); Panel panel = (Panel) root; Component layout = pan... | public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintException("Fail... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... |
@Test public void testBindAttributes() throws Exception { UiBinderView root = instance.bind(UiBinderView.class, new Locale("en"), null); ComponentContainer content = root.getContent(); assertNotNull("content should be a layout", content); VerticalLayout layout = (VerticalLayout) content; float height = layout.getHeight... | public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintException("Fail... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... |
@Test public void testBindEventListener() throws Exception { UiBinderView root = instance.bind(UiBinderView.class, new Locale("en"), null); assertNotNull("event button not bound", root.eventButton); assertTrue("click listener not set", root.eventButton.clickListenerSet); } | public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintException("Fail... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... |
@Test public void testBindCustomComponents() throws Exception { UiBinderCustomCompView view = instance.bind(UiBinderCustomCompView.class, new Locale("en"), null); assertNotNull("custom comp has not been added to the view", view.customComp); assertNotNull("custom comp content not added", view.customComp.getContent()); a... | public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintException("Fail... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... |
@Test public void testBindNestedComponents() throws UiBinderException { UiBinderView root = instance.bind(UiBinderView.class, new Locale("en"), null); assertNotNull("component is null", root); boolean isPanel = root instanceof Panel; assertTrue("not a panel", isPanel); Panel panel = (Panel) root; Component layout = pan... | public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintException("Fail... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... | UiBinder { public <T extends Component> T bind(Class<T> viewClass, Locale locale, IEventBinder eventBinder) throws UiBinderException { try { T view = (T) viewClass.newInstance(); view = bind(viewClass.getName(), view, locale, eventBinder); return (T) view; } catch (InstantiationException e) { throw new UiConstraintExce... |
@Test public void testBasicDeserialization() throws Exception { Event event = create("type", "id", 0) .attr("key", "value") .attr("key1", "valu1") .build(); String json = objectMapper.writeValueAsString(event); Event actualEntity = objectMapper.readValue(json, Event.class); assertEquals(actualEntity.getId(), event.getI... | @Override public BaseEvent build(EventBuilder entityBuilder) { return (BaseEvent) entityBuilder.build(); } | EventDeserializer extends AbstractAttributeStoreDeserializer<BaseEvent, EventBuilder> { @Override public BaseEvent build(EventBuilder entityBuilder) { return (BaseEvent) entityBuilder.build(); } } | EventDeserializer extends AbstractAttributeStoreDeserializer<BaseEvent, EventBuilder> { @Override public BaseEvent build(EventBuilder entityBuilder) { return (BaseEvent) entityBuilder.build(); } } | EventDeserializer extends AbstractAttributeStoreDeserializer<BaseEvent, EventBuilder> { @Override public BaseEvent build(EventBuilder entityBuilder) { return (BaseEvent) entityBuilder.build(); } @Override EventBuilder deserialize(JsonNode root); @Override BaseEvent build(EventBuilder entityBuilder); } | EventDeserializer extends AbstractAttributeStoreDeserializer<BaseEvent, EventBuilder> { @Override public BaseEvent build(EventBuilder entityBuilder) { return (BaseEvent) entityBuilder.build(); } @Override EventBuilder deserialize(JsonNode root); @Override BaseEvent build(EventBuilder entityBuilder); } |
@Test public void testLimit() { CloseableIterator<Integer> firstThree = limit(testIterator(), 3); assertTrue(elementsEqual(asList(1, 2, 3).iterator(), firstThree)); assertFalse(firstThree.hasNext()); firstThree.close(); } | public static <T> CloseableIterator<T> limit(final CloseableIterator<T> iterator, final int limitSize) { return wrap(Iterators.limit(iterator, limitSize), iterator); } | CloseableIterators { public static <T> CloseableIterator<T> limit(final CloseableIterator<T> iterator, final int limitSize) { return wrap(Iterators.limit(iterator, limitSize), iterator); } } | CloseableIterators { public static <T> CloseableIterator<T> limit(final CloseableIterator<T> iterator, final int limitSize) { return wrap(Iterators.limit(iterator, limitSize), iterator); } private CloseableIterators(); } | CloseableIterators { public static <T> CloseableIterator<T> limit(final CloseableIterator<T> iterator, final int limitSize) { return wrap(Iterators.limit(iterator, limitSize), iterator); } private CloseableIterators(); static CloseableIterator<T> fromStream(Stream<T> stream); static CloseableIterator<T> fromIterator(I... | CloseableIterators { public static <T> CloseableIterator<T> limit(final CloseableIterator<T> iterator, final int limitSize) { return wrap(Iterators.limit(iterator, limitSize), iterator); } private CloseableIterators(); static CloseableIterator<T> fromStream(Stream<T> stream); static CloseableIterator<T> fromIterator(I... |
@Test public void testFilter() { CloseableIterator<Integer> odd = filter(testIterator(), input -> input % 2 == 0); assertTrue(elementsEqual(asList(2, 4).iterator(), odd)); assertFalse(odd.hasNext()); odd.close(); } | public static <T> CloseableIterator<T> filter(final CloseableIterator<T> iterator, final Predicate<T> filter) { return wrap(Iterators.filter(iterator, filter::test), iterator); } | CloseableIterators { public static <T> CloseableIterator<T> filter(final CloseableIterator<T> iterator, final Predicate<T> filter) { return wrap(Iterators.filter(iterator, filter::test), iterator); } } | CloseableIterators { public static <T> CloseableIterator<T> filter(final CloseableIterator<T> iterator, final Predicate<T> filter) { return wrap(Iterators.filter(iterator, filter::test), iterator); } private CloseableIterators(); } | CloseableIterators { public static <T> CloseableIterator<T> filter(final CloseableIterator<T> iterator, final Predicate<T> filter) { return wrap(Iterators.filter(iterator, filter::test), iterator); } private CloseableIterators(); static CloseableIterator<T> fromStream(Stream<T> stream); static CloseableIterator<T> fro... | CloseableIterators { public static <T> CloseableIterator<T> filter(final CloseableIterator<T> iterator, final Predicate<T> filter) { return wrap(Iterators.filter(iterator, filter::test), iterator); } private CloseableIterators(); static CloseableIterator<T> fromStream(Stream<T> stream); static CloseableIterator<T> fro... |
@Test public void testDistinct() { CloseableIterator<Integer> distinct = distinct(fromIterator(asList(1, 1, 2, 2, 3, 3, 3, 4, 5, 6, 7, 7, 7).iterator())); assertTrue(elementsEqual(asList(1, 2, 3, 4, 5, 6, 7).iterator(), distinct)); assertFalse(distinct.hasNext()); distinct.close(); } | public static <T> CloseableIterator<T> distinct(final CloseableIterator<T> iterator) { return wrap(Iterators2.distinct(iterator), iterator); } | CloseableIterators { public static <T> CloseableIterator<T> distinct(final CloseableIterator<T> iterator) { return wrap(Iterators2.distinct(iterator), iterator); } } | CloseableIterators { public static <T> CloseableIterator<T> distinct(final CloseableIterator<T> iterator) { return wrap(Iterators2.distinct(iterator), iterator); } private CloseableIterators(); } | CloseableIterators { public static <T> CloseableIterator<T> distinct(final CloseableIterator<T> iterator) { return wrap(Iterators2.distinct(iterator), iterator); } private CloseableIterators(); static CloseableIterator<T> fromStream(Stream<T> stream); static CloseableIterator<T> fromIterator(Iterator<T> iterator); sta... | CloseableIterators { public static <T> CloseableIterator<T> distinct(final CloseableIterator<T> iterator) { return wrap(Iterators2.distinct(iterator), iterator); } private CloseableIterators(); static CloseableIterator<T> fromStream(Stream<T> stream); static CloseableIterator<T> fromIterator(Iterator<T> iterator); sta... |
@SuppressWarnings({"unchecked", "rawtypes"}) @Test public void testChain() { CloseableIterator iterator = chain(emptyIterator(), emptyIterator(), emptyIterator()); assertFalse(iterator.hasNext()); try { iterator.next(); fail(); } catch (NoSuchElementException ignored) { } iterator.close(); iterator = chain(fromIterator... | @SafeVarargs public static <T> CloseableIterator<T> chain(CloseableIterator<? extends T>... iterators) { return chain(Iterators.forArray(iterators)); } | CloseableIterators { @SafeVarargs public static <T> CloseableIterator<T> chain(CloseableIterator<? extends T>... iterators) { return chain(Iterators.forArray(iterators)); } } | CloseableIterators { @SafeVarargs public static <T> CloseableIterator<T> chain(CloseableIterator<? extends T>... iterators) { return chain(Iterators.forArray(iterators)); } private CloseableIterators(); } | CloseableIterators { @SafeVarargs public static <T> CloseableIterator<T> chain(CloseableIterator<? extends T>... iterators) { return chain(Iterators.forArray(iterators)); } private CloseableIterators(); static CloseableIterator<T> fromStream(Stream<T> stream); static CloseableIterator<T> fromIterator(Iterator<T> itera... | CloseableIterators { @SafeVarargs public static <T> CloseableIterator<T> chain(CloseableIterator<? extends T>... iterators) { return chain(Iterators.forArray(iterators)); } private CloseableIterators(); static CloseableIterator<T> fromStream(Stream<T> stream); static CloseableIterator<T> fromIterator(Iterator<T> itera... |
@Test public void testAutoClose() { MockIterator<Integer> iterator = testIterator(); CloseableIterator<Integer> closeableIterator = autoClose(iterator); closeableIterator.close(); assertTrue(iterator.isClosed()); iterator = testIterator(); closeableIterator = autoClose(iterator); Iterators.size(closeableIterator); asse... | public static <T> CloseableIterator<T> autoClose(final CloseableIterator<? extends T> iterator) { requireNonNull(iterator); return new CloseableIterator<T>() { private boolean closed = false; @Override public void close() { if (closed) return; closed = true; iterator.close(); } @Override public boolean hasNext() { try ... | CloseableIterators { public static <T> CloseableIterator<T> autoClose(final CloseableIterator<? extends T> iterator) { requireNonNull(iterator); return new CloseableIterator<T>() { private boolean closed = false; @Override public void close() { if (closed) return; closed = true; iterator.close(); } @Override public boo... | CloseableIterators { public static <T> CloseableIterator<T> autoClose(final CloseableIterator<? extends T> iterator) { requireNonNull(iterator); return new CloseableIterator<T>() { private boolean closed = false; @Override public void close() { if (closed) return; closed = true; iterator.close(); } @Override public boo... | CloseableIterators { public static <T> CloseableIterator<T> autoClose(final CloseableIterator<? extends T> iterator) { requireNonNull(iterator); return new CloseableIterator<T>() { private boolean closed = false; @Override public void close() { if (closed) return; closed = true; iterator.close(); } @Override public boo... | CloseableIterators { public static <T> CloseableIterator<T> autoClose(final CloseableIterator<? extends T> iterator) { requireNonNull(iterator); return new CloseableIterator<T>() { private boolean closed = false; @Override public void close() { if (closed) return; closed = true; iterator.close(); } @Override public boo... |
@Test public void testCloseEmptyMultipleTimes() { CloseableIterable<Integer> iterable = CloseableIterables.emptyIterable(); iterable.iterator(); iterable.closeQuietly(); iterable = CloseableIterables.emptyIterable(); iterable.iterator(); iterable.closeQuietly(); } | @SuppressWarnings("unchecked") public static <T> CloseableIterable<T> emptyIterable() { return EMPTY_ITERABLE; } | CloseableIterables { @SuppressWarnings("unchecked") public static <T> CloseableIterable<T> emptyIterable() { return EMPTY_ITERABLE; } } | CloseableIterables { @SuppressWarnings("unchecked") public static <T> CloseableIterable<T> emptyIterable() { return EMPTY_ITERABLE; } private CloseableIterables(); } | CloseableIterables { @SuppressWarnings("unchecked") public static <T> CloseableIterable<T> emptyIterable() { return EMPTY_ITERABLE; } private CloseableIterables(); static CloseableIterable<T> fromStream(Stream<T> stream); static CloseableIterable<T> fromIterable(Iterable<T> iterable); static CloseableIterable<T> disti... | CloseableIterables { @SuppressWarnings("unchecked") public static <T> CloseableIterable<T> emptyIterable() { return EMPTY_ITERABLE; } private CloseableIterables(); static CloseableIterable<T> fromStream(Stream<T> stream); static CloseableIterable<T> fromIterable(Iterable<T> iterable); static CloseableIterable<T> disti... |
@Test public void testWrap() { CloseableIterable<Integer> wrapped = CloseableIterables.fromIterable(asList(1, 2, 3, 4, 5)); assertTrue(elementsEqual(asList(1, 2, 3, 4, 5), wrapped)); wrapped.close(); try { wrapped.iterator(); fail(); } catch (IllegalStateException ignored) { } } | @Deprecated public static <T> CloseableIterable<T> wrap(final Iterable<T> iterable) { return fromIterable(iterable); } | CloseableIterables { @Deprecated public static <T> CloseableIterable<T> wrap(final Iterable<T> iterable) { return fromIterable(iterable); } } | CloseableIterables { @Deprecated public static <T> CloseableIterable<T> wrap(final Iterable<T> iterable) { return fromIterable(iterable); } private CloseableIterables(); } | CloseableIterables { @Deprecated public static <T> CloseableIterable<T> wrap(final Iterable<T> iterable) { return fromIterable(iterable); } private CloseableIterables(); static CloseableIterable<T> fromStream(Stream<T> stream); static CloseableIterable<T> fromIterable(Iterable<T> iterable); static CloseableIterable<T>... | CloseableIterables { @Deprecated public static <T> CloseableIterable<T> wrap(final Iterable<T> iterable) { return fromIterable(iterable); } private CloseableIterables(); static CloseableIterable<T> fromStream(Stream<T> stream); static CloseableIterable<T> fromIterable(Iterable<T> iterable); static CloseableIterable<T>... |
@Test public void testTransform() { CloseableIterable<Integer> addOne = transform(testIterable(), input -> input + 1); CloseableIterable<Integer> multTen = transform(addOne, input -> input * 10); assertTrue(elementsEqual(asList(20, 30, 40, 50, 60), multTen)); multTen.close(); try { multTen.iterator(); fail(); } catch (... | public static <F, T> CloseableIterable<T> transform(final CloseableIterable<F> iterable, final Function<? super F, ? extends T> function) { return wrap(Iterables.transform(iterable, function::apply), iterable); } | CloseableIterables { public static <F, T> CloseableIterable<T> transform(final CloseableIterable<F> iterable, final Function<? super F, ? extends T> function) { return wrap(Iterables.transform(iterable, function::apply), iterable); } } | CloseableIterables { public static <F, T> CloseableIterable<T> transform(final CloseableIterable<F> iterable, final Function<? super F, ? extends T> function) { return wrap(Iterables.transform(iterable, function::apply), iterable); } private CloseableIterables(); } | CloseableIterables { public static <F, T> CloseableIterable<T> transform(final CloseableIterable<F> iterable, final Function<? super F, ? extends T> function) { return wrap(Iterables.transform(iterable, function::apply), iterable); } private CloseableIterables(); static CloseableIterable<T> fromStream(Stream<T> stream... | CloseableIterables { public static <F, T> CloseableIterable<T> transform(final CloseableIterable<F> iterable, final Function<? super F, ? extends T> function) { return wrap(Iterables.transform(iterable, function::apply), iterable); } private CloseableIterables(); static CloseableIterable<T> fromStream(Stream<T> stream... |
@Test public void testLimit() { CloseableIterable<Integer> firstThree = limit(testIterable(), 3); assertEquals(3, Iterables.size(firstThree)); assertTrue(elementsEqual(asList(1, 2, 3), firstThree)); firstThree.close(); try { firstThree.iterator(); fail(); } catch (IllegalStateException ignored) { } } | public static <T> CloseableIterable<T> limit(final CloseableIterable<T> iterable, final int limitSize) { return wrap(Iterables.limit(iterable, limitSize), iterable); } | CloseableIterables { public static <T> CloseableIterable<T> limit(final CloseableIterable<T> iterable, final int limitSize) { return wrap(Iterables.limit(iterable, limitSize), iterable); } } | CloseableIterables { public static <T> CloseableIterable<T> limit(final CloseableIterable<T> iterable, final int limitSize) { return wrap(Iterables.limit(iterable, limitSize), iterable); } private CloseableIterables(); } | CloseableIterables { public static <T> CloseableIterable<T> limit(final CloseableIterable<T> iterable, final int limitSize) { return wrap(Iterables.limit(iterable, limitSize), iterable); } private CloseableIterables(); static CloseableIterable<T> fromStream(Stream<T> stream); static CloseableIterable<T> fromIterable(I... | CloseableIterables { public static <T> CloseableIterable<T> limit(final CloseableIterable<T> iterable, final int limitSize) { return wrap(Iterables.limit(iterable, limitSize), iterable); } private CloseableIterables(); static CloseableIterable<T> fromStream(Stream<T> stream); static CloseableIterable<T> fromIterable(I... |
@Test public void testFilter() { CloseableIterable<Integer> odd = filter(testIterable(), input -> input % 2 == 0); assertTrue(elementsEqual(asList(2, 4), odd)); odd.close(); try { odd.iterator(); fail(); } catch (IllegalStateException ignored) { } } | public static <T> CloseableIterable<T> filter(final CloseableIterable<?> iterable, final Class<T> type) { return wrap(Iterables.filter(iterable, type), iterable); } | CloseableIterables { public static <T> CloseableIterable<T> filter(final CloseableIterable<?> iterable, final Class<T> type) { return wrap(Iterables.filter(iterable, type), iterable); } } | CloseableIterables { public static <T> CloseableIterable<T> filter(final CloseableIterable<?> iterable, final Class<T> type) { return wrap(Iterables.filter(iterable, type), iterable); } private CloseableIterables(); } | CloseableIterables { public static <T> CloseableIterable<T> filter(final CloseableIterable<?> iterable, final Class<T> type) { return wrap(Iterables.filter(iterable, type), iterable); } private CloseableIterables(); static CloseableIterable<T> fromStream(Stream<T> stream); static CloseableIterable<T> fromIterable(Iter... | CloseableIterables { public static <T> CloseableIterable<T> filter(final CloseableIterable<?> iterable, final Class<T> type) { return wrap(Iterables.filter(iterable, type), iterable); } private CloseableIterables(); static CloseableIterable<T> fromStream(Stream<T> stream); static CloseableIterable<T> fromIterable(Iter... |
@Test public void testBasicDeserialization2() throws Exception { Event event = create("type", "id", currentTimeMillis()) .attr("key", "value") .attr("key1", "valu1") .build(); String json = objectMapper.writeValueAsString(event); Event actualEntity = objectMapper.readValue(json, Event.class); assertEquals(actualEntity.... | @Override public BaseEvent build(EventBuilder entityBuilder) { return (BaseEvent) entityBuilder.build(); } | EventDeserializer extends AbstractAttributeStoreDeserializer<BaseEvent, EventBuilder> { @Override public BaseEvent build(EventBuilder entityBuilder) { return (BaseEvent) entityBuilder.build(); } } | EventDeserializer extends AbstractAttributeStoreDeserializer<BaseEvent, EventBuilder> { @Override public BaseEvent build(EventBuilder entityBuilder) { return (BaseEvent) entityBuilder.build(); } } | EventDeserializer extends AbstractAttributeStoreDeserializer<BaseEvent, EventBuilder> { @Override public BaseEvent build(EventBuilder entityBuilder) { return (BaseEvent) entityBuilder.build(); } @Override EventBuilder deserialize(JsonNode root); @Override BaseEvent build(EventBuilder entityBuilder); } | EventDeserializer extends AbstractAttributeStoreDeserializer<BaseEvent, EventBuilder> { @Override public BaseEvent build(EventBuilder entityBuilder) { return (BaseEvent) entityBuilder.build(); } @Override EventBuilder deserialize(JsonNode root); @Override BaseEvent build(EventBuilder entityBuilder); } |
@Test public void testDistinct() { CloseableIterable<Integer> distinct = distinct(fromIterable(asList(1, 1, 2, 2, 3, 3, 3, 4, 5, 6, 7, 7, 7))); assertEquals(7, Iterables.size(distinct)); assertTrue(elementsEqual(asList(1, 2, 3, 4, 5, 6, 7), distinct)); distinct.close(); try { distinct.iterator(); fail(); } catch (Illeg... | public static <T> CloseableIterable<T> distinct(final CloseableIterable<T> iterable) { return wrap(Iterables2.distinct(iterable), iterable); } | CloseableIterables { public static <T> CloseableIterable<T> distinct(final CloseableIterable<T> iterable) { return wrap(Iterables2.distinct(iterable), iterable); } } | CloseableIterables { public static <T> CloseableIterable<T> distinct(final CloseableIterable<T> iterable) { return wrap(Iterables2.distinct(iterable), iterable); } private CloseableIterables(); } | CloseableIterables { public static <T> CloseableIterable<T> distinct(final CloseableIterable<T> iterable) { return wrap(Iterables2.distinct(iterable), iterable); } private CloseableIterables(); static CloseableIterable<T> fromStream(Stream<T> stream); static CloseableIterable<T> fromIterable(Iterable<T> iterable); sta... | CloseableIterables { public static <T> CloseableIterable<T> distinct(final CloseableIterable<T> iterable) { return wrap(Iterables2.distinct(iterable), iterable); } private CloseableIterables(); static CloseableIterable<T> fromStream(Stream<T> stream); static CloseableIterable<T> fromIterable(Iterable<T> iterable); sta... |
@Test public void testAutoClose() { MockIterable<Integer> iterable = testIterable(); CloseableIterable<Integer> closeableIterable = autoClose(iterable); closeableIterable.close(); assertTrue(iterable.isClosed()); iterable = testIterable(); closeableIterable = autoClose(iterable); Iterator<Integer> iterator = closeableI... | public static <T> CloseableIterable<T> autoClose(final CloseableIterable<? extends T> iterable) { requireNonNull(iterable); return new FluentCloseableIterable<T>() { @Override protected void doClose() { iterable.close(); } @Override protected Iterator<T> retrieveIterator() { return CloseableIterators.autoClose( Closeab... | CloseableIterables { public static <T> CloseableIterable<T> autoClose(final CloseableIterable<? extends T> iterable) { requireNonNull(iterable); return new FluentCloseableIterable<T>() { @Override protected void doClose() { iterable.close(); } @Override protected Iterator<T> retrieveIterator() { return CloseableIterato... | CloseableIterables { public static <T> CloseableIterable<T> autoClose(final CloseableIterable<? extends T> iterable) { requireNonNull(iterable); return new FluentCloseableIterable<T>() { @Override protected void doClose() { iterable.close(); } @Override protected Iterator<T> retrieveIterator() { return CloseableIterato... | CloseableIterables { public static <T> CloseableIterable<T> autoClose(final CloseableIterable<? extends T> iterable) { requireNonNull(iterable); return new FluentCloseableIterable<T>() { @Override protected void doClose() { iterable.close(); } @Override protected Iterator<T> retrieveIterator() { return CloseableIterato... | CloseableIterables { public static <T> CloseableIterable<T> autoClose(final CloseableIterable<? extends T> iterable) { requireNonNull(iterable); return new FluentCloseableIterable<T>() { @Override protected void doClose() { iterable.close(); } @Override protected Iterator<T> retrieveIterator() { return CloseableIterato... |
@Test public void testLimit() { CloseableIterable<Integer> closeableIterable = fromIterable(asList(1, 2, 3, 4, 5)); FluentCloseableIterable<Integer> limit = FluentCloseableIterable. from(closeableIterable).limit(3); assertEquals(3, Iterables.size(limit)); limit.close(); } | public final FluentCloseableIterable<T> limit(int size) { return from(CloseableIterables.limit(this, size)); } | FluentCloseableIterable extends AbstractCloseableIterable<T> { public final FluentCloseableIterable<T> limit(int size) { return from(CloseableIterables.limit(this, size)); } } | FluentCloseableIterable extends AbstractCloseableIterable<T> { public final FluentCloseableIterable<T> limit(int size) { return from(CloseableIterables.limit(this, size)); } protected FluentCloseableIterable(); } | FluentCloseableIterable extends AbstractCloseableIterable<T> { public final FluentCloseableIterable<T> limit(int size) { return from(CloseableIterables.limit(this, size)); } protected FluentCloseableIterable(); static FluentCloseableIterable<E> from(final CloseableIterable<E> iterable); final FluentCloseableIterable<T... | FluentCloseableIterable extends AbstractCloseableIterable<T> { public final FluentCloseableIterable<T> limit(int size) { return from(CloseableIterables.limit(this, size)); } protected FluentCloseableIterable(); static FluentCloseableIterable<E> from(final CloseableIterable<E> iterable); final FluentCloseableIterable<T... |
@Test public void distinctTest() throws Exception { Iterator<Integer> distinct = distinct(asList(1, 1, 2, 2, 3, 3, 3, 4, 5, 6, 7, 7, 7).iterator()); assertTrue(elementsEqual(asList(1, 2, 3, 4, 5, 6, 7).iterator(), distinct)); assertFalse(distinct.hasNext()); } | public static <T> Iterator<T> distinct(final Iterator<T> iterator) { requireNonNull(iterator); return new AbstractIterator<T>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator); private T curr = null; @Override protected T computeNext() { while (peekingIterator.hasNext() && Objects.equals(... | Iterators2 { public static <T> Iterator<T> distinct(final Iterator<T> iterator) { requireNonNull(iterator); return new AbstractIterator<T>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator); private T curr = null; @Override protected T computeNext() { while (peekingIterator.hasNext() && Ob... | Iterators2 { public static <T> Iterator<T> distinct(final Iterator<T> iterator) { requireNonNull(iterator); return new AbstractIterator<T>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator); private T curr = null; @Override protected T computeNext() { while (peekingIterator.hasNext() && Ob... | Iterators2 { public static <T> Iterator<T> distinct(final Iterator<T> iterator) { requireNonNull(iterator); return new AbstractIterator<T>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator); private T curr = null; @Override protected T computeNext() { while (peekingIterator.hasNext() && Ob... | Iterators2 { public static <T> Iterator<T> distinct(final Iterator<T> iterator) { requireNonNull(iterator); return new AbstractIterator<T>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator); private T curr = null; @Override protected T computeNext() { while (peekingIterator.hasNext() && Ob... |
@Test(expected = NullPointerException.class) public void distinctNullIteratorTest() { distinct(null); } | public static <T> Iterator<T> distinct(final Iterator<T> iterator) { requireNonNull(iterator); return new AbstractIterator<T>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator); private T curr = null; @Override protected T computeNext() { while (peekingIterator.hasNext() && Objects.equals(... | Iterators2 { public static <T> Iterator<T> distinct(final Iterator<T> iterator) { requireNonNull(iterator); return new AbstractIterator<T>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator); private T curr = null; @Override protected T computeNext() { while (peekingIterator.hasNext() && Ob... | Iterators2 { public static <T> Iterator<T> distinct(final Iterator<T> iterator) { requireNonNull(iterator); return new AbstractIterator<T>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator); private T curr = null; @Override protected T computeNext() { while (peekingIterator.hasNext() && Ob... | Iterators2 { public static <T> Iterator<T> distinct(final Iterator<T> iterator) { requireNonNull(iterator); return new AbstractIterator<T>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator); private T curr = null; @Override protected T computeNext() { while (peekingIterator.hasNext() && Ob... | Iterators2 { public static <T> Iterator<T> distinct(final Iterator<T> iterator) { requireNonNull(iterator); return new AbstractIterator<T>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator); private T curr = null; @Override protected T computeNext() { while (peekingIterator.hasNext() && Ob... |
@Test public void groupByTest() { List<Integer> testdata = asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); Iterator<List<Integer>> grouped = groupBy(testdata.iterator(), input -> input / 5); assertTrue(grouped.hasNext()); assertEquals(asList(0, 1, 2, 3, 4), grouped.next()); assertEquals(asList(5, 6, 7, 8, 9), grouped.next()); as... | public static <T> Iterator<List<T>> groupBy(final Iterator<? extends T> iterator, final Function<? super T, ?> groupingFunction) { requireNonNull(iterator); requireNonNull(groupingFunction); return new AbstractIterator<List<T>>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator); @Override ... | Iterators2 { public static <T> Iterator<List<T>> groupBy(final Iterator<? extends T> iterator, final Function<? super T, ?> groupingFunction) { requireNonNull(iterator); requireNonNull(groupingFunction); return new AbstractIterator<List<T>>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator... | Iterators2 { public static <T> Iterator<List<T>> groupBy(final Iterator<? extends T> iterator, final Function<? super T, ?> groupingFunction) { requireNonNull(iterator); requireNonNull(groupingFunction); return new AbstractIterator<List<T>>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator... | Iterators2 { public static <T> Iterator<List<T>> groupBy(final Iterator<? extends T> iterator, final Function<? super T, ?> groupingFunction) { requireNonNull(iterator); requireNonNull(groupingFunction); return new AbstractIterator<List<T>>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator... | Iterators2 { public static <T> Iterator<List<T>> groupBy(final Iterator<? extends T> iterator, final Function<? super T, ?> groupingFunction) { requireNonNull(iterator); requireNonNull(groupingFunction); return new AbstractIterator<List<T>>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator... |
@Test(expected = NullPointerException.class) public void groupByNullIteratorTest() { groupBy(null, input -> null); } | public static <T> Iterator<List<T>> groupBy(final Iterator<? extends T> iterator, final Function<? super T, ?> groupingFunction) { requireNonNull(iterator); requireNonNull(groupingFunction); return new AbstractIterator<List<T>>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator); @Override ... | Iterators2 { public static <T> Iterator<List<T>> groupBy(final Iterator<? extends T> iterator, final Function<? super T, ?> groupingFunction) { requireNonNull(iterator); requireNonNull(groupingFunction); return new AbstractIterator<List<T>>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator... | Iterators2 { public static <T> Iterator<List<T>> groupBy(final Iterator<? extends T> iterator, final Function<? super T, ?> groupingFunction) { requireNonNull(iterator); requireNonNull(groupingFunction); return new AbstractIterator<List<T>>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator... | Iterators2 { public static <T> Iterator<List<T>> groupBy(final Iterator<? extends T> iterator, final Function<? super T, ?> groupingFunction) { requireNonNull(iterator); requireNonNull(groupingFunction); return new AbstractIterator<List<T>>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator... | Iterators2 { public static <T> Iterator<List<T>> groupBy(final Iterator<? extends T> iterator, final Function<? super T, ?> groupingFunction) { requireNonNull(iterator); requireNonNull(groupingFunction); return new AbstractIterator<List<T>>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator... |
@Test(expected = NullPointerException.class) public void groupByNullEquivTest() { groupBy(emptyIterator(), null); } | public static <T> Iterator<List<T>> groupBy(final Iterator<? extends T> iterator, final Function<? super T, ?> groupingFunction) { requireNonNull(iterator); requireNonNull(groupingFunction); return new AbstractIterator<List<T>>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator); @Override ... | Iterators2 { public static <T> Iterator<List<T>> groupBy(final Iterator<? extends T> iterator, final Function<? super T, ?> groupingFunction) { requireNonNull(iterator); requireNonNull(groupingFunction); return new AbstractIterator<List<T>>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator... | Iterators2 { public static <T> Iterator<List<T>> groupBy(final Iterator<? extends T> iterator, final Function<? super T, ?> groupingFunction) { requireNonNull(iterator); requireNonNull(groupingFunction); return new AbstractIterator<List<T>>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator... | Iterators2 { public static <T> Iterator<List<T>> groupBy(final Iterator<? extends T> iterator, final Function<? super T, ?> groupingFunction) { requireNonNull(iterator); requireNonNull(groupingFunction); return new AbstractIterator<List<T>>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator... | Iterators2 { public static <T> Iterator<List<T>> groupBy(final Iterator<? extends T> iterator, final Function<? super T, ?> groupingFunction) { requireNonNull(iterator); requireNonNull(groupingFunction); return new AbstractIterator<List<T>>() { private final PeekingIterator<T> peekingIterator = peekingIterator(iterator... |
@Test public void forStringTest() { InetAddress address; address = MoreInetAddresses.forString("1.2.3.4"); assertTrue(address instanceof Inet4Address); assertEquals("1.2.3.4", toAddrString(address)); address = MoreInetAddresses.forString("::1.2.3.4"); assertTrue(address instanceof Inet6Address); assertEquals("::102:304... | public static InetAddress forString(String ipString) { requireNonNull(ipString); InetAddress address = InetAddresses.forString(ipString); if (address instanceof Inet4Address && ipString.contains(":")) return getIPv4MappedIPv6Address((Inet4Address) address); return address; } | MoreInetAddresses { public static InetAddress forString(String ipString) { requireNonNull(ipString); InetAddress address = InetAddresses.forString(ipString); if (address instanceof Inet4Address && ipString.contains(":")) return getIPv4MappedIPv6Address((Inet4Address) address); return address; } } | MoreInetAddresses { public static InetAddress forString(String ipString) { requireNonNull(ipString); InetAddress address = InetAddresses.forString(ipString); if (address instanceof Inet4Address && ipString.contains(":")) return getIPv4MappedIPv6Address((Inet4Address) address); return address; } private MoreInetAddress... | MoreInetAddresses { public static InetAddress forString(String ipString) { requireNonNull(ipString); InetAddress address = InetAddresses.forString(ipString); if (address instanceof Inet4Address && ipString.contains(":")) return getIPv4MappedIPv6Address((Inet4Address) address); return address; } private MoreInetAddress... | MoreInetAddresses { public static InetAddress forString(String ipString) { requireNonNull(ipString); InetAddress address = InetAddresses.forString(ipString); if (address instanceof Inet4Address && ipString.contains(":")) return getIPv4MappedIPv6Address((Inet4Address) address); return address; } private MoreInetAddress... |
@Test(expected = NullPointerException.class) public void forStringNullTest() { MoreInetAddresses.forString(null); } | public static InetAddress forString(String ipString) { requireNonNull(ipString); InetAddress address = InetAddresses.forString(ipString); if (address instanceof Inet4Address && ipString.contains(":")) return getIPv4MappedIPv6Address((Inet4Address) address); return address; } | MoreInetAddresses { public static InetAddress forString(String ipString) { requireNonNull(ipString); InetAddress address = InetAddresses.forString(ipString); if (address instanceof Inet4Address && ipString.contains(":")) return getIPv4MappedIPv6Address((Inet4Address) address); return address; } } | MoreInetAddresses { public static InetAddress forString(String ipString) { requireNonNull(ipString); InetAddress address = InetAddresses.forString(ipString); if (address instanceof Inet4Address && ipString.contains(":")) return getIPv4MappedIPv6Address((Inet4Address) address); return address; } private MoreInetAddress... | MoreInetAddresses { public static InetAddress forString(String ipString) { requireNonNull(ipString); InetAddress address = InetAddresses.forString(ipString); if (address instanceof Inet4Address && ipString.contains(":")) return getIPv4MappedIPv6Address((Inet4Address) address); return address; } private MoreInetAddress... | MoreInetAddresses { public static InetAddress forString(String ipString) { requireNonNull(ipString); InetAddress address = InetAddresses.forString(ipString); if (address instanceof Inet4Address && ipString.contains(":")) return getIPv4MappedIPv6Address((Inet4Address) address); return address; } private MoreInetAddress... |
@Test public void testBasicDeserialization() throws Exception { Entity entity = create("type", "id") .attr("key", "value") .build(); String json = objectMapper.writeValueAsString(entity); Entity actualEntity = objectMapper.readValue(json, Entity.class); assertEquals(actualEntity.getType(), entity.getType()); assertEqua... | @Override public BaseEntity build(EntityBuilder entityBuilder) { return (BaseEntity)entityBuilder.build(); } | EntityDeserializer extends AbstractAttributeStoreDeserializer<BaseEntity, EntityBuilder> { @Override public BaseEntity build(EntityBuilder entityBuilder) { return (BaseEntity)entityBuilder.build(); } } | EntityDeserializer extends AbstractAttributeStoreDeserializer<BaseEntity, EntityBuilder> { @Override public BaseEntity build(EntityBuilder entityBuilder) { return (BaseEntity)entityBuilder.build(); } } | EntityDeserializer extends AbstractAttributeStoreDeserializer<BaseEntity, EntityBuilder> { @Override public BaseEntity build(EntityBuilder entityBuilder) { return (BaseEntity)entityBuilder.build(); } @Override EntityBuilder deserialize(JsonNode root); @Override BaseEntity build(EntityBuilder entityBuilder); } | EntityDeserializer extends AbstractAttributeStoreDeserializer<BaseEntity, EntityBuilder> { @Override public BaseEntity build(EntityBuilder entityBuilder) { return (BaseEntity)entityBuilder.build(); } @Override EntityBuilder deserialize(JsonNode root); @Override BaseEntity build(EntityBuilder entityBuilder); } |
@Test public void forIpv4StringTest() { Inet4Address address; address = forIPv4String("1.2.3.4"); assertEquals("1.2.3.4", toAddrString(address)); } | public static Inet4Address forIPv4String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet4Address) return (Inet4Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv4 representation: %s", ipString)); } | MoreInetAddresses { public static Inet4Address forIPv4String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet4Address) return (Inet4Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv4 representation: ... | MoreInetAddresses { public static Inet4Address forIPv4String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet4Address) return (Inet4Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv4 representation: ... | MoreInetAddresses { public static Inet4Address forIPv4String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet4Address) return (Inet4Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv4 representation: ... | MoreInetAddresses { public static Inet4Address forIPv4String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet4Address) return (Inet4Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv4 representation: ... |
@Test(expected = NullPointerException.class) public void forIpv4StringNullTest() { forIPv4String(null); } | public static Inet4Address forIPv4String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet4Address) return (Inet4Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv4 representation: %s", ipString)); } | MoreInetAddresses { public static Inet4Address forIPv4String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet4Address) return (Inet4Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv4 representation: ... | MoreInetAddresses { public static Inet4Address forIPv4String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet4Address) return (Inet4Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv4 representation: ... | MoreInetAddresses { public static Inet4Address forIPv4String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet4Address) return (Inet4Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv4 representation: ... | MoreInetAddresses { public static Inet4Address forIPv4String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet4Address) return (Inet4Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv4 representation: ... |
@Test(expected = IllegalArgumentException.class) public void forIpv4StringWithIpv6Test() { forIPv4String("::1.2.3.4"); } | public static Inet4Address forIPv4String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet4Address) return (Inet4Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv4 representation: %s", ipString)); } | MoreInetAddresses { public static Inet4Address forIPv4String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet4Address) return (Inet4Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv4 representation: ... | MoreInetAddresses { public static Inet4Address forIPv4String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet4Address) return (Inet4Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv4 representation: ... | MoreInetAddresses { public static Inet4Address forIPv4String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet4Address) return (Inet4Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv4 representation: ... | MoreInetAddresses { public static Inet4Address forIPv4String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet4Address) return (Inet4Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv4 representation: ... |
@Test(expected = IllegalArgumentException.class) public void forIpv4StringWithMappedIpv4Test() { forIPv4String("::ffff:1.2.3.4"); } | public static Inet4Address forIPv4String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet4Address) return (Inet4Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv4 representation: %s", ipString)); } | MoreInetAddresses { public static Inet4Address forIPv4String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet4Address) return (Inet4Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv4 representation: ... | MoreInetAddresses { public static Inet4Address forIPv4String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet4Address) return (Inet4Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv4 representation: ... | MoreInetAddresses { public static Inet4Address forIPv4String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet4Address) return (Inet4Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv4 representation: ... | MoreInetAddresses { public static Inet4Address forIPv4String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet4Address) return (Inet4Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv4 representation: ... |
@Test public void forIpv6StringTest() { Inet6Address address; address = forIPv6String("::1.2.3.4"); assertEquals("::102:304", toAddrString(address)); address = forIPv6String("::ffff:1.2.3.4"); assertEquals("::ffff:102:304", toAddrString(address)); } | public static Inet6Address forIPv6String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet6Address) return (Inet6Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv6 representation: %s", ipString)); } | MoreInetAddresses { public static Inet6Address forIPv6String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet6Address) return (Inet6Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv6 representation: ... | MoreInetAddresses { public static Inet6Address forIPv6String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet6Address) return (Inet6Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv6 representation: ... | MoreInetAddresses { public static Inet6Address forIPv6String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet6Address) return (Inet6Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv6 representation: ... | MoreInetAddresses { public static Inet6Address forIPv6String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet6Address) return (Inet6Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv6 representation: ... |
@Test(expected = NullPointerException.class) public void forIpv6StringNullTest() { forIPv6String(null); } | public static Inet6Address forIPv6String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet6Address) return (Inet6Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv6 representation: %s", ipString)); } | MoreInetAddresses { public static Inet6Address forIPv6String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet6Address) return (Inet6Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv6 representation: ... | MoreInetAddresses { public static Inet6Address forIPv6String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet6Address) return (Inet6Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv6 representation: ... | MoreInetAddresses { public static Inet6Address forIPv6String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet6Address) return (Inet6Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv6 representation: ... | MoreInetAddresses { public static Inet6Address forIPv6String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet6Address) return (Inet6Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv6 representation: ... |
@Test(expected = IllegalArgumentException.class) public void forIpv6StringWithIpv4Test() { forIPv6String("1.2.3.4"); } | public static Inet6Address forIPv6String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet6Address) return (Inet6Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv6 representation: %s", ipString)); } | MoreInetAddresses { public static Inet6Address forIPv6String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet6Address) return (Inet6Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv6 representation: ... | MoreInetAddresses { public static Inet6Address forIPv6String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet6Address) return (Inet6Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv6 representation: ... | MoreInetAddresses { public static Inet6Address forIPv6String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet6Address) return (Inet6Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv6 representation: ... | MoreInetAddresses { public static Inet6Address forIPv6String(String ipString) { requireNonNull(ipString); try{ InetAddress parsed = forString(ipString); if (parsed instanceof Inet6Address) return (Inet6Address) parsed; } catch(Exception ignored){} throw new IllegalArgumentException(format("Invalid IPv6 representation: ... |
@Test public void isMappedIPv4AddressTest() throws UnknownHostException { byte[] bytes = new byte[]{ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, (byte) 0xff, (byte) 0xff, 0x1, 0x2, 0x3, 0x4 }; Inet6Address address = Inet6Address.getByAddress(null, bytes, -1); assertTrue(MoreInetAddresses.isMappedIPv4Address(addre... | public static boolean isMappedIPv4Address(Inet6Address ip) { byte bytes[] = ip.getAddress(); return ((bytes[0] == 0x00) && (bytes[1] == 0x00) && (bytes[2] == 0x00) && (bytes[3] == 0x00) && (bytes[4] == 0x00) && (bytes[5] == 0x00) && (bytes[6] == 0x00) && (bytes[7] == 0x00) && (bytes[8] == 0x00) && (bytes[9] == 0x00) &&... | MoreInetAddresses { public static boolean isMappedIPv4Address(Inet6Address ip) { byte bytes[] = ip.getAddress(); return ((bytes[0] == 0x00) && (bytes[1] == 0x00) && (bytes[2] == 0x00) && (bytes[3] == 0x00) && (bytes[4] == 0x00) && (bytes[5] == 0x00) && (bytes[6] == 0x00) && (bytes[7] == 0x00) && (bytes[8] == 0x00) && (... | MoreInetAddresses { public static boolean isMappedIPv4Address(Inet6Address ip) { byte bytes[] = ip.getAddress(); return ((bytes[0] == 0x00) && (bytes[1] == 0x00) && (bytes[2] == 0x00) && (bytes[3] == 0x00) && (bytes[4] == 0x00) && (bytes[5] == 0x00) && (bytes[6] == 0x00) && (bytes[7] == 0x00) && (bytes[8] == 0x00) && (... | MoreInetAddresses { public static boolean isMappedIPv4Address(Inet6Address ip) { byte bytes[] = ip.getAddress(); return ((bytes[0] == 0x00) && (bytes[1] == 0x00) && (bytes[2] == 0x00) && (bytes[3] == 0x00) && (bytes[4] == 0x00) && (bytes[5] == 0x00) && (bytes[6] == 0x00) && (bytes[7] == 0x00) && (bytes[8] == 0x00) && (... | MoreInetAddresses { public static boolean isMappedIPv4Address(Inet6Address ip) { byte bytes[] = ip.getAddress(); return ((bytes[0] == 0x00) && (bytes[1] == 0x00) && (bytes[2] == 0x00) && (bytes[3] == 0x00) && (bytes[4] == 0x00) && (bytes[5] == 0x00) && (bytes[6] == 0x00) && (bytes[7] == 0x00) && (bytes[8] == 0x00) && (... |
@Test(expected = NullPointerException.class) public void isMappedIPv4AddressNullTest() { MoreInetAddresses.isMappedIPv4Address(null); } | public static boolean isMappedIPv4Address(Inet6Address ip) { byte bytes[] = ip.getAddress(); return ((bytes[0] == 0x00) && (bytes[1] == 0x00) && (bytes[2] == 0x00) && (bytes[3] == 0x00) && (bytes[4] == 0x00) && (bytes[5] == 0x00) && (bytes[6] == 0x00) && (bytes[7] == 0x00) && (bytes[8] == 0x00) && (bytes[9] == 0x00) &&... | MoreInetAddresses { public static boolean isMappedIPv4Address(Inet6Address ip) { byte bytes[] = ip.getAddress(); return ((bytes[0] == 0x00) && (bytes[1] == 0x00) && (bytes[2] == 0x00) && (bytes[3] == 0x00) && (bytes[4] == 0x00) && (bytes[5] == 0x00) && (bytes[6] == 0x00) && (bytes[7] == 0x00) && (bytes[8] == 0x00) && (... | MoreInetAddresses { public static boolean isMappedIPv4Address(Inet6Address ip) { byte bytes[] = ip.getAddress(); return ((bytes[0] == 0x00) && (bytes[1] == 0x00) && (bytes[2] == 0x00) && (bytes[3] == 0x00) && (bytes[4] == 0x00) && (bytes[5] == 0x00) && (bytes[6] == 0x00) && (bytes[7] == 0x00) && (bytes[8] == 0x00) && (... | MoreInetAddresses { public static boolean isMappedIPv4Address(Inet6Address ip) { byte bytes[] = ip.getAddress(); return ((bytes[0] == 0x00) && (bytes[1] == 0x00) && (bytes[2] == 0x00) && (bytes[3] == 0x00) && (bytes[4] == 0x00) && (bytes[5] == 0x00) && (bytes[6] == 0x00) && (bytes[7] == 0x00) && (bytes[8] == 0x00) && (... | MoreInetAddresses { public static boolean isMappedIPv4Address(Inet6Address ip) { byte bytes[] = ip.getAddress(); return ((bytes[0] == 0x00) && (bytes[1] == 0x00) && (bytes[2] == 0x00) && (bytes[3] == 0x00) && (bytes[4] == 0x00) && (bytes[5] == 0x00) && (bytes[6] == 0x00) && (bytes[7] == 0x00) && (bytes[8] == 0x00) && (... |
@Test public void getMappedIPv4AddressTest() throws UnknownHostException { byte[] bytes = new byte[]{ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, (byte) 0xff, (byte) 0xff, 0x1, 0x2, 0x3, 0x4 }; Inet6Address address = Inet6Address.getByAddress(null, bytes, -1); Inet4Address inet4Address = MoreInetAddresses.getMapp... | public static Inet4Address getMappedIPv4Address(Inet6Address ip) { if (!isMappedIPv4Address(ip)) throw new IllegalArgumentException(String.format("Address '%s' is not IPv4-mapped.", toAddrString(ip))); return getInet4Address(copyOfRange(ip.getAddress(), 12, 16)); } | MoreInetAddresses { public static Inet4Address getMappedIPv4Address(Inet6Address ip) { if (!isMappedIPv4Address(ip)) throw new IllegalArgumentException(String.format("Address '%s' is not IPv4-mapped.", toAddrString(ip))); return getInet4Address(copyOfRange(ip.getAddress(), 12, 16)); } } | MoreInetAddresses { public static Inet4Address getMappedIPv4Address(Inet6Address ip) { if (!isMappedIPv4Address(ip)) throw new IllegalArgumentException(String.format("Address '%s' is not IPv4-mapped.", toAddrString(ip))); return getInet4Address(copyOfRange(ip.getAddress(), 12, 16)); } private MoreInetAddresses(); } | MoreInetAddresses { public static Inet4Address getMappedIPv4Address(Inet6Address ip) { if (!isMappedIPv4Address(ip)) throw new IllegalArgumentException(String.format("Address '%s' is not IPv4-mapped.", toAddrString(ip))); return getInet4Address(copyOfRange(ip.getAddress(), 12, 16)); } private MoreInetAddresses(); stat... | MoreInetAddresses { public static Inet4Address getMappedIPv4Address(Inet6Address ip) { if (!isMappedIPv4Address(ip)) throw new IllegalArgumentException(String.format("Address '%s' is not IPv4-mapped.", toAddrString(ip))); return getInet4Address(copyOfRange(ip.getAddress(), 12, 16)); } private MoreInetAddresses(); stat... |
@Test public void distinctTest() throws Exception { Iterable<Integer> distinct = distinct(asList(1, 1, 2, 2, 3, 3, 3, 4, 5, 6, 7, 7, 7)); assertEquals(asList(1, 2, 3, 4, 5, 6, 7), newArrayList(distinct)); } | public static <T> Iterable<T> distinct(final Iterable<T> iterable) { requireNonNull(iterable); return () -> Iterators2.distinct(iterable.iterator()); } | Iterables2 { public static <T> Iterable<T> distinct(final Iterable<T> iterable) { requireNonNull(iterable); return () -> Iterators2.distinct(iterable.iterator()); } } | Iterables2 { public static <T> Iterable<T> distinct(final Iterable<T> iterable) { requireNonNull(iterable); return () -> Iterators2.distinct(iterable.iterator()); } private Iterables2(); } | Iterables2 { public static <T> Iterable<T> distinct(final Iterable<T> iterable) { requireNonNull(iterable); return () -> Iterators2.distinct(iterable.iterator()); } private Iterables2(); static Iterable<T> simpleIterable(final Iterable<T> iterable); static Iterable<T> distinct(final Iterable<T> iterable); static Itera... | Iterables2 { public static <T> Iterable<T> distinct(final Iterable<T> iterable) { requireNonNull(iterable); return () -> Iterators2.distinct(iterable.iterator()); } private Iterables2(); static Iterable<T> simpleIterable(final Iterable<T> iterable); static Iterable<T> distinct(final Iterable<T> iterable); static Itera... |
@Test(expected = NullPointerException.class) public void getMappedIPv4AddressNullTest() { MoreInetAddresses.getMappedIPv4Address(null); } | public static Inet4Address getMappedIPv4Address(Inet6Address ip) { if (!isMappedIPv4Address(ip)) throw new IllegalArgumentException(String.format("Address '%s' is not IPv4-mapped.", toAddrString(ip))); return getInet4Address(copyOfRange(ip.getAddress(), 12, 16)); } | MoreInetAddresses { public static Inet4Address getMappedIPv4Address(Inet6Address ip) { if (!isMappedIPv4Address(ip)) throw new IllegalArgumentException(String.format("Address '%s' is not IPv4-mapped.", toAddrString(ip))); return getInet4Address(copyOfRange(ip.getAddress(), 12, 16)); } } | MoreInetAddresses { public static Inet4Address getMappedIPv4Address(Inet6Address ip) { if (!isMappedIPv4Address(ip)) throw new IllegalArgumentException(String.format("Address '%s' is not IPv4-mapped.", toAddrString(ip))); return getInet4Address(copyOfRange(ip.getAddress(), 12, 16)); } private MoreInetAddresses(); } | MoreInetAddresses { public static Inet4Address getMappedIPv4Address(Inet6Address ip) { if (!isMappedIPv4Address(ip)) throw new IllegalArgumentException(String.format("Address '%s' is not IPv4-mapped.", toAddrString(ip))); return getInet4Address(copyOfRange(ip.getAddress(), 12, 16)); } private MoreInetAddresses(); stat... | MoreInetAddresses { public static Inet4Address getMappedIPv4Address(Inet6Address ip) { if (!isMappedIPv4Address(ip)) throw new IllegalArgumentException(String.format("Address '%s' is not IPv4-mapped.", toAddrString(ip))); return getInet4Address(copyOfRange(ip.getAddress(), 12, 16)); } private MoreInetAddresses(); stat... |
@Test(expected = IllegalArgumentException.class) public void getMappedIPv4AddressInvalidTypeTest() throws UnknownHostException { byte[] bytes = new byte[]{ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x2, 0x3, 0x4 }; Inet6Address address = Inet6Address.getByAddress(null, bytes, -1); MoreInetAddress... | public static Inet4Address getMappedIPv4Address(Inet6Address ip) { if (!isMappedIPv4Address(ip)) throw new IllegalArgumentException(String.format("Address '%s' is not IPv4-mapped.", toAddrString(ip))); return getInet4Address(copyOfRange(ip.getAddress(), 12, 16)); } | MoreInetAddresses { public static Inet4Address getMappedIPv4Address(Inet6Address ip) { if (!isMappedIPv4Address(ip)) throw new IllegalArgumentException(String.format("Address '%s' is not IPv4-mapped.", toAddrString(ip))); return getInet4Address(copyOfRange(ip.getAddress(), 12, 16)); } } | MoreInetAddresses { public static Inet4Address getMappedIPv4Address(Inet6Address ip) { if (!isMappedIPv4Address(ip)) throw new IllegalArgumentException(String.format("Address '%s' is not IPv4-mapped.", toAddrString(ip))); return getInet4Address(copyOfRange(ip.getAddress(), 12, 16)); } private MoreInetAddresses(); } | MoreInetAddresses { public static Inet4Address getMappedIPv4Address(Inet6Address ip) { if (!isMappedIPv4Address(ip)) throw new IllegalArgumentException(String.format("Address '%s' is not IPv4-mapped.", toAddrString(ip))); return getInet4Address(copyOfRange(ip.getAddress(), 12, 16)); } private MoreInetAddresses(); stat... | MoreInetAddresses { public static Inet4Address getMappedIPv4Address(Inet6Address ip) { if (!isMappedIPv4Address(ip)) throw new IllegalArgumentException(String.format("Address '%s' is not IPv4-mapped.", toAddrString(ip))); return getInet4Address(copyOfRange(ip.getAddress(), 12, 16)); } private MoreInetAddresses(); stat... |
@Test public void hasEmbeddedIPv4ClientAddressTest() { assertTrue(MoreInetAddresses.hasEmbeddedIPv4ClientAddress(forIPv6String("::ffff:1.2.3.4"))); assertTrue(MoreInetAddresses.hasEmbeddedIPv4ClientAddress(forIPv6String("::1.2.3.4"))); assertTrue(MoreInetAddresses.hasEmbeddedIPv4ClientAddress(forIPv6String("2002:102:30... | public static boolean hasEmbeddedIPv4ClientAddress(Inet6Address ip) { return isMappedIPv4Address(ip) || InetAddresses.hasEmbeddedIPv4ClientAddress(ip); } | MoreInetAddresses { public static boolean hasEmbeddedIPv4ClientAddress(Inet6Address ip) { return isMappedIPv4Address(ip) || InetAddresses.hasEmbeddedIPv4ClientAddress(ip); } } | MoreInetAddresses { public static boolean hasEmbeddedIPv4ClientAddress(Inet6Address ip) { return isMappedIPv4Address(ip) || InetAddresses.hasEmbeddedIPv4ClientAddress(ip); } private MoreInetAddresses(); } | MoreInetAddresses { public static boolean hasEmbeddedIPv4ClientAddress(Inet6Address ip) { return isMappedIPv4Address(ip) || InetAddresses.hasEmbeddedIPv4ClientAddress(ip); } private MoreInetAddresses(); static InetAddress forString(String ipString); static Inet4Address forIPv4String(String ipString); static Inet6Addre... | MoreInetAddresses { public static boolean hasEmbeddedIPv4ClientAddress(Inet6Address ip) { return isMappedIPv4Address(ip) || InetAddresses.hasEmbeddedIPv4ClientAddress(ip); } private MoreInetAddresses(); static InetAddress forString(String ipString); static Inet4Address forIPv4String(String ipString); static Inet6Addre... |
@Test(expected = NullPointerException.class) public void hasEmbeddedIPv4ClientAddressNullTest() { MoreInetAddresses.hasEmbeddedIPv4ClientAddress(null); } | public static boolean hasEmbeddedIPv4ClientAddress(Inet6Address ip) { return isMappedIPv4Address(ip) || InetAddresses.hasEmbeddedIPv4ClientAddress(ip); } | MoreInetAddresses { public static boolean hasEmbeddedIPv4ClientAddress(Inet6Address ip) { return isMappedIPv4Address(ip) || InetAddresses.hasEmbeddedIPv4ClientAddress(ip); } } | MoreInetAddresses { public static boolean hasEmbeddedIPv4ClientAddress(Inet6Address ip) { return isMappedIPv4Address(ip) || InetAddresses.hasEmbeddedIPv4ClientAddress(ip); } private MoreInetAddresses(); } | MoreInetAddresses { public static boolean hasEmbeddedIPv4ClientAddress(Inet6Address ip) { return isMappedIPv4Address(ip) || InetAddresses.hasEmbeddedIPv4ClientAddress(ip); } private MoreInetAddresses(); static InetAddress forString(String ipString); static Inet4Address forIPv4String(String ipString); static Inet6Addre... | MoreInetAddresses { public static boolean hasEmbeddedIPv4ClientAddress(Inet6Address ip) { return isMappedIPv4Address(ip) || InetAddresses.hasEmbeddedIPv4ClientAddress(ip); } private MoreInetAddresses(); static InetAddress forString(String ipString); static Inet4Address forIPv4String(String ipString); static Inet6Addre... |
@Test public void getEmbeddedIPv4ClientAddressTest() { assertEquals(MoreInetAddresses.forString("1.2.3.4"), MoreInetAddresses.getEmbeddedIPv4ClientAddress(forIPv6String("::ffff:1.2.3.4"))); assertEquals(MoreInetAddresses.forString("1.2.3.4"), MoreInetAddresses.getEmbeddedIPv4ClientAddress(forIPv6String("::1.2.3.4"))); ... | public static Inet4Address getEmbeddedIPv4ClientAddress(Inet6Address ip) { if (isMappedIPv4Address(ip)) return getMappedIPv4Address(ip); return InetAddresses.getEmbeddedIPv4ClientAddress(ip); } | MoreInetAddresses { public static Inet4Address getEmbeddedIPv4ClientAddress(Inet6Address ip) { if (isMappedIPv4Address(ip)) return getMappedIPv4Address(ip); return InetAddresses.getEmbeddedIPv4ClientAddress(ip); } } | MoreInetAddresses { public static Inet4Address getEmbeddedIPv4ClientAddress(Inet6Address ip) { if (isMappedIPv4Address(ip)) return getMappedIPv4Address(ip); return InetAddresses.getEmbeddedIPv4ClientAddress(ip); } private MoreInetAddresses(); } | MoreInetAddresses { public static Inet4Address getEmbeddedIPv4ClientAddress(Inet6Address ip) { if (isMappedIPv4Address(ip)) return getMappedIPv4Address(ip); return InetAddresses.getEmbeddedIPv4ClientAddress(ip); } private MoreInetAddresses(); static InetAddress forString(String ipString); static Inet4Address forIPv4St... | MoreInetAddresses { public static Inet4Address getEmbeddedIPv4ClientAddress(Inet6Address ip) { if (isMappedIPv4Address(ip)) return getMappedIPv4Address(ip); return InetAddresses.getEmbeddedIPv4ClientAddress(ip); } private MoreInetAddresses(); static InetAddress forString(String ipString); static Inet4Address forIPv4St... |
@Test(expected = NullPointerException.class) public void getEmbeddedIPv4ClientAddressNullTest() { MoreInetAddresses.getEmbeddedIPv4ClientAddress(null); } | public static Inet4Address getEmbeddedIPv4ClientAddress(Inet6Address ip) { if (isMappedIPv4Address(ip)) return getMappedIPv4Address(ip); return InetAddresses.getEmbeddedIPv4ClientAddress(ip); } | MoreInetAddresses { public static Inet4Address getEmbeddedIPv4ClientAddress(Inet6Address ip) { if (isMappedIPv4Address(ip)) return getMappedIPv4Address(ip); return InetAddresses.getEmbeddedIPv4ClientAddress(ip); } } | MoreInetAddresses { public static Inet4Address getEmbeddedIPv4ClientAddress(Inet6Address ip) { if (isMappedIPv4Address(ip)) return getMappedIPv4Address(ip); return InetAddresses.getEmbeddedIPv4ClientAddress(ip); } private MoreInetAddresses(); } | MoreInetAddresses { public static Inet4Address getEmbeddedIPv4ClientAddress(Inet6Address ip) { if (isMappedIPv4Address(ip)) return getMappedIPv4Address(ip); return InetAddresses.getEmbeddedIPv4ClientAddress(ip); } private MoreInetAddresses(); static InetAddress forString(String ipString); static Inet4Address forIPv4St... | MoreInetAddresses { public static Inet4Address getEmbeddedIPv4ClientAddress(Inet6Address ip) { if (isMappedIPv4Address(ip)) return getMappedIPv4Address(ip); return InetAddresses.getEmbeddedIPv4ClientAddress(ip); } private MoreInetAddresses(); static InetAddress forString(String ipString); static Inet4Address forIPv4St... |
@Test public void getIPv4MappedIPv6AddressTest() { assertEquals("::ffff:102:304", toAddrString(MoreInetAddresses.getIPv4MappedIPv6Address(forIPv4String("1.2.3.4")))); } | public static Inet6Address getIPv4MappedIPv6Address(Inet4Address ip) { byte[] from = ip.getAddress(); byte[] bytes = new byte[] { 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,(byte)0xff,(byte)0xff, from[0],from[1],from[2],from[3] }; return getInet6Address(bytes); } | MoreInetAddresses { public static Inet6Address getIPv4MappedIPv6Address(Inet4Address ip) { byte[] from = ip.getAddress(); byte[] bytes = new byte[] { 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,(byte)0xff,(byte)0xff, from[0],from[1],from[2],from[3] }; return getInet6Address(bytes); } } | MoreInetAddresses { public static Inet6Address getIPv4MappedIPv6Address(Inet4Address ip) { byte[] from = ip.getAddress(); byte[] bytes = new byte[] { 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,(byte)0xff,(byte)0xff, from[0],from[1],from[2],from[3] }; return getInet6Address(bytes); } private MoreInetAddresses(); } | MoreInetAddresses { public static Inet6Address getIPv4MappedIPv6Address(Inet4Address ip) { byte[] from = ip.getAddress(); byte[] bytes = new byte[] { 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,(byte)0xff,(byte)0xff, from[0],from[1],from[2],from[3] }; return getInet6Address(bytes); } private MoreInetAddresses(); static ... | MoreInetAddresses { public static Inet6Address getIPv4MappedIPv6Address(Inet4Address ip) { byte[] from = ip.getAddress(); byte[] bytes = new byte[] { 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,(byte)0xff,(byte)0xff, from[0],from[1],from[2],from[3] }; return getInet6Address(bytes); } private MoreInetAddresses(); static ... |
@Test(expected = NullPointerException.class) public void getIPv4MappedIPv6AddressNullTest() { MoreInetAddresses.getIPv4MappedIPv6Address(null); } | public static Inet6Address getIPv4MappedIPv6Address(Inet4Address ip) { byte[] from = ip.getAddress(); byte[] bytes = new byte[] { 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,(byte)0xff,(byte)0xff, from[0],from[1],from[2],from[3] }; return getInet6Address(bytes); } | MoreInetAddresses { public static Inet6Address getIPv4MappedIPv6Address(Inet4Address ip) { byte[] from = ip.getAddress(); byte[] bytes = new byte[] { 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,(byte)0xff,(byte)0xff, from[0],from[1],from[2],from[3] }; return getInet6Address(bytes); } } | MoreInetAddresses { public static Inet6Address getIPv4MappedIPv6Address(Inet4Address ip) { byte[] from = ip.getAddress(); byte[] bytes = new byte[] { 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,(byte)0xff,(byte)0xff, from[0],from[1],from[2],from[3] }; return getInet6Address(bytes); } private MoreInetAddresses(); } | MoreInetAddresses { public static Inet6Address getIPv4MappedIPv6Address(Inet4Address ip) { byte[] from = ip.getAddress(); byte[] bytes = new byte[] { 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,(byte)0xff,(byte)0xff, from[0],from[1],from[2],from[3] }; return getInet6Address(bytes); } private MoreInetAddresses(); static ... | MoreInetAddresses { public static Inet6Address getIPv4MappedIPv6Address(Inet4Address ip) { byte[] from = ip.getAddress(); byte[] bytes = new byte[] { 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,(byte)0xff,(byte)0xff, from[0],from[1],from[2],from[3] }; return getInet6Address(bytes); } private MoreInetAddresses(); static ... |
@Test public void getIPv4CompatIPv6AddressTest() { assertEquals("::102:304", toAddrString(MoreInetAddresses.getIPV4CompatIPv6Address(forIPv4String("1.2.3.4")))); } | public static Inet6Address getIPV4CompatIPv6Address(Inet4Address ip) { byte[] from = ip.getAddress(); byte[] bytes = new byte[] { 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, from[0],from[1],from[2],from[3] }; return getInet6Address(bytes); } | MoreInetAddresses { public static Inet6Address getIPV4CompatIPv6Address(Inet4Address ip) { byte[] from = ip.getAddress(); byte[] bytes = new byte[] { 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, from[0],from[1],from[2],from[3] }; return getInet6Address(bytes); } } | MoreInetAddresses { public static Inet6Address getIPV4CompatIPv6Address(Inet4Address ip) { byte[] from = ip.getAddress(); byte[] bytes = new byte[] { 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, from[0],from[1],from[2],from[3] }; return getInet6Address(bytes); } private MoreInetAddresses(); } | MoreInetAddresses { public static Inet6Address getIPV4CompatIPv6Address(Inet4Address ip) { byte[] from = ip.getAddress(); byte[] bytes = new byte[] { 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, from[0],from[1],from[2],from[3] }; return getInet6Address(bytes); } private MoreInetAddresses(); static InetAddress fo... | MoreInetAddresses { public static Inet6Address getIPV4CompatIPv6Address(Inet4Address ip) { byte[] from = ip.getAddress(); byte[] bytes = new byte[] { 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, from[0],from[1],from[2],from[3] }; return getInet6Address(bytes); } private MoreInetAddresses(); static InetAddress fo... |
@Test(expected = NullPointerException.class) public void getIPv4CompatIPv6AddressNullTest() { MoreInetAddresses.getIPV4CompatIPv6Address(null); } | public static Inet6Address getIPV4CompatIPv6Address(Inet4Address ip) { byte[] from = ip.getAddress(); byte[] bytes = new byte[] { 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, from[0],from[1],from[2],from[3] }; return getInet6Address(bytes); } | MoreInetAddresses { public static Inet6Address getIPV4CompatIPv6Address(Inet4Address ip) { byte[] from = ip.getAddress(); byte[] bytes = new byte[] { 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, from[0],from[1],from[2],from[3] }; return getInet6Address(bytes); } } | MoreInetAddresses { public static Inet6Address getIPV4CompatIPv6Address(Inet4Address ip) { byte[] from = ip.getAddress(); byte[] bytes = new byte[] { 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, from[0],from[1],from[2],from[3] }; return getInet6Address(bytes); } private MoreInetAddresses(); } | MoreInetAddresses { public static Inet6Address getIPV4CompatIPv6Address(Inet4Address ip) { byte[] from = ip.getAddress(); byte[] bytes = new byte[] { 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, from[0],from[1],from[2],from[3] }; return getInet6Address(bytes); } private MoreInetAddresses(); static InetAddress fo... | MoreInetAddresses { public static Inet6Address getIPV4CompatIPv6Address(Inet4Address ip) { byte[] from = ip.getAddress(); byte[] bytes = new byte[] { 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, from[0],from[1],from[2],from[3] }; return getInet6Address(bytes); } private MoreInetAddresses(); static InetAddress fo... |
@Test(expected = NullPointerException.class) public void distinctNullIteratorTest() { distinct(null); } | public static <T> Iterable<T> distinct(final Iterable<T> iterable) { requireNonNull(iterable); return () -> Iterators2.distinct(iterable.iterator()); } | Iterables2 { public static <T> Iterable<T> distinct(final Iterable<T> iterable) { requireNonNull(iterable); return () -> Iterators2.distinct(iterable.iterator()); } } | Iterables2 { public static <T> Iterable<T> distinct(final Iterable<T> iterable) { requireNonNull(iterable); return () -> Iterators2.distinct(iterable.iterator()); } private Iterables2(); } | Iterables2 { public static <T> Iterable<T> distinct(final Iterable<T> iterable) { requireNonNull(iterable); return () -> Iterators2.distinct(iterable.iterator()); } private Iterables2(); static Iterable<T> simpleIterable(final Iterable<T> iterable); static Iterable<T> distinct(final Iterable<T> iterable); static Itera... | Iterables2 { public static <T> Iterable<T> distinct(final Iterable<T> iterable) { requireNonNull(iterable); return () -> Iterators2.distinct(iterable.iterator()); } private Iterables2(); static Iterable<T> simpleIterable(final Iterable<T> iterable); static Iterable<T> distinct(final Iterable<T> iterable); static Itera... |
@Test public void forCIDRStringTest() { MoreInetAddresses.CidrInfo cidr = MoreInetAddresses.parseCIDR("255.255.255.255/16"); assertTrue(cidr.getNetwork() instanceof Inet4Address); assertEquals("255.255.0.0", toAddrString(cidr.getNetwork())); assertEquals("255.255.255.255", toAddrString(cidr.getBroadcast())); cidr = Mor... | public static CidrInfo parseCIDR(String cidr) { requireNonNull(cidr); try { String[] parts = cidr.split("/"); checkArgument(parts.length == 2); byte[] bytes = forString(parts[0]).getAddress(); int maskBits = parseInt(parts[1]); checkArgument(maskBits >= 0 && maskBits <= bytes.length * 8); int remainingBits = maskBits; ... | MoreInetAddresses { public static CidrInfo parseCIDR(String cidr) { requireNonNull(cidr); try { String[] parts = cidr.split("/"); checkArgument(parts.length == 2); byte[] bytes = forString(parts[0]).getAddress(); int maskBits = parseInt(parts[1]); checkArgument(maskBits >= 0 && maskBits <= bytes.length * 8); int remain... | MoreInetAddresses { public static CidrInfo parseCIDR(String cidr) { requireNonNull(cidr); try { String[] parts = cidr.split("/"); checkArgument(parts.length == 2); byte[] bytes = forString(parts[0]).getAddress(); int maskBits = parseInt(parts[1]); checkArgument(maskBits >= 0 && maskBits <= bytes.length * 8); int remain... | MoreInetAddresses { public static CidrInfo parseCIDR(String cidr) { requireNonNull(cidr); try { String[] parts = cidr.split("/"); checkArgument(parts.length == 2); byte[] bytes = forString(parts[0]).getAddress(); int maskBits = parseInt(parts[1]); checkArgument(maskBits >= 0 && maskBits <= bytes.length * 8); int remain... | MoreInetAddresses { public static CidrInfo parseCIDR(String cidr) { requireNonNull(cidr); try { String[] parts = cidr.split("/"); checkArgument(parts.length == 2); byte[] bytes = forString(parts[0]).getAddress(); int maskBits = parseInt(parts[1]); checkArgument(maskBits >= 0 && maskBits <= bytes.length * 8); int remain... |
@Test public void ipv4ToStringTest() { IPv4 ip = new IPv4(forIPv4String("1.2.3.4")); assertEquals("1.2.3.4", ip.toString()); } | @Override public String toString() { return toAddrString(address); } | IP implements Serializable { @Override public String toString() { return toAddrString(address); } } | IP implements Serializable { @Override public String toString() { return toAddrString(address); } protected IP(T address); } | IP implements Serializable { @Override public String toString() { return toAddrString(address); } protected IP(T address); @SuppressWarnings("unchecked") T getAddress(); byte[] toByteArray(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); } | IP implements Serializable { @Override public String toString() { return toAddrString(address); } protected IP(T address); @SuppressWarnings("unchecked") T getAddress(); byte[] toByteArray(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); } |
@Test public void ipv6ToStringTest() { IPv6 ip = new IPv6(forIPv6String("::1.2.3.4")); assertEquals("::102:304", ip.toString()); ip = new IPv6(forIPv6String("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")); assertEquals("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", ip.toString()); ip = new IPv6(forIPv6String("1234:0000:0000:00... | @Override public String toString() { return toAddrString(address); } | IP implements Serializable { @Override public String toString() { return toAddrString(address); } } | IP implements Serializable { @Override public String toString() { return toAddrString(address); } protected IP(T address); } | IP implements Serializable { @Override public String toString() { return toAddrString(address); } protected IP(T address); @SuppressWarnings("unchecked") T getAddress(); byte[] toByteArray(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); } | IP implements Serializable { @Override public String toString() { return toAddrString(address); } protected IP(T address); @SuppressWarnings("unchecked") T getAddress(); byte[] toByteArray(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); } |
@Test public void testEq() throws Exception { Node build = QueryBuilder.create().eq("feedName", "netflowv9").build(); StringWriter writer = new StringWriter(); build.accept(new PrintNodeVisitor(writer)); assertEquals("AndNode(Equals[feedName,netflowv9],),", writer.toString()); } | public QueryBuilder eq(String type, Object value) { checkFinished(); if (this.current == null) { this.current = new AndNode(); finished = true; } EqualsLeaf equalsLeaf = new EqualsLeaf<>(type, value, current); this.current.addChild(equalsLeaf); return this; } | QueryBuilder { public QueryBuilder eq(String type, Object value) { checkFinished(); if (this.current == null) { this.current = new AndNode(); finished = true; } EqualsLeaf equalsLeaf = new EqualsLeaf<>(type, value, current); this.current.addChild(equalsLeaf); return this; } } | QueryBuilder { public QueryBuilder eq(String type, Object value) { checkFinished(); if (this.current == null) { this.current = new AndNode(); finished = true; } EqualsLeaf equalsLeaf = new EqualsLeaf<>(type, value, current); this.current.addChild(equalsLeaf); return this; } protected QueryBuilder(); protected QueryBu... | QueryBuilder { public QueryBuilder eq(String type, Object value) { checkFinished(); if (this.current == null) { this.current = new AndNode(); finished = true; } EqualsLeaf equalsLeaf = new EqualsLeaf<>(type, value, current); this.current.addChild(equalsLeaf); return this; } protected QueryBuilder(); protected QueryBu... | QueryBuilder { public QueryBuilder eq(String type, Object value) { checkFinished(); if (this.current == null) { this.current = new AndNode(); finished = true; } EqualsLeaf equalsLeaf = new EqualsLeaf<>(type, value, current); this.current.addChild(equalsLeaf); return this; } protected QueryBuilder(); protected QueryBu... |
@Test public void testCollapseAndAndChildren() throws Exception { StringWriter writer = new StringWriter(); Node node = QueryBuilder.create().and().and().eq("k1", "v1").eq("k2", "v2").end().end().build(); node.accept(new PrintNodeVisitor(writer)); writer.append('\n'); node.accept(new CollapseParentClauseVisitor()); nod... | @Override public void end(ParentNode node) { } | CollapseParentClauseVisitor implements NodeVisitor { @Override public void end(ParentNode node) { } } | CollapseParentClauseVisitor implements NodeVisitor { @Override public void end(ParentNode node) { } } | CollapseParentClauseVisitor implements NodeVisitor { @Override public void end(ParentNode node) { } @Override void begin(ParentNode node); @Override void end(ParentNode node); @Override void visit(Leaf node); } | CollapseParentClauseVisitor implements NodeVisitor { @Override public void end(ParentNode node) { } @Override void begin(ParentNode node); @Override void end(ParentNode node); @Override void visit(Leaf node); } |
@Test public void testCollapseAndAndOrChildren() throws Exception { StringWriter writer = new StringWriter(); Node node = QueryBuilder.create().and().and().eq("k1", "v1").eq("k2", "v2").end().or().eq("k3", "v3").eq("k4", "v4").end().end().build(); node.accept(new PrintNodeVisitor(writer)); writer.append('\n'); node.acc... | @Override public void end(ParentNode node) { } | CollapseParentClauseVisitor implements NodeVisitor { @Override public void end(ParentNode node) { } } | CollapseParentClauseVisitor implements NodeVisitor { @Override public void end(ParentNode node) { } } | CollapseParentClauseVisitor implements NodeVisitor { @Override public void end(ParentNode node) { } @Override void begin(ParentNode node); @Override void end(ParentNode node); @Override void visit(Leaf node); } | CollapseParentClauseVisitor implements NodeVisitor { @Override public void end(ParentNode node) { } @Override void begin(ParentNode node); @Override void end(ParentNode node); @Override void visit(Leaf node); } |
@Test public void test() { LessThanEqualsCriteria criteria = new LessThanEqualsCriteria<>("key1", 5, naturalOrder(), null); EntityBuilder entity = EntityBuilder.create("type", "id"); assertFalse(criteria.test(entity.build())); entity = entity.attr("key1", 10); assertFalse(criteria.test(entity.build())); entity = entity... | @Override public boolean test(AttributeStore obj) { for (Attribute attribute : obj.getAttributes(getTerm())) { if (getComparator().compare((T)(attribute.getValue()), getValue()) <= 0) return true; } return false; } | LessThanEqualsCriteria extends ComparableTermValueCriteria<T> { @Override public boolean test(AttributeStore obj) { for (Attribute attribute : obj.getAttributes(getTerm())) { if (getComparator().compare((T)(attribute.getValue()), getValue()) <= 0) return true; } return false; } } | LessThanEqualsCriteria extends ComparableTermValueCriteria<T> { @Override public boolean test(AttributeStore obj) { for (Attribute attribute : obj.getAttributes(getTerm())) { if (getComparator().compare((T)(attribute.getValue()), getValue()) <= 0) return true; } return false; } LessThanEqualsCriteria(String term, T val... | LessThanEqualsCriteria extends ComparableTermValueCriteria<T> { @Override public boolean test(AttributeStore obj) { for (Attribute attribute : obj.getAttributes(getTerm())) { if (getComparator().compare((T)(attribute.getValue()), getValue()) <= 0) return true; } return false; } LessThanEqualsCriteria(String term, T val... | LessThanEqualsCriteria extends ComparableTermValueCriteria<T> { @Override public boolean test(AttributeStore obj) { for (Attribute attribute : obj.getAttributes(getTerm())) { if (getComparator().compare((T)(attribute.getValue()), getValue()) <= 0) return true; } return false; } LessThanEqualsCriteria(String term, T val... |
@Test public void testEquals() { Criteria eq = new EqualsCriteria<>("key1", "val1", naturalOrder(), null); EntityBuilder entity = EntityBuilder.create("type", "id") .attr("key1", "val1"); assertTrue(eq.test(entity.build())); } | @Override public boolean test(AttributeStore obj) { for (Attribute attribute : obj.getAttributes(getTerm())) { if (getComparator().compare((T)(attribute.getValue()), getValue()) == 0) return true; } return false; } | EqualsCriteria extends ComparableTermValueCriteria<T> { @Override public boolean test(AttributeStore obj) { for (Attribute attribute : obj.getAttributes(getTerm())) { if (getComparator().compare((T)(attribute.getValue()), getValue()) == 0) return true; } return false; } } | EqualsCriteria extends ComparableTermValueCriteria<T> { @Override public boolean test(AttributeStore obj) { for (Attribute attribute : obj.getAttributes(getTerm())) { if (getComparator().compare((T)(attribute.getValue()), getValue()) == 0) return true; } return false; } EqualsCriteria(String term, T value, Comparator<T... | EqualsCriteria extends ComparableTermValueCriteria<T> { @Override public boolean test(AttributeStore obj) { for (Attribute attribute : obj.getAttributes(getTerm())) { if (getComparator().compare((T)(attribute.getValue()), getValue()) == 0) return true; } return false; } EqualsCriteria(String term, T value, Comparator<T... | EqualsCriteria extends ComparableTermValueCriteria<T> { @Override public boolean test(AttributeStore obj) { for (Attribute attribute : obj.getAttributes(getTerm())) { if (getComparator().compare((T)(attribute.getValue()), getValue()) == 0) return true; } return false; } EqualsCriteria(String term, T value, Comparator<T... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.