Databases Reference
In-Depth Information
Results
The cluster generates useful data about the customers viewing a specific product and
stores them in a Redis Hash named “prodcnt:” followed by the product ID.
redis 127.0.0.1:6379> hgetall prodcnt:2
1) "Players"
2) "1"
3) "Cameras"
4) "2"
Testing the Topology
In order to test the topology, use the provided LocalCluster and a local Redis server
(see Figure 6-7 ). You'll populate the products database on init and mock the insertion
of navigation logs in the Redis server. Our assertions will be performed by reading the
topology outputs to the Redis server. Tests are written in Java and Groovy.
Figure 6-7. The testing architecture
Test Initialization
Initialization consists of three steps:
Start the LocalCluster and submit the Topology. Initialization is implemented
in the AbstractAnalyticsTest, which is extended by all tests. A static flag called topo-
logyStarted is used to avoid initializing more than once when multiple AbstractAnaly-
ticsTest subclasses are instantiated.
Note that the sleep is there to allow the LocalCluster to start correctly before attempting
to retrieve results from it.
 
Search WWH ::




Custom Search