fix loginPort parsing in byon

This commit is contained in:
Adrian Cole 2011-08-20 12:35:18 -07:00
parent 2a4e89912b
commit 3621b0e8c7
2 changed files with 11 additions and 0 deletions

View File

@ -79,6 +79,7 @@ public class NodeToNodeMetadata implements Function<Node, NodeMetadata> {
NodeMetadataBuilder builder = new NodeMetadataBuilder();
builder.ids(from.getId());
builder.name(from.getName());
builder.loginPort(from.getLoginPort());
builder.hostname(from.getHostname());
builder.location(findLocationWithId(from.getLocationId()));
builder.group(from.getGroup());

View File

@ -73,10 +73,15 @@ public class NodeToNodeMetadataTest {
}
public static NodeMetadata expectedNodeMetadataFromResource(int id, String resource, Location location) {
return expectedNodeMetadataFromResource(id, resource, location, 22);
}
public static NodeMetadata expectedNodeMetadataFromResource(int id, String resource, Location location, int loginPort) {
return new NodeMetadataBuilder()
.ids("cluster-" + id)
.group("hadoop")
.name("cluster-" + id)
.loginPort(loginPort)
.hostname("cluster-" + id + ".mydomain.com")
.location(location)
.state(NodeState.RUNNING)
@ -98,4 +103,9 @@ public class NodeToNodeMetadataTest {
"virginia", provider)));
assertEquals(credentialStore, ImmutableMap.of("node#cluster-1", new Credentials("myUser", NodesFromYamlTest.key)));
}
@Test
public void testNodesParseLoginPort() throws Exception {
assertEquals(parser.apply(NodesFromYamlTest.TEST3), expectedNodeMetadataFromResource(2, resource, provider, 2022));
}
}