Search in sources :

Example 21 with Hostname

use of com.intel.mtwilson.util.net.Hostname in project OpenAttestation by OpenAttestation.

the class HostnameTest method testGetHostname.

@Test
public void testGetHostname() {
    Hostname hostname = new Hostname("hostname");
    assertEquals("hostname", hostname.getHostname());
}
Also used : Hostname(com.intel.mtwilson.util.net.Hostname) Test(org.junit.Test)

Example 22 with Hostname

use of com.intel.mtwilson.util.net.Hostname in project OpenAttestation by OpenAttestation.

the class HostnameTest method testInvalidHostnameExceptionThrown.

@Test(expected = IllegalArgumentException.class)
public void testInvalidHostnameExceptionThrown() {
    Hostname hostname = new Hostname("2,2");
    hostname.isValid();
}
Also used : Hostname(com.intel.mtwilson.util.net.Hostname) Test(org.junit.Test)

Example 23 with Hostname

use of com.intel.mtwilson.util.net.Hostname in project OpenAttestation by OpenAttestation.

the class HostnameTest method testIsValid.

@Test
public void testIsValid() {
    Hostname hostname = new Hostname("hostname");
    hostname.isValid();
}
Also used : Hostname(com.intel.mtwilson.util.net.Hostname) Test(org.junit.Test)

Example 24 with Hostname

use of com.intel.mtwilson.util.net.Hostname in project OpenAttestation by OpenAttestation.

the class HostnameTest method testToString.

@Test
public void testToString() {
    try {
        String name = InetAddress.getLocalHost().toString();
        Hostname hostname = new Hostname(name);
        assertEquals(name, hostname.toString());
    } catch (UnknownHostException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
Also used : UnknownHostException(java.net.UnknownHostException) Hostname(com.intel.mtwilson.util.net.Hostname) Test(org.junit.Test)

Example 25 with Hostname

use of com.intel.mtwilson.util.net.Hostname in project OpenAttestation by OpenAttestation.

the class HostnameTest method testEquals.

@Test
public void testEquals() {
    assertEquals(new Hostname("node1"), new Hostname("node1"));
    assertEquals(new Hostname("null"), new Hostname("null"));
    Hostname hostname1 = new Hostname("hostname1");
    Hostname hostname2 = new Hostname("hostname2");
    Assert.assertFalse("The two obejct is not equal!", hostname1.equals(hostname2));
}
Also used : Hostname(com.intel.mtwilson.util.net.Hostname) Test(org.junit.Test)

Aggregations

Hostname (com.intel.mtwilson.util.net.Hostname)30 Test (org.junit.Test)15 IOException (java.io.IOException)9 ArrayList (java.util.ArrayList)8 TblTaLog (com.intel.mtwilson.as.data.TblTaLog)7 ApiException (com.intel.mtwilson.ApiException)6 SignatureException (java.security.SignatureException)6 DemoPortalException (com.intel.mountwilson.common.DemoPortalException)5 TblHosts (com.intel.mtwilson.as.data.TblHosts)5 Date (java.util.Date)5 ASException (com.intel.mountwilson.as.common.ASException)4 HostsTrustReportType (com.intel.mountwilson.as.hosttrustreport.data.HostsTrustReportType)4 Matchers.anyString (org.mockito.Matchers.anyString)4 CryptographyException (com.intel.mtwilson.crypto.CryptographyException)3 UnknownHostException (java.net.UnknownHostException)3 HostType (com.intel.mountwilson.as.hosttrustreport.data.HostType)2 AttestationReport (com.intel.mtwilson.datatypes.AttestationReport)2 HostTrustResponse (com.intel.mtwilson.datatypes.HostTrustResponse)2 WebApplicationException (javax.ws.rs.WebApplicationException)2 ConfigurationException (org.apache.commons.configuration.ConfigurationException)2