/** * @return String, all the important values that can be configured */ @Override public String toString() { StringBuilder buf = new StringBuilder(); buf.append( "\n RemoteCacheAttributes " ); if (this.location != null) { buf.append( "\n remoteHost = [" + this.location.getHost() + "]" ); buf.append( "\n remotePort = [" + this.location.getPort() + "]" ); } buf.append( "\n cacheName = [" + getCacheName() + "]" ); buf.append( "\n remoteType = [" + remoteType + "]" ); buf.append( "\n removeUponRemotePut = [" + this.removeUponRemotePut + "]" ); buf.append( "\n getOnly = [" + getOnly + "]" ); return buf.toString(); } }
/** * Get the naming url used for RMI registration * * @param location * the remote location * @param serviceName * the remote service name * @return the URL for RMI lookup */ public static String getNamingURL(final RemoteLocation location, final String serviceName) { return getNamingURL(location.getHost(), location.getPort(), serviceName); }
public void testParseServerAndPort() { RemoteLocation loc = RemoteLocation.parseServerAndPort("server1:1234"); assertEquals("server1", loc.getHost()); assertEquals(1234, loc.getPort()); loc = RemoteLocation.parseServerAndPort(" server2 : 4567 "); assertEquals("server2", loc.getHost()); assertEquals(4567, loc.getPort()); loc = RemoteLocation.parseServerAndPort("server2 : port"); assertNull(loc); } }