FRODO Version 2.19.1
An open-source framework for Distributed Constraint Optimization (DCOP)
Loading...
Searching...
No Matches
frodo2.algorithms.dpop.privacy.test.SecureRerootingTest Class Reference

JUnit test for the SecureRerooting module. More...

Inheritance diagram for frodo2.algorithms.dpop.privacy.test.SecureRerootingTest:

Public Member Functions

 SecureRerootingTest (boolean useTCP)
 Constructor.
void randomTest () throws IOException, ClassNotFoundException, NoSuchMethodException
 Test for SecureRerooting module.
synchronized void notifyIn (Message msg)
Collection< MessageTypegetMsgTypes ()
void setQueue (Queue queue)
Public Member Functions inherited from frodo2.communication.IncomingMsgPolicyInterface< T >
default void notifyIn (Message msg, Object toAgent)
 Notifies the listener of an incoming message.

Static Public Member Functions

static TestSuite suite ()

Protected Member Functions

void setUp ()
void tearDown () throws Exception
 Ends all queues.

Protected Attributes

RandGraphFactory.Graph graph
 Random graph used to generate a constraint graph.

Private Member Functions

synchronized boolean testNextComponent ()
 Send a rerooting msg to a not tested component of the graph.
void sendReroot (String dest)
 Send a Reroot request to the destination variable dest.
void end ()
 Send to all agent an AgentFinish message.
synchronized void testResult ()
 Test if the result is correct.

Private Attributes

int maxVar = 9
 The maximum number of variables in this problem.
int maxAgent = 5
 The maximum number of agents in this problem.
int maxEdge = 40
 The maximum number of constraints in this problem.
XCSPparser< AddableInteger, AddableIntegerparser
 Parser for the random XCSP problem.
List< List< String > > components
 The components of the graph still to test.
Map< String, Queuequeues
 List of queues, indexed by agent name.
Map< String, QueueOutputPipeInterfacepipes
 One output pipe used to send messages to each queue, indexed by agent name.
boolean useTCP
 Whether to use TCP or SharedMemory pipes.
int remainingOutput
 number of remaining DFSoutput to wait for
Map< String, Integer > rounds
 number of iterations of the algorithm on a variable
Set< String > roots
 The marked roots.
int nbrAgents
 The number of agents that have not yet sent their AGENT_FINISHED message.
final ReentrantLock finished_lock = new ReentrantLock ()
 Used to make the test thread wait.
final Condition finished = finished_lock.newCondition()
 Used to wake up the test thread when all agents have finished.
Queue myQueue
 The controller's queue.
ArrayList< MessagependingMsgs
 DFS order messages whose processing must be postponed until all key shares have been exchanged.

Detailed Description

JUnit test for the SecureRerooting module.

Author
Eric Zbinden, Thomas Leaute

Constructor & Destructor Documentation

◆ SecureRerootingTest()

frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.SecureRerootingTest ( boolean useTCP)

Constructor.

Parameters
useTCPif TCP is used or shared memory pipe.

References useTCP.

Referenced by suite().

Member Function Documentation

◆ end()

void frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.end ( )
private

Send to all agent an AgentFinish message.

References frodo2.algorithms.AgentInterface< V extends Addable< V > >.AGENT_FINISHED, and queues.

Referenced by notifyIn().

◆ getMsgTypes()

◆ notifyIn()

◆ randomTest()

void frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.randomTest ( ) throws IOException, ClassNotFoundException, NoSuchMethodException

Test for SecureRerooting module.

Exceptions
IOExceptionthrown when failed to create TCP pipes
ClassNotFoundExceptionshould never happen
NoSuchMethodExceptionif the CryptoScheme does not have a constructor that takes in an Element

References frodo2.communication.Queue.addIncomingMessagePolicy(), frodo2.communication.Queue.addOutgoingMessagePolicy(), components, frodo2.algorithms.varOrdering.election.tests.LeaderElectionMaxIDTest< S extends Comparable< S > >.computeLeaders(), frodo2.algorithms.test.AllTests.createQueueNetwork(), frodo2.algorithms.test.AllTests.generateProblem(), frodo2.algorithms.RandGraphFactory.getRandGraph(), frodo2.algorithms.dpop.privacy.SecureCircularRouting.getStatsFromQueue(), frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.getStatsFromQueue(), frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getSubProblem(), graph, maxAgent, maxEdge, maxVar, myQueue, nbrAgents, frodo2.algorithms.dpop.privacy.SecureRerooting< C extends Addable< C >, E extends AddableLimited< C, E >.OUTPUT, frodo2.algorithms.XCSPparser< V extends Addable< V >, U extends Addable< U > >.parse(), parser, pipes, queues, frodo2.algorithms.dpop.privacy.test.FakeCryptoScheme.resetCounter(), frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.ROOT_VAR_MSG_TYPE, rounds, frodo2.communication.Queue.sendMessageToSelf(), frodo2.communication.Queue.setProblem(), frodo2.algorithms.dpop.privacy.SecureCircularRouting.setSilent(), frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.setSilent(), frodo2.algorithms.AgentInterface< V extends Addable< V > >.START_AGENT, frodo2.algorithms.AgentInterface< V extends Addable< V > >.STATS_MONITOR, and testResult().

Here is the call graph for this function:

◆ sendReroot()

void frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.sendReroot ( String dest)
private

Send a Reroot request to the destination variable dest.

Parameters
destthe destination of the reroot request message

References graph.

Referenced by notifyIn(), and testNextComponent().

◆ setQueue()

void frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.setQueue ( Queue queue)

◆ setUp()

void frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.setUp ( )
protected
See also
junit.framework.TestCase#setUp()

References pendingMsgs, roots, and rounds.

◆ suite()

TestSuite frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.suite ( )
static
Returns
the test suite for this test

References SecureRerootingTest().

Referenced by frodo2.algorithms.dpop.privacy.test.AllTestsP_DPOP.suite().

Here is the call graph for this function:

◆ tearDown()

void frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.tearDown ( ) throws Exception
protected

Ends all queues.

See also
junit.framework.TestCase#tearDown()

References graph, pipes, queues, roots, and rounds.

◆ testNextComponent()

synchronized boolean frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.testNextComponent ( )
private

Send a rerooting msg to a not tested component of the graph.

Returns
true if the complete graph has already been tested, else send a rerooting msg to each variable of the next component and return false.

References components, remainingOutput, sendReroot(), and testNextComponent().

Referenced by notifyIn(), and testNextComponent().

Here is the call graph for this function:

◆ testResult()

synchronized void frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.testResult ( )
private

Test if the result is correct.

References graph, and roots.

Referenced by randomTest().

Member Data Documentation

◆ components

List<List<String> > frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.components
private

The components of the graph still to test.

Referenced by notifyIn(), randomTest(), and testNextComponent().

◆ finished

final Condition frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.finished = finished_lock.newCondition()
private

Used to wake up the test thread when all agents have finished.

◆ finished_lock

final ReentrantLock frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.finished_lock = new ReentrantLock ()
private

Used to make the test thread wait.

◆ graph

RandGraphFactory.Graph frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.graph
protected

Random graph used to generate a constraint graph.

Referenced by notifyIn(), randomTest(), sendReroot(), tearDown(), and testResult().

◆ maxAgent

int frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.maxAgent = 5
private

The maximum number of agents in this problem.

Referenced by randomTest().

◆ maxEdge

int frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.maxEdge = 40
private

The maximum number of constraints in this problem.

Referenced by randomTest().

◆ maxVar

int frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.maxVar = 9
private

The maximum number of variables in this problem.

Referenced by randomTest().

◆ myQueue

Queue frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.myQueue
private

The controller's queue.

Referenced by randomTest().

◆ nbrAgents

int frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.nbrAgents
private

The number of agents that have not yet sent their AGENT_FINISHED message.

Referenced by randomTest().

◆ parser

XCSPparser<AddableInteger, AddableInteger> frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.parser
private

Parser for the random XCSP problem.

Referenced by randomTest().

◆ pendingMsgs

ArrayList<Message> frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.pendingMsgs
private

DFS order messages whose processing must be postponed until all key shares have been exchanged.

Referenced by setUp().

◆ pipes

Map<String, QueueOutputPipeInterface> frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.pipes
private

One output pipe used to send messages to each queue, indexed by agent name.

Referenced by randomTest(), and tearDown().

◆ queues

Map<String, Queue> frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.queues
private

List of queues, indexed by agent name.

Referenced by end(), randomTest(), and tearDown().

◆ remainingOutput

int frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.remainingOutput
private

number of remaining DFSoutput to wait for

Referenced by notifyIn(), and testNextComponent().

◆ roots

Set<String> frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.roots
private

The marked roots.

Referenced by notifyIn(), setUp(), tearDown(), and testResult().

◆ rounds

Map<String, Integer> frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.rounds
private

number of iterations of the algorithm on a variable

Referenced by notifyIn(), randomTest(), setUp(), and tearDown().

◆ useTCP

boolean frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.useTCP
private

Whether to use TCP or SharedMemory pipes.

Referenced by SecureRerootingTest().


The documentation for this class was generated from the following file: