-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
138 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
arc-core/src/main/java/fr/insee/arc/core/model/BatchMode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package fr.insee.arc.core.model; | ||
|
||
public class BatchMode { | ||
|
||
private BatchMode() { | ||
throw new IllegalStateException("Utility class"); | ||
} | ||
|
||
public final static String UNSET = null; | ||
public final static String NORMAL = "N"; | ||
public final static String KEEP_INTERMEDIATE_DATA = "K"; | ||
|
||
|
||
public static String computeBatchMode(boolean isBatchMode, boolean isBatchModeMustKeepIntermediateData) | ||
{ | ||
if (!isBatchMode) { | ||
return BatchMode.UNSET; | ||
} | ||
|
||
if (isBatchModeMustKeepIntermediateData) { | ||
return BatchMode.KEEP_INTERMEDIATE_DATA; | ||
} | ||
|
||
return BatchMode.NORMAL; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
arc-core/src/test/java/fr/insee/arc/core/model/BatchModeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package fr.insee.arc.core.model; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import java.lang.reflect.InvocationTargetException; | ||
|
||
import org.junit.Test; | ||
|
||
import fr.insee.arc.utils.exception.ArcException; | ||
import fr.insee.arc.utils.utils.PrivateConstructorTest; | ||
|
||
public class BatchModeTest { | ||
|
||
@Test | ||
public void testBatchModeIsUtilityClass() throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { | ||
PrivateConstructorTest.testConstructorIsPrivate(BatchMode.class); | ||
} | ||
|
||
@Test | ||
public void computeBatchModeTest() throws ArcException | ||
{ | ||
assertEquals(BatchMode.UNSET, BatchMode.computeBatchMode(false,true)); | ||
assertEquals(BatchMode.UNSET, BatchMode.computeBatchMode(false,false)); | ||
assertEquals(BatchMode.NORMAL, BatchMode.computeBatchMode(true,false)); | ||
assertEquals(BatchMode.KEEP_INTERMEDIATE_DATA, BatchMode.computeBatchMode(true,true)); | ||
} | ||
|
||
|
||
} |
20 changes: 20 additions & 0 deletions
20
arc-core/src/test/java/fr/insee/arc/core/service/global/dao/ThreadOperationsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package fr.insee.arc.core.service.global.dao; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
import org.junit.Test; | ||
|
||
import fr.insee.arc.core.model.BatchMode; | ||
|
||
public class ThreadOperationsTest { | ||
|
||
@Test | ||
public void checkPreviousPhaseDataDropConditionTest() { | ||
|
||
assertEquals(false,ThreadOperations.checkPreviousPhaseDataDropCondition(BatchMode.UNSET)); | ||
assertEquals(false,ThreadOperations.checkPreviousPhaseDataDropCondition(BatchMode.KEEP_INTERMEDIATE_DATA)); | ||
assertEquals(true,ThreadOperations.checkPreviousPhaseDataDropCondition(BatchMode.NORMAL)); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters