org.nuiton.topia.replication
Class TopiaReplicationServiceImplTest

java.lang.Object
  extended by org.junit.Assert
      extended by org.nuiton.topia.replication.AbstractTopiaReplicationServiceTest
          extended by org.nuiton.topia.replication.TopiaReplicationServiceImplTest

public class TopiaReplicationServiceImplTest
extends AbstractTopiaReplicationServiceTest

TopiaReplicationServiceImplTest on model TopiaTest

Created: 07 jun. 09 17:14:22

Since:
2.2.0
Author:
tchemit

Field Summary
protected static TopiaEntityEnum[] contracts
           
protected static String entitiesList
           
protected static Person person
           
protected static Person person2
           
protected static Pet pet
           
protected static Pet pet2
           
protected static Pet pet3
           
protected static Race race
           
protected static Race race2
           
protected static Race race3
           
protected static File tesDir
           
 
Fields inherited from class org.nuiton.topia.replication.AbstractTopiaReplicationServiceTest
context, ctxt, dstCtxt, init, model, service
 
Constructor Summary
TopiaReplicationServiceImplTest()
           
 
Method Summary
static void after()
           
static void beforeClass()
           
protected  TopiaContext createDb(String name)
           
protected  TopiaContext createDb2(String name)
           
protected  TopiaEntityEnum[] getContracts()
           
protected  Properties getH2Properties(String dbName)
           
protected  org.apache.commons.logging.Log getLog()
           
 void setUp()
           
 void tearDown()
           
 void testDetectAssociations()
          Test of detectAssociations method, of class ReplicationModel.
 void testDetectDependencies()
          Test of detectDependencies method, of class ReplicationModel.
 void testDetectDirectDependencies()
          Test of detectDirectDependencies method, of class ReplicationModel.
 void testDetectObjectsToDettach()
          Test of detectObjectsToDettach method, of class ReplicationModel.
 void testDetectOperations()
          Test of detectOperations method, of class ReplicationModel.
 void testDetectShell()
          Test of detectShell method, of class ReplicationModel.
 void testDetectTypes()
          Test of detectTypes method, of class ReplicationServiceImplementor.
 void testDoReplicate()
          Test of doReplicate method, of class ReplicationService.
 void testGetOperation()
          Test of getOperation method, of class ReplicationServiceImplementor.
 void testSimpleReplicateFailed()
          Cette methode montre pourquoi la simple replication ne peut pas fonctionne :)

Le replicateur ne deplique pas dans le bon ordre et on a donc des violations de clef etrangeres...

 void testSimpleReplicateNotSure()
          Cette methode montre comment manuellement on peut effectuer la replication (en dettachant les dependances qui forment des cycles)

La methode utilisee ici peut ne pas fonctionner : si une clef metier est posee sur une dependance alors cela ne fonctionne pas.

 void testSimpleReplicateSure()
          Cette methode montre comment manuellement on peut effectuer la replication (en dettachant les associations qui forment des cycles)

La methode utilisee ici fonctionne mieux que la precedante : il parrait dificille de pose une une clef metier sur une association :).

 
Methods inherited from class org.nuiton.topia.replication.AbstractTopiaReplicationServiceTest
assertDbEquals, assertEntityEquals, createModel, createReplicateDb, createUnsupportedAfterOperation, createUnsupportedBeforeOperation, detectAssociations, detectDependencies, detectDirectDependencies, detectObjectsToDettach, detectOperations, detectShell, detectTypes, doReplicate, doReplicateAll, doReplicateWithComputedOrder, getModelBuilder, getOperation, getTestDir, getTestsTimeStamp, prepareModel, prepareModelAll, prepareModelWithComputedOrder, update
 
Methods inherited from class org.junit.Assert
assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertThat, assertThat, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contracts

protected static final TopiaEntityEnum[] contracts

entitiesList

protected static final String entitiesList

person

protected static Person person

person2

protected static Person person2

pet

protected static Pet pet

pet2

protected static Pet pet2

pet3

protected static Pet pet3

race

protected static Race race

race2

protected static Race race2

race3

protected static Race race3

tesDir

protected static File tesDir
Constructor Detail

TopiaReplicationServiceImplTest

public TopiaReplicationServiceImplTest()
Method Detail

beforeClass

public static void beforeClass()
                        throws IOException
Throws:
IOException

after

public static void after()
                  throws Exception
Throws:
Exception

setUp

public void setUp()
           throws Exception
Overrides:
setUp in class AbstractTopiaReplicationServiceTest
Throws:
Exception

tearDown

public void tearDown()
              throws Exception
Overrides:
tearDown in class AbstractTopiaReplicationServiceTest
Throws:
Exception

testDetectTypes

public void testDetectTypes()
                     throws Exception
Description copied from class: AbstractTopiaReplicationServiceTest
Test of detectTypes method, of class ReplicationServiceImplementor.

Overrides:
testDetectTypes in class AbstractTopiaReplicationServiceTest
Throws:
Exception - if any error

testGetOperation

public void testGetOperation()
                      throws Exception
Description copied from class: AbstractTopiaReplicationServiceTest
Test of getOperation method, of class ReplicationServiceImplementor.

Overrides:
testGetOperation in class AbstractTopiaReplicationServiceTest
Throws:
Exception - if any error

testDetectAssociations

public void testDetectAssociations()
                            throws Exception
Description copied from class: AbstractTopiaReplicationServiceTest
Test of detectAssociations method, of class ReplicationModel.

Overrides:
testDetectAssociations in class AbstractTopiaReplicationServiceTest
Throws:
Exception - if any error

testDetectDirectDependencies

public void testDetectDirectDependencies()
                                  throws Exception
Description copied from class: AbstractTopiaReplicationServiceTest
Test of detectDirectDependencies method, of class ReplicationModel.

Overrides:
testDetectDirectDependencies in class AbstractTopiaReplicationServiceTest
Throws:
Exception - if any error

testDetectShell

public void testDetectShell()
                     throws Exception
Description copied from class: AbstractTopiaReplicationServiceTest
Test of detectShell method, of class ReplicationModel.

Overrides:
testDetectShell in class AbstractTopiaReplicationServiceTest
Throws:
Exception - if any error

testDetectDependencies

public void testDetectDependencies()
                            throws Exception
Description copied from class: AbstractTopiaReplicationServiceTest
Test of detectDependencies method, of class ReplicationModel.

Overrides:
testDetectDependencies in class AbstractTopiaReplicationServiceTest
Throws:
Exception - if any error

testDetectObjectsToDettach

public void testDetectObjectsToDettach()
                                throws Exception
Description copied from class: AbstractTopiaReplicationServiceTest
Test of detectObjectsToDettach method, of class ReplicationModel.

Overrides:
testDetectObjectsToDettach in class AbstractTopiaReplicationServiceTest
Throws:
Exception - if any error

testDetectOperations

public void testDetectOperations()
                          throws Exception
Description copied from class: AbstractTopiaReplicationServiceTest
Test of detectOperations method, of class ReplicationModel.

Overrides:
testDetectOperations in class AbstractTopiaReplicationServiceTest
Throws:
Exception - if any error

testDoReplicate

public void testDoReplicate()
                     throws Exception
Description copied from class: AbstractTopiaReplicationServiceTest
Test of doReplicate method, of class ReplicationService.

Overrides:
testDoReplicate in class AbstractTopiaReplicationServiceTest
Throws:
Exception - if any error

testSimpleReplicateFailed

public void testSimpleReplicateFailed()
                               throws Exception
Cette methode montre pourquoi la simple replication ne peut pas fonctionne :)

Le replicateur ne deplique pas dans le bon ordre et on a donc des violations de clef etrangeres...

Throws:
Exception - pour toute erreur

testSimpleReplicateNotSure

public void testSimpleReplicateNotSure()
                                throws Exception
Cette methode montre comment manuellement on peut effectuer la replication (en dettachant les dependances qui forment des cycles)

La methode utilisee ici peut ne pas fonctionner : si une clef metier est posee sur une dependance alors cela ne fonctionne pas.

Throws:
Exception - pour toute erreur

testSimpleReplicateSure

public void testSimpleReplicateSure()
                             throws Exception
Cette methode montre comment manuellement on peut effectuer la replication (en dettachant les associations qui forment des cycles)

La methode utilisee ici fonctionne mieux que la precedante : il parrait dificille de pose une une clef metier sur une association :).

On remarque que l'on dettache l'assocation qui forme un cycle et que l'on est pas obligee de la reattachee car elle est bi-directionnelle.

On doit optimiser l'algorithme dans la methode ReplicationModel.adjustOperations(TopiaEntityIdsMap).

Throws:
Exception - pour toute erreur

createDb

protected TopiaContext createDb(String name)
                         throws Exception
Specified by:
createDb in class AbstractTopiaReplicationServiceTest
Throws:
Exception

createDb2

protected TopiaContext createDb2(String name)
                          throws Exception
Specified by:
createDb2 in class AbstractTopiaReplicationServiceTest
Throws:
Exception

getContracts

protected TopiaEntityEnum[] getContracts()
Specified by:
getContracts in class AbstractTopiaReplicationServiceTest

getLog

protected org.apache.commons.logging.Log getLog()
Specified by:
getLog in class AbstractTopiaReplicationServiceTest

getH2Properties

protected Properties getH2Properties(String dbName)
                              throws IOException
Throws:
IOException


Copyright © 2004-2011 CodeLutin. All Rights Reserved.