mirror of https://github.com/apache/jclouds.git
Renamed GetIPAddressFromMAC to correct spelling
This commit is contained in:
parent
20868e7072
commit
860f7ad831
|
@ -1,4 +1,4 @@
|
||||||
/**
|
/*
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||||
* contributor license agreements. See the NOTICE file
|
* contributor license agreements. See the NOTICE file
|
||||||
* distributed with this work for additional information
|
* distributed with this work for additional information
|
||||||
|
@ -37,7 +37,7 @@ import com.google.common.collect.ImmutableMap;
|
||||||
/**
|
/**
|
||||||
* @author Andrea Turli
|
* @author Andrea Turli
|
||||||
*/
|
*/
|
||||||
public class GetIPAdressFromMAC implements Statement {
|
public class GetIPAddressFromMAC implements Statement {
|
||||||
|
|
||||||
public static final Map<OsFamily, String> OS_TO_ARP = ImmutableMap
|
public static final Map<OsFamily, String> OS_TO_ARP = ImmutableMap
|
||||||
.of(OsFamily.UNIX,
|
.of(OsFamily.UNIX,
|
||||||
|
@ -47,12 +47,12 @@ public class GetIPAdressFromMAC implements Statement {
|
||||||
private String macAddress;
|
private String macAddress;
|
||||||
private String macAddressBsd;
|
private String macAddressBsd;
|
||||||
|
|
||||||
public GetIPAdressFromMAC(String macAddress) {
|
public GetIPAddressFromMAC(String macAddress) {
|
||||||
this(Joiner.on(":").join(Splitter.fixedLength(2).split(macAddress)).toLowerCase(),
|
this(Joiner.on(":").join(Splitter.fixedLength(2).split(macAddress)).toLowerCase(),
|
||||||
MacAddressToBSD.INSTANCE.apply(Joiner.on(":").join(Splitter.fixedLength(2).split(macAddress)).toLowerCase()));
|
MacAddressToBSD.INSTANCE.apply(Joiner.on(":").join(Splitter.fixedLength(2).split(macAddress)).toLowerCase()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public GetIPAdressFromMAC(String macAddress, String macAddressBsd) {
|
public GetIPAddressFromMAC(String macAddress, String macAddressBsd) {
|
||||||
checkNotNull(macAddress, "macAddress");
|
checkNotNull(macAddress, "macAddress");
|
||||||
checkArgument(macAddress.length() == 17);
|
checkArgument(macAddress.length() == 17);
|
||||||
this.macAddress = macAddress;
|
this.macAddress = macAddress;
|
|
@ -37,13 +37,13 @@ public class GetIPAddressFromMACTest {
|
||||||
private static final String bsdMacAddressWith0c = "8:11:27:1a:98:6";
|
private static final String bsdMacAddressWith0c = "8:11:27:1a:98:6";
|
||||||
|
|
||||||
public void testGetIPAdressFromMacAddressUnix() {
|
public void testGetIPAdressFromMacAddressUnix() {
|
||||||
GetIPAdressFromMAC statement = new GetIPAdressFromMAC(macAddressWith00);
|
GetIPAddressFromMAC statement = new GetIPAddressFromMAC(macAddressWith00);
|
||||||
assertEquals(statement.render(OsFamily.UNIX), "MAC="
|
assertEquals(statement.render(OsFamily.UNIX), "MAC="
|
||||||
+ unixMacAddressWith00
|
+ unixMacAddressWith00
|
||||||
+ " && [[ `uname -s` = \"Darwin\" ]] && MAC=" + bsdMacAddressWith00
|
+ " && [[ `uname -s` = \"Darwin\" ]] && MAC=" + bsdMacAddressWith00
|
||||||
+ "\n arp -an | grep $MAC\n");
|
+ "\n arp -an | grep $MAC\n");
|
||||||
|
|
||||||
statement = new GetIPAdressFromMAC(macAddressWith0c);
|
statement = new GetIPAddressFromMAC(macAddressWith0c);
|
||||||
assertEquals(statement.render(OsFamily.UNIX), "MAC="
|
assertEquals(statement.render(OsFamily.UNIX), "MAC="
|
||||||
+ unixMacAddressWith0c
|
+ unixMacAddressWith0c
|
||||||
+ " && [[ `uname -s` = \"Darwin\" ]] && MAC=" + bsdMacAddressWith0c
|
+ " && [[ `uname -s` = \"Darwin\" ]] && MAC=" + bsdMacAddressWith0c
|
||||||
|
|
Loading…
Reference in New Issue