JcloudsLocation extends AbstractCloudMachineProvisioningLocation implements
        JcloudsLocationPublic { @VisibleForTesting static int getLoginPortOrDefault(NodeMetadata node, int defaultPort) { int loginPort = node.getLoginPort(); if (loginPort > 0) { return loginPort; } return defaultPort; } JcloudsLocation();  JcloudsLocation(Map<?,?> conf); @Override @Deprecated JcloudsLocation configure(Map<?,?> properties); @Override void init(); @Override void rebind(); @Override JcloudsLocation newSubLocation(Map<?,?> newFlags); @Override JcloudsLocation newSubLocation(Class<? extends AbstractCloudMachineProvisioningLocation> type, Map<?,?> newFlags); @Override String toString(); @Override String toVerboseString(); @Override String getProvider(); @Override String getIdentity(); @Override String getCredential(); @Override String getRegion(); @Override String getEndpoint(); String getUser(ConfigBag config); boolean isWindows(Template template, ConfigBag config); boolean isWindows(Image image, ConfigBag config); boolean isWindows(NodeMetadata node, ConfigBag config); boolean isLocationFirewalldEnabled(SshMachineLocation location); Collection<JcloudsLocationCustomizer> getCustomizers(ConfigBag setup); ConnectivityResolver getLocationNetworkInfoCustomizer(ConfigBag setup); void setDefaultImageId(String val); void setTagMapping(Map<String,Map<String, ? extends Object>> val); @Override Map<String,Object> getProvisioningFlags(Collection<String> tags); static final Set<ConfigKey<?>> getAllSupportedProperties(); ComputeService getComputeService(); ComputeService getComputeService(Map<?,?> flags); ComputeService getComputeService(ConfigBag config); @Override Map<String, MachineManagementMixins.MachineMetadata> listMachines(); @Override MachineManagementMixins.MachineMetadata getMachineMetadata(MachineLocation l); @Override void killMachine(String cloudServiceId); @Override void killMachine(MachineLocation l); MachineLocation obtain(); MachineLocation obtain(TemplateBuilder tb); MachineLocation obtain(Map<?,?> flags, TemplateBuilder tb); @Override MachineLocation obtain(Map<?,?> flags); @Override void suspendMachine(MachineLocation rawLocation); @Override JcloudsMachineLocation resumeMachine(Map<?, ?> flags); @Deprecated Template buildTemplate(ComputeService computeService, ConfigBag config, Collection<JcloudsLocationCustomizer> customizers); Template buildTemplate(ComputeService computeService, ConfigBag config, JcloudsLocationCustomizer customizersDelegate); @Override String toStringNice(); JcloudsMachineLocation registerMachine(ConfigBag flags); JcloudsMachineLocation registerMachine(Map<?,?> flags); @Override void release(MachineLocation rawMachine); @Override PersistenceObjectStore newPersistenceObjectStore(String container); @Deprecated static File asFile(Object o); @Deprecated static String fileAsString(Object o); static final Logger LOG; static final Map<ConfigKey<?>, ? extends TemplateBuilderCustomizer> SUPPORTED_TEMPLATE_BUILDER_PROPERTIES; static final Map<ConfigKey<?>, ? extends TemplateOptionCustomizer> SUPPORTED_TEMPLATE_OPTIONS_PROPERTIES; }
@Test public void testGetLoginPortOrDefaultReturnsDefaultWhenLoginPortNve() { NodeMetadata mock = Mockito.mock(NodeMetadata.class); Mockito.when(mock.getLoginPort()).thenReturn(-1); Assert.assertEquals(JcloudsLocation.getLoginPortOrDefault(mock,22), 22); }
@Test public void testGetLoginPortOrDefaultReturnsPortWhenLoginPortPve() { NodeMetadata mock = Mockito.mock(NodeMetadata.class); Mockito.when(mock.getLoginPort()).thenReturn(666); Assert.assertEquals(JcloudsLocation.getLoginPortOrDefault(mock,22), 666); }