Skip to content
Snippets Groups Projects
Commit ef99d153 authored by pkupczyk's avatar pkupczyk
Browse files

SSDM-3543 : V3 AS API - improve context information in exceptions - fix...

SSDM-3543 : V3 AS API - improve context information in exceptions - fix MultiThreadProjectOptimisticLockingTest + make SearchCacheTest work in different locale (both at Hudson and locally)

SVN: 36555
parent fcd76b34
No related branches found
No related tags found
No related merge requests found
......@@ -56,6 +56,11 @@ public abstract class AbstractCreateEntityExecutor<CREATION extends ICreation, P
@Override
public List<PERM_ID> create(IOperationContext context, List<CREATION> creations)
{
if (creations == null || creations.isEmpty())
{
return new ArrayList<PERM_ID>();
}
try
{
List<PERM_ID> permIdsAll = new LinkedList<PERM_ID>();
......
......@@ -57,6 +57,11 @@ public abstract class AbstractUpdateEntityExecutor<UPDATE extends IUpdate, PE ex
@Override
public void update(IOperationContext context, List<UPDATE> updates)
{
if (updates == null || updates.isEmpty())
{
return;
}
try
{
Map<UPDATE, PE> entitiesAll = new LinkedHashMap<UPDATE, PE>();
......
......@@ -22,11 +22,10 @@ import static org.testng.Assert.fail;
import java.io.ByteArrayInputStream;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.text.DecimalFormatSymbols;
import java.util.Arrays;
import java.util.UUID;
import net.sf.ehcache.CacheManager;
import org.apache.commons.io.FileUtils;
import org.apache.log4j.Level;
import org.testng.Assert;
......@@ -34,15 +33,14 @@ import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import ch.ethz.sis.openbis.generic.server.asapi.v3.cache.SearchCache;
import ch.ethz.sis.openbis.generic.server.asapi.v3.cache.SearchCacheEntry;
import ch.ethz.sis.openbis.generic.server.asapi.v3.cache.SearchCacheKey;
import ch.systemsx.cisd.common.logging.BufferedAppender;
import ch.systemsx.cisd.common.logging.LogInitializer;
import ch.systemsx.cisd.common.test.AssertionUtil;
import ch.systemsx.cisd.openbis.generic.shared.util.RuntimeCache;
import ch.systemsx.cisd.openbis.util.LogRecordingUtils;
import net.sf.ehcache.CacheManager;
/**
* @author pkupczyk
*/
......@@ -74,8 +72,8 @@ public class SearchCacheTest
.assertContainsLines(
"INFO OPERATION.RuntimeCache - Cache size has been set to its default value."
+ " The default value is 25% (256m) of the memory available to the JVM (1g)."
+ " If you would like to change this value, then please set 'ch.ethz.sis.openbis.v3.searchcache.size' system property in openbis.conf file."
, logRecorder.getLogContent());
+ " If you would like to change this value, then please set 'ch.ethz.sis.openbis.v3.searchcache.size' system property in openbis.conf file.",
logRecorder.getLogContent());
}
@Test
......@@ -94,10 +92,13 @@ public class SearchCacheTest
{
createCache(FileUtils.ONE_GB, "10%");
char decimalSeparator = DecimalFormatSymbols.getInstance().getDecimalSeparator();
AssertionUtil
.assertContainsLines(
"INFO OPERATION.RuntimeCache - Cache size was set to '10%' in 'ch.ethz.sis.openbis.v3.searchcache.size' system property."
+ " The memory available to the JVM is 1g which gives a cache size of 102.4m", logRecorder.getLogContent());
+ " The memory available to the JVM is 1g which gives a cache size of 102" + decimalSeparator + "4m",
logRecorder.getLogContent());
}
@Test
......
......@@ -108,11 +108,12 @@ public class MultiThreadProjectOptimisticLockingTest extends MultiThreadOptimist
List<Experiment> experiments =
commonServer.listExperiments(systemSessionToken,
new ExperimentTypeBuilder().code(ToolBox.EXPERIMENT_TYPE_CODE)
.getExperimentType(), toolBox
.getExperimentType(),
toolBox
.createProjectIdentifier(toolBox.project1.getIdentifier()));
assertEquals("[OLT-E1, OLT-E2, OLT-E3]", toolBox.extractCodes(experiments).toString());
toolBox.checkModifierAndModificationDateOfProject1(timeIntervalChecker);
assertEquals("authorize 1/2\n" + "authorize 2/2\n" + "createExperiments 1/2\n"
+ "createExperiments 2/2\n" + "load related entities 0/0\n", stringBuilder.toString());
+ "createExperiments 2/2\n", stringBuilder.toString());
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment