Search in sources :

Example 36 with StaticIpConfiguration

use of android.net.StaticIpConfiguration in project android_frameworks_base by AOSPA.

the class StaticIpConfigurationTest method testHashCodeAndEquals.

@SmallTest
public void testHashCodeAndEquals() {
    HashSet<Integer> hashCodes = new HashSet();
    hashCodes.add(0);
    StaticIpConfiguration s = new StaticIpConfiguration();
    // Check that this hash code is nonzero and different from all the ones seen so far.
    assertTrue(hashCodes.add(s.hashCode()));
    s.ipAddress = ADDR;
    assertTrue(hashCodes.add(s.hashCode()));
    s.gateway = GATEWAY;
    assertTrue(hashCodes.add(s.hashCode()));
    s.dnsServers.add(DNS1);
    assertTrue(hashCodes.add(s.hashCode()));
    s.dnsServers.add(DNS2);
    assertTrue(hashCodes.add(s.hashCode()));
    s.dnsServers.add(DNS3);
    assertTrue(hashCodes.add(s.hashCode()));
    s.domains = "example.com";
    assertTrue(hashCodes.add(s.hashCode()));
    assertFalse(s.equals(null));
    assertEquals(s, s);
    StaticIpConfiguration s2 = new StaticIpConfiguration(s);
    assertEquals(s, s2);
    s.ipAddress = new LinkAddress(DNS1, 32);
    assertNotEquals(s, s2);
    s2 = new StaticIpConfiguration(s);
    s.domains = "foo";
    assertNotEquals(s, s2);
    s2 = new StaticIpConfiguration(s);
    s.gateway = DNS2;
    assertNotEquals(s, s2);
    s2 = new StaticIpConfiguration(s);
    s.dnsServers.add(DNS3);
    assertNotEquals(s, s2);
}
Also used : LinkAddress(android.net.LinkAddress) StaticIpConfiguration(android.net.StaticIpConfiguration) HashSet(java.util.HashSet) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 37 with StaticIpConfiguration

use of android.net.StaticIpConfiguration in project android_frameworks_base by AOSPA.

the class StaticIpConfigurationTest method testCopyAndClear.

@SmallTest
public void testCopyAndClear() {
    StaticIpConfiguration empty = new StaticIpConfiguration((StaticIpConfiguration) null);
    checkEmpty(empty);
    StaticIpConfiguration s1 = makeTestObject();
    StaticIpConfiguration s2 = new StaticIpConfiguration(s1);
    assertEquals(s1, s2);
    s2.clear();
    assertEquals(empty, s2);
}
Also used : StaticIpConfiguration(android.net.StaticIpConfiguration) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 38 with StaticIpConfiguration

use of android.net.StaticIpConfiguration in project android_frameworks_base by DirtyUnicorns.

the class StaticIpConfigurationTest method testCopyAndClear.

@SmallTest
public void testCopyAndClear() {
    StaticIpConfiguration empty = new StaticIpConfiguration((StaticIpConfiguration) null);
    checkEmpty(empty);
    StaticIpConfiguration s1 = makeTestObject();
    StaticIpConfiguration s2 = new StaticIpConfiguration(s1);
    assertEquals(s1, s2);
    s2.clear();
    assertEquals(empty, s2);
}
Also used : StaticIpConfiguration(android.net.StaticIpConfiguration) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 39 with StaticIpConfiguration

use of android.net.StaticIpConfiguration in project android_frameworks_base by DirtyUnicorns.

the class StaticIpConfigurationTest method passThroughParcel.

private StaticIpConfiguration passThroughParcel(StaticIpConfiguration s) {
    Parcel p = Parcel.obtain();
    StaticIpConfiguration s2 = null;
    try {
        s.writeToParcel(p, 0);
        p.setDataPosition(0);
        s2 = StaticIpConfiguration.CREATOR.createFromParcel(p);
    } finally {
        p.recycle();
    }
    assertNotNull(s2);
    return s2;
}
Also used : Parcel(android.os.Parcel) StaticIpConfiguration(android.net.StaticIpConfiguration)

Example 40 with StaticIpConfiguration

use of android.net.StaticIpConfiguration in project android_frameworks_base by DirtyUnicorns.

the class StaticIpConfigurationTest method makeTestObject.

private StaticIpConfiguration makeTestObject() {
    StaticIpConfiguration s = new StaticIpConfiguration();
    s.ipAddress = ADDR;
    s.gateway = GATEWAY;
    s.dnsServers.add(DNS1);
    s.dnsServers.add(DNS2);
    s.dnsServers.add(DNS3);
    s.domains = "google.com";
    return s;
}
Also used : StaticIpConfiguration(android.net.StaticIpConfiguration)

Aggregations

StaticIpConfiguration (android.net.StaticIpConfiguration)52 SmallTest (android.test.suitebuilder.annotation.SmallTest)25 LinkAddress (android.net.LinkAddress)20 InetAddress (java.net.InetAddress)16 ProxyInfo (android.net.ProxyInfo)11 RouteInfo (android.net.RouteInfo)10 WifiConfiguration (android.net.wifi.WifiConfiguration)6 IpConfiguration (android.net.IpConfiguration)5 IpAssignment (android.net.IpConfiguration.IpAssignment)5 ProxySettings (android.net.IpConfiguration.ProxySettings)5 IpPrefix (android.net.IpPrefix)5 Parcel (android.os.Parcel)5 SparseArray (android.util.SparseArray)5 DataInputStream (java.io.DataInputStream)5 EOFException (java.io.EOFException)5 IOException (java.io.IOException)5 Inet4Address (java.net.Inet4Address)5 HashSet (java.util.HashSet)5 BufferedInputStream (java.io.BufferedInputStream)4 FileInputStream (java.io.FileInputStream)4