org.hackystat.sensorbase.resource.projects
Class TestProjectRestApi

java.lang.Object
  extended by org.hackystat.sensorbase.test.SensorBaseRestApiHelper
      extended by org.hackystat.sensorbase.resource.projects.TestProjectRestApi

public class TestProjectRestApi
extends SensorBaseRestApiHelper

Tests the SensorBase REST API for Project resources.

Author:
Philip M. Johnson

Field Summary
 
Fields inherited from class org.hackystat.sensorbase.test.SensorBaseRestApiHelper
adminEmail, adminPassword, projectManager, sdtManager, sensorDataManager, server, userManager
 
Constructor Summary
TestProjectRestApi()
           
 
Method Summary
 void getProjectIndex()
          Test that GET host/sensorbase/projects returns an index containing at least one Project.
 void getTestUserProject()
          Test that GET host/sensorbase/projects/TestUser@hackystat.org/TestProject returns a representation of TestProject.
 void getTestUserProjectIndex()
          Test that GET host/sensorbase/projects/TestUser@hackystat.org returns an index containing at least one ProjectRef.
 void getTestUserProjectSdtParam()
          Test that the GET of a project with the SDT parameter works correctly.
 void getTestUserProjectSensorData()
          Test that GET host/sensorbase/projects/TestUser@hackystat.org/TestProject/sensordata returns an index of SensorData.
 void getTestUserProjectSensorDataInterval()
          Test that GET host/sensorbase/projects/TestUser@hackystat.org/TestProject/sensordata? startTime=2006-04-30T09:00:00.000&endTime=2007-04-30T09:30:00.000 returns an index of SensorData containing one entry.
 void getTestUserProjectSensorSummary()
          Test that GET host/sensorbase/projects/TestUser@hackystat.org/TestProject/sensordata? startTime=2006-04-30T09:00:00.000&endTime=2007-04-30T09:30:00.000 returns an index of SensorData containing one entry.
 void getTestUserProjectSnapshot()
          Tests the snapshot API.
 void getTestUserProjectStartIndexMaxInstancesParams()
          Test that the GET of a project with the startIndex/maxInstances parameters work correctly.
 void newUserTest()
          Tests that after creating a new User, it has a Default Project.
 void putBadProjects()
          Test that PUT of incomplete project definitions causes errors.
 void putMultipleProject()
          Test that PUT multiple times does not cause a problem for getProjectIndex.
 void putProject()
          Test that PUT, rename, and DELETE of host/projects/{user}/{project} works.
 void testUserDefaultProjectData()
          Tests that we can retrieve all data for the TestUser under their Default Project.
 
Methods inherited from class org.hackystat.sensorbase.test.SensorBaseRestApiHelper
getHostName, setupServer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestProjectRestApi

public TestProjectRestApi()
Method Detail

getProjectIndex

public void getProjectIndex()
                     throws java.lang.Exception
Test that GET host/sensorbase/projects returns an index containing at least one Project. This is an admin-only request. Probably want to (at)ignore this method on real distributions, since the returned dataset could be large.

Throws:
java.lang.Exception - If problems occur.

getTestUserProjectIndex

public void getTestUserProjectIndex()
                             throws java.lang.Exception
Test that GET host/sensorbase/projects/TestUser@hackystat.org returns an index containing at least one ProjectRef.

Throws:
java.lang.Exception - If problems occur.

getTestUserProject

public void getTestUserProject()
                        throws java.lang.Exception
Test that GET host/sensorbase/projects/TestUser@hackystat.org/TestProject returns a representation of TestProject.

Throws:
java.lang.Exception - If problems occur.

getTestUserProjectSensorData

public void getTestUserProjectSensorData()
                                  throws java.lang.Exception
Test that GET host/sensorbase/projects/TestUser@hackystat.org/TestProject/sensordata returns an index of SensorData.

Throws:
java.lang.Exception - If problems occur.

getTestUserProjectSensorSummary

public void getTestUserProjectSensorSummary()
                                     throws java.lang.Exception
Test that GET host/sensorbase/projects/TestUser@hackystat.org/TestProject/sensordata? startTime=2006-04-30T09:00:00.000&endTime=2007-04-30T09:30:00.000 returns an index of SensorData containing one entry.

Throws:
java.lang.Exception - If problems occur.

getTestUserProjectSnapshot

public void getTestUserProjectSnapshot()
                                throws java.lang.Exception
Tests the snapshot API.

Throws:
java.lang.Exception - If problems occur.

getTestUserProjectSensorDataInterval

public void getTestUserProjectSensorDataInterval()
                                          throws java.lang.Exception
Test that GET host/sensorbase/projects/TestUser@hackystat.org/TestProject/sensordata? startTime=2006-04-30T09:00:00.000&endTime=2007-04-30T09:30:00.000 returns an index of SensorData containing one entry.

Throws:
java.lang.Exception - If problems occur.

getTestUserProjectSdtParam

public void getTestUserProjectSdtParam()
                                throws java.lang.Exception
Test that the GET of a project with the SDT parameter works correctly. Assumes that the default XML data files are loaded, which result in two sensor data entries for TestUser@hackystat.org on 2007-04-30, one with SDT=TestSdt and one with SDT=SampleSdt.

Throws:
java.lang.Exception - If problems occur.

getTestUserProjectStartIndexMaxInstancesParams

public void getTestUserProjectStartIndexMaxInstancesParams()
                                                    throws java.lang.Exception
Test that the GET of a project with the startIndex/maxInstances parameters work correctly. Assumes that the default XML data files are loaded, which result in two sensor data entries for TestUser@hackystat.org on 2007-04-30, one with SDT=TestSdt and one with SDT=SampleSdt. We'll try a few combinations of startIndex and maxInstances to see that the proper number of instances are returned.

Throws:
java.lang.Exception - If problems occur.

putProject

public void putProject()
                throws java.lang.Exception
Test that PUT, rename, and DELETE of host/projects/{user}/{project} works.

Throws:
java.lang.Exception - If problems occur.

putBadProjects

public void putBadProjects()
                    throws java.lang.Exception
Test that PUT of incomplete project definitions causes errors.

Throws:
java.lang.Exception - If problems occur.

putMultipleProject

public void putMultipleProject()
                        throws java.lang.Exception
Test that PUT multiple times does not cause a problem for getProjectIndex.

Throws:
java.lang.Exception - If problems occur.

newUserTest

public void newUserTest()
                 throws java.lang.Exception
Tests that after creating a new User, it has a Default Project.

Throws:
java.lang.Exception - If problems occur.

testUserDefaultProjectData

public void testUserDefaultProjectData()
                                throws java.lang.Exception
Tests that we can retrieve all data for the TestUser under their Default Project.

Throws:
java.lang.Exception - If problems occur.