edu.sdsc.inca
Class AgentClientTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by edu.sdsc.inca.AgentClientTest
All Implemented Interfaces:
junit.framework.Test

public class AgentClientTest
extends junit.framework.TestCase

A unit test driver for the Agent and AgentClient classes.


Field Summary
static int ATTRIBUTE_COUNT
           
static java.lang.String[] REPORTER_BODIES
           
 
Constructor Summary
AgentClientTest()
           
 
Method Summary
static void makeRepository(java.lang.String path, int first, int last)
          Generate a sample reporter repository using the global reporters in this file.
 void setUp()
          Start up an Inca agent server and a client for testing
 void tearDown()
          Shutdown the global client and agent server.
 void testCatalogEmpty()
          Tests whether the agent can send a catalog w/no reporters.
 void testCatalogRefresh()
          Tests whether the agent refreshes its repository cache when asked for its combined catalog.
 void testCatalogSingle()
          Tests whether the agent can sent a catalog from a single repository.
 void testConfigCommand()
          Test agent resource transmission.
 void testConfigEmpty()
          Tests that the agent can report and process an empty configuration.
 void testRepositoryDelete()
          Tests whether the agent can shorten its repository list.
 void testRepositoryMultiple()
          Tests whether the agent can process multiple valid repositories.
 void testRepositorySingle()
          Tests whether the agent can process a valid repository.
 void testSuiteCommands()
          Test Agent suite manipulation.
 void testSuitesMultiple()
          Test the setConfig and getConfig commands with a mock depot.
 void testSuitesProxy()
          Test the ability for agent to send proxy information.
 void testSuitesProxyBad()
          Test the ability for agent to send proxy information.
 void testSuiteWithPackageUpdate()
          The repository cache will check for package updates periodically or whenever the Agent's setRepositories function is invoked.
static void updateVersionInCatalog(edu.sdsc.inca.repository.Repositories repositories, java.lang.String reporterName, java.lang.String version)
          Change the version of a reporter in the reporter repository.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ATTRIBUTE_COUNT

public static final int ATTRIBUTE_COUNT
See Also:
Constant Field Values

REPORTER_BODIES

public static final java.lang.String[] REPORTER_BODIES
Constructor Detail

AgentClientTest

public AgentClientTest()
Method Detail

makeRepository

public static void makeRepository(java.lang.String path,
                                  int first,
                                  int last)
                           throws java.io.IOException
Generate a sample reporter repository using the global reporters in this file.

Parameters:
path - The destination of the reporter repository.
first - The start index of the reporters to include in the repository
last - The end index of the reporters to include in the repository
Throws:
java.io.IOException - if problem creating repository

setUp

public void setUp()
           throws java.lang.Exception
Start up an Inca agent server and a client for testing

Overrides:
setUp in class junit.framework.TestCase
Throws:
java.lang.Exception

tearDown

public void tearDown()
              throws java.lang.Exception
Shutdown the global client and agent server.

Overrides:
tearDown in class junit.framework.TestCase
Throws:
java.lang.Exception

testCatalogEmpty

public void testCatalogEmpty()
Tests whether the agent can send a catalog w/no reporters.


testCatalogSingle

public void testCatalogSingle()
Tests whether the agent can sent a catalog from a single repository.


testCatalogRefresh

public void testCatalogRefresh()
Tests whether the agent refreshes its repository cache when asked for its combined catalog.


testConfigCommand

public void testConfigCommand()
                       throws java.lang.Exception
Test agent resource transmission.

Throws:
java.lang.Exception - if problem running test

testConfigEmpty

public void testConfigEmpty()
Tests that the agent can report and process an empty configuration.


testRepositoryDelete

public void testRepositoryDelete()
Tests whether the agent can shorten its repository list.


testRepositorySingle

public void testRepositorySingle()
Tests whether the agent can process a valid repository.


testRepositoryMultiple

public void testRepositoryMultiple()
Tests whether the agent can process multiple valid repositories.


testSuiteCommands

public void testSuiteCommands()
                       throws java.lang.Exception
Test Agent suite manipulation. This test starts up a MockDepot and waits for 2 reports to be sent to it before moving on. This test could take a couple minutes to complete.

Throws:
java.lang.Exception - if problem running test

testSuitesProxy

public void testSuitesProxy()
Test the ability for agent to send proxy information.


testSuitesProxyBad

public void testSuitesProxyBad()
Test the ability for agent to send proxy information.


testSuitesMultiple

public void testSuitesMultiple()
Test the setConfig and getConfig commands with a mock depot.


testSuiteWithPackageUpdate

public void testSuiteWithPackageUpdate()
                                throws java.lang.Exception
The repository cache will check for package updates periodically or whenever the Agent's setRepositories function is invoked. This test will first set the package check update period frequency to every 30 seconds and then update the version of the gcc version reporter to "10". To verify, it will wait for the next report and check it's version. Once verified, we set the update frequency to every 4 hours (the default) and then update the version of the gcc version reporter to "20". Then we invoke the Agent's setRepository function and verify the update was made in the next report that is received.

Throws:
java.lang.Exception - if problem running test

updateVersionInCatalog

public static void updateVersionInCatalog(edu.sdsc.inca.repository.Repositories repositories,
                                          java.lang.String reporterName,
                                          java.lang.String version)
                                   throws java.io.IOException
Change the version of a reporter in the reporter repository.

Parameters:
repositories - A list of reporter repositories
reporterName - The name of the reporter to change the version on
version - The new version of the reporter.
Throws:
java.io.IOException - if problem updating catalog