001 package org.hackystat.sensorbase.resource.ping; 002 003 import static org.junit.Assert.assertTrue; 004 import org.hackystat.sensorbase.client.SensorBaseClient; 005 import org.hackystat.sensorbase.test.SensorBaseRestApiHelper; 006 import org.junit.Test; 007 008 /** 009 * Tests the Ping REST API. 010 * 011 * @author Philip Johnson 012 */ 013 public class TestPingRestApi extends SensorBaseRestApiHelper { 014 015 /** 016 * Test that GET {host}/ping returns the service name, and that 017 * GET {host}/ping?user={user}&password={password} is OK. 018 * 019 * @throws Exception If problems occur. 020 */ 021 @Test 022 public void testPing() throws Exception { 023 assertTrue("Checking ping", SensorBaseClient.isHost(getHostName())); 024 //Next, check authenticated ping. 025 String user = "TestPing@hackystat.org"; 026 SensorBaseClient.registerUser(getHostName(), user); 027 SensorBaseClient client = new SensorBaseClient(getHostName(), user, user); 028 client.authenticate(); 029 } 030 }