StockInfoManager is an entry point to the Sample API. Its getStock method is used to create a StockSymbol object which in turn can be used to retrieve a quote.
public void addQuoteAgent(QuoteAgent agent)
public static StockInfoManager getDefault()
public java.util.Enumeration getQuoteAgents()
public StockSymbol getStock(java.lang.String symbol)
public void removeQuoteAgent(QuoteAgent agent)
public static void setDefault(StockInfoManager newDefault)
public void addQuoteAgent(QuoteAgent agent)
Domain testing of input and output conditions, and external
pre-conditions for class StockInfoManager,
method public void addQuoteAgent(QuoteAgent agent)
.
Pre-conditions | agent | Expected results | Test Case ID |
---|---|---|---|
StockInfoManager lookup table is empty | some QuoteAgent object | StockInfoManager lookup table should contain one reference to agent, this table size should be equal to 1 | StockInfoManager2002 |
StockInfoManager lookup table contains agent | some QuoteAgent that was previously added | StockInfoManager lookup table should contain at least 1 reference to agent | StockInfoManager2002 |
agent was previously added and then removed from the StockInfoManager lookup table. (This table is not empty) | some QuoteAgent object | StockInfoManager lookup table should contain at least one reference to agent | StockInfoManager2002 |
null | NullPointerException should be thrown | StockInfoManager2003 |
Pre-conditions | agent | Expected results | Test Case ID |
---|---|---|---|
StockInfoManager lookup table size equal to 1, it contains a reference to agent. | some QuoteAgentObject | StockInfoManager lookup table should contain at least 1 reference to agent; this table size should be greater than or equal to 1. | StockInfoManager2002 |
StockInfoManager lookup table size equal to 1, it doesn't contain agent. | some QuoteAgent object | StockInfoManager lookup table should contain at least 1 reference to agent;this table size should be greater than 1. | StockInfoManager2002 |
Assertion | Test Case ID |
---|---|
Adds a QuoteAgent to the StockInfoManager lookup table | StockInfoManager2002 |
If the StockInfoManager lookup table contains a QuoteAgent passed, calling this method has no effect. | StockInfoManager2002 |
NullPointerException - if specified agent is null | StockInfoManager2003 |
public static StockInfoManager getDefault()
Domain testing of input and output conditions, and external
pre-conditions for class StockInfoManager,
method public static StockInfoManager getDefault()
.
Pre-conditions | Assertion | Test Case ID |
---|---|---|
There have not been the default StockInfoManager set. | returns default StockInfoManager (may be null) | StockInfoManager2005 |
Some StockInfoManager (not null) is set. | returns default StockInfoManager | StockInfoManager2005 |
null StockInfoManager is set. | returns null | StockInfoManager2005 |
Gets the default StockInfoManager. This may be null. | StockInfoManager2006 |
Test cases included:
StockInfoManager2005,
StockInfoManager2006.
title | public static void setDefault(StockInfoManager newDefault) method tests |
source | SetGetDefTests.java |
executeClass | com.sun.tdk.sampletck.tests.api.StockInfoManager.SetGetDefTests |
executeArgs | -serverHost $remote.serverHost -serverPort $remote.serverPort |
public java.util.Enumeration getQuoteAgents()
Domain testing of input and output conditions, and external
pre-conditions for class StockInfoManager,
method public java.util.Enumeration getQuoteAgents()
.
Pre-conditions | Expected output value | Test Case ID |
---|---|---|
StockInfoManager lookup table is empty | empty Enumeration | StockInfoManager2007 |
StockInfoManager lookup table is not empty | an enumeration of all installed QuoteAgents in the same order they were added to the StockInfoManager | StockInfoManager2007 |
Pre-conditions | Expected output value | Test Case ID |
---|---|---|
StockInfoManager lookup table size equals to 1 | an enumeration of single QuoteAgent | StockInfoManager2007 |
Assertion | Test Case ID |
---|---|
Gets an enumeration of all installed QuoteAgents in the same order they were added to the StockInfoManager. | StockInfoManager2007 |
removeQuoteAgent(agent) doesn't change the order in lookup table. | StockInfoManager2007 |
addQuoteAgent(agent) doesn't change the order in lookup table. | StockInfoManager2007 |
Test cases included:
StockInfoManager2007.
title | public java.util.Enumeration getQuoteAgents() method tests |
source | GetQuoteAgentsTests.java Checker.java |
executeClass | com.sun.tdk.sampletck.tests.api.StockInfoManager.GetQuoteAgentsTests |
executeArgs | -serverHost $remote.serverHost -serverPort $remote.serverPort |
public StockSymbol getStock(java.lang.String symbol)
Domain testing of input and output conditions, and external
pre-conditions for class StockInfoManager,
method public StockSymbol getStock(java.lang.String symbol)
.
Pre-conditions | symbol | Expected output value | Other expected results | Test Case ID |
---|---|---|---|---|
StockInfoManager lookup table contains QuoteAgents that might return requested StockSymbol instance | some String | requested StockSymbol | Returns requested StockSymbol instance through the QuoteAgent installed | StockInfoManager0001 |
StockInfoManager lookup table is empty | some String | null | StockInfoManager0002 | |
StockInfoManager lookup table is empty | null | NullPointerException | StockInfoManager0003 | |
StockInfoManager lookup table isn't empty | null | NullPointerException | StockInfoManager0003 |
Assertion | Test Case ID |
---|---|
If a particular agent cannot retrieve the symbol due to a GetQuoteException, it is ignored. | StockInfoManager2001 |
Test cases included:
StockInfoManager0001,
StockInfoManager0002,
StockInfoManager0003,
StockInfoManager2001.
title | public StockSymbol getStock(java.lang.String symbol) distributed tests |
source | DistributedTests.java |
executeClass | com.sun.tdk.sampletck.tests.api.StockInfoManager.DistributedTests |
executeArgs | -serverHost $remote.serverHost -serverPort $remote.serverPort |
public void removeQuoteAgent(QuoteAgent agent)
Domain testing of input and output conditions, and external
pre-conditions for class StockInfoManager,
method public void removeQuoteAgent(QuoteAgent agent)
.
Pre-conditions | agent | Expected results | Test Case ID |
---|---|---|---|
StockInfoManager lookup table contains agent | some QuoteAgent object | At least one reference to agent should be removed from StockInfoManager lookup table | StockInfoManager2002 |
StockInfoManager lookup table doesn't contain agent | some QuoteAgent object | StockInfoManager lookup table is not changed | StockInfoManager2002 |
agent was previously removed and then added from the StockInfoManager's lookup table. (This table is not empty) | some QuoteAgent object | StockInfoManager lookup table should contain at least one reference to agent | StockInfoManager2002 |
null | NullPointerException should be thrown | StockInfoManager2004 |
Pre-conditions | agent | Expected results | Test Case ID |
---|---|---|---|
StockInfoManager lookup table contains one reference to agent | some QuoteAgent object | StockInfoManager lookup table should not contain agent. | StockInfoManager2002 |
StockInfoManager lookup table is empty | some QuoteAgent object | StockInfoManager lookup table is not changed | StockInfoManager2002 |
Assertion | Test Case ID |
---|---|
Removes a QuoteAgent from the StockInfoManager lookup table | StockInfoManager2002 |
If the StockInfoManager lookup table does not contain QuoteAgent passed, calling this method has no effect. | StockInfoManager2002 |
NullPointerException - if agent is null | StockInfoManager2004 |
Test cases included:
StockInfoManager2002,
StockInfoManager2003,
StockInfoManager2004.
title | StockInfoManager addQuoteAgent() and removeQuoteAgent() methods tests |
source | AddRemoveTests.java Checker.java |
executeClass | com.sun.tdk.sampletck.tests.api.StockInfoManager.AddRemoveTests |
executeArgs | -serverHost $remote.serverHost -serverPort $remote.serverPort |
public static void setDefault(StockInfoManager newDefault)
Domain testing of input and output conditions, and external
pre-conditions for class StockInfoManager,
method public static void setDefault(StockInfoManager newDefault)
.
Pre-conditions | newDefault | Expected results | Test Case ID |
---|---|---|---|
There have not been the default StockInfoManager set. | StockInfoManager object | getDefault() should return newDefault | StockInfoManager2005 |
newDefault is the default StockInfoManager. | StockInfoManager object | getDefault() should return newDefault | StockInfoManager2005 |
The default StockInfoManager other than newDefault is set. | StockInfoManager object | getDefault() should return newDefault | StockInfoManager2005 |
null StockInfoManager | getDefault() should return null | StockInfoManager2006 |
Assertion | Test Case ID |
---|---|
Sets the default StockInfoManager. | StockInfoManager2005 |
If newDefault is null there will be no default StockInfo | StockInfoManager2006 |