FRODO Version 2.19.1
An open-source framework for Distributed Constraint Optimization (DCOP)
Loading...
Searching...
No Matches
frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > > Class Template Reference

Unit tests for VariableObfuscation. More...

Inheritance diagram for frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > >:

Public Member Functions

 VariableObfuscationTest (String method, boolean useTCP, Class< V > domClass)
 Constructor that instantiates a test only for the input method.
void testMerged () throws Exception
 Tests whenever all name and values are correctly obfuscated in mergeBack mode Also tests that parents send always the same codeName and domain to all of their children.
void testUnique () throws Exception
 Tests whenever all name and values are correctly obfuscated without mergeBack mode Also test that all codeNames and domains are different.
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.
Map< String, QueueOutputPipeInterfacepipes
 One output pipe used to send messages to each queue, indexed by the queue's agent name.

Private Member Functions

void randomTest (boolean mergeBack) throws IOException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException

Private Attributes

int maxNbrVars = 7
 Maximum number of variables in the random graph.
int maxNbrEdges = 35
 Maximum number of edges in the random graph.
int maxNbrAgents = 7
 Maximum number of agents.
boolean mergeBack
 If mergeBack is used or not.
Map< String, Queuequeues
 List of queues, indexed by agent name.
final boolean useTCP
 Whether to test using TCP pipes.
final Object lock = new Object ()
 Lock used to synchronize access to this module's members.
Set< String > cn
 A set with all codeNames.
Map< String, String > cns
 A map with codeNames used to test if all codeNames are identical in mergeBack mode.
Set< List< V > > vs
 A set with all obfuscated domain.
Map< String, List< V > > vss
 A map with obfuscated domains used to test if all domains are identical in mergeBack mode.
XCSPparser< V, AddableBigIntegerparser
 Parser for the random XCSP problem.
ArrayList< String > receivedCN
 List of received codeNames in Obfuscated UTIL messages.
ArrayList< List< V > > receivedDom
 List of received domains in Obfuscated UTIL messages.
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.
Class< V > domClass
 The class used for variable values.

Detailed Description

Unit tests for VariableObfuscation.

Author
Eric Zbinden, Thomas Leaute
Parameters
<V>the type used for variable values
Todo

Add test to verify that all variables are using the transmitted codeName and domain

Add test that testifies that all domains used correspond to the correct variable/codeName in UTILmsg

Constructor & Destructor Documentation

◆ VariableObfuscationTest()

frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > >.VariableObfuscationTest ( String method,
boolean useTCP,
Class< V > domClass )

Constructor that instantiates a test only for the input method.

Parameters
methodtest method
useTCPwhether to use TCP pipes
domClassThe class used for variable values

References domClass, and useTCP.

Referenced by suite().

Member Function Documentation

◆ getMsgTypes()

◆ notifyIn()

◆ randomTest()

void frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > >.randomTest ( boolean mergeBack) throws IOException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException
private
Parameters
mergeBackif we are in mergeBack mode or not
Exceptions
IOExceptionif an IO exception occur
NoSuchMethodExceptionif VariableObfuscation does not have a constructor with the required signature
InvocationTargetExceptionif the constructor for VariableObfuscation throws an exception
IllegalAccessExceptionif the constructor for VariableObfuscation is inaccessible
InstantiationExceptionif VariableObfuscation is an abstract class
IllegalArgumentExceptionif the constructor of VariableObfuscation is passed incorrect parameters

References frodo2.communication.Queue.addIncomingMessagePolicy(), frodo2.communication.Queue.addOutgoingMessagePolicy(), cn, frodo2.algorithms.test.AllTests.createQueueNetwork(), frodo2.communication.Queue.end(), frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getAgentNeighborhoods(), 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, mergeBack, nbrAgents, frodo2.algorithms.XCSPparser< V extends Addable< V >, U extends Addable< U > >.parse(), pipes, queues, receivedCN, receivedDom, frodo2.communication.Queue.setProblem(), 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, useTCP, and vs.

Referenced by testMerged(), and testUnique().

Here is the call graph for this function:

◆ setQueue()

◆ setUp()

void frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > >.setUp ( )
protected
See also
junit.framework.TestCase#setUp()

References cn, cns, frodo2.algorithms.test.AllTests.generateProblem(), frodo2.algorithms.RandGraphFactory.getRandGraph(), graph, maxNbrAgents, maxNbrEdges, maxNbrVars, parser, receivedCN, receivedDom, vs, and vss.

Here is the call graph for this function:

◆ suite()

TestSuite frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > >.suite ( )
static
Returns
the test suite for this test

References VariableObfuscationTest().

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.VariableObfuscationTest< V extends Addable< V > >.tearDown ( ) throws Exception
protected

Ends all queues.

See also
junit.framework.TestCase#tearDown()

References cn, cns, graph, pipes, queues, receivedCN, receivedDom, vs, and vss.

◆ testMerged()

void frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > >.testMerged ( ) throws Exception

Tests whenever all name and values are correctly obfuscated in mergeBack mode Also tests that parents send always the same codeName and domain to all of their children.

Exceptions
Exceptionif an error occurs

References randomTest().

Here is the call graph for this function:

◆ testUnique()

void frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > >.testUnique ( ) throws Exception

Tests whenever all name and values are correctly obfuscated without mergeBack mode Also test that all codeNames and domains are different.

Exceptions
Exceptionif an error occurs

References randomTest().

Here is the call graph for this function:

Member Data Documentation

◆ cn

Set<String> frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > >.cn
private

A set with all codeNames.

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

◆ cns

Map<String, String> frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > >.cns
private

A map with codeNames used to test if all codeNames are identical in mergeBack mode.

Variable - CodeName

Referenced by setUp(), and tearDown().

◆ domClass

Class<V> frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > >.domClass
private

The class used for variable values.

Referenced by VariableObfuscationTest().

◆ finished

final Condition frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > >.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.VariableObfuscationTest< V extends Addable< V > >.finished_lock = new ReentrantLock ()
private

Used to make the test thread wait.

◆ graph

RandGraphFactory.Graph frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > >.graph
protected

Random graph used to generate a constraint graph.

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

◆ lock

final Object frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > >.lock = new Object ()
private

Lock used to synchronize access to this module's members.

This is required because this module is registered to multiple queues, therefore multiple threads can call notifyIn simultaneously.

◆ maxNbrAgents

int frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > >.maxNbrAgents = 7
private

Maximum number of agents.

Referenced by setUp().

◆ maxNbrEdges

int frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > >.maxNbrEdges = 35
private

Maximum number of edges in the random graph.

Referenced by setUp().

◆ maxNbrVars

int frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > >.maxNbrVars = 7
private

Maximum number of variables in the random graph.

Note
Must be at least 2.

Referenced by setUp().

◆ mergeBack

boolean frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > >.mergeBack
private

If mergeBack is used or not.

Referenced by randomTest().

◆ nbrAgents

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

Referenced by randomTest().

◆ parser

Parser for the random XCSP problem.

Referenced by setUp().

◆ pipes

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

Referenced by randomTest(), and tearDown().

◆ queues

Map<String, Queue> frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > >.queues
private

List of queues, indexed by agent name.

Referenced by randomTest(), and tearDown().

◆ receivedCN

ArrayList<String> frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > >.receivedCN
private

List of received codeNames in Obfuscated UTIL messages.

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

◆ receivedDom

ArrayList< List<V> > frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > >.receivedDom
private

List of received domains in Obfuscated UTIL messages.

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

◆ useTCP

final boolean frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > >.useTCP
private

Whether to test using TCP pipes.

Referenced by randomTest(), and VariableObfuscationTest().

◆ vs

Set< List<V> > frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > >.vs
private

A set with all obfuscated domain.

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

◆ vss

Map< String, List<V> > frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > >.vss
private

A map with obfuscated domains used to test if all domains are identical in mergeBack mode.

CodeName - Obfuscated Domain

Referenced by setUp(), and tearDown().


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