16     methods (TestMethodTeardown)
    18         function self = tearDown(
self)
    22     properties (MethodSetupParameter,Abstract)
    25     methods (TestMethodSetup)
    26         function self = setUp(self,argList)
    27             self.mapFactory=argList{1};
    29             storageRootDir=
self.resTmpDir;
    30             self.map=
self.mapFactory.getInstance(
'storageBranchKey',...
    31                 'testBranch',
'storageLocationRoot',storageRootDir,...
    35                 'gamma',{{[1 2 3],[1 2 3]}},...
    36                 'delta',{{[1 2 3], [4 5 6]}},...
    37                 'epsilon',{{
'nu',
'mu'}},...
    38                 'zeta',int16([144 1]),...
    39                 'eta',logical([1 1]),...
    40                 'theta',{{
'nu',
'nu'}},...
    41                 'iota',{{
'nu',
'mu'}});
    44                 'gamma',{{[1 2 3],[1 2 44545453]}},...
    45                 'delta',{{[1 2.676676734 3], [4.23232423423424 5 6]}},...
    46                 'epsilon',{{
'nu',
'mu'}},...
    47                 'zeta',int8([431 2121]),...
    48                 'eta',logical([1 0]),...
    49                 'theta',{{
'nu',
'nu'}},...
    50                 'iota',{{
'nu',
'mu'}});
    52             self.testParamList=[argList{2:end},...
    53                 {
'storageLocationRoot',storageRootDir}];
    59         function self = test_constructor(
self)
    60             obj1=self.mapFactory.getInstance();
    61             metaClass=metaclass(obj1);
    63                 self.testParamList,{
'storageLocationRoot'});
    64             obj2=
self.mapFactory.getInstance(
'storageLocationRoot',...
    65                 fileparts(which(metaClass.Name)),inpParamList{:});
    66             self.verifyEqual(strcmp(obj1.getStorageLocation(),...
    67                 obj2.getStorageLocation),
true);
    70         function self=test_putGet(
self)
    71             rel1=self.rel1; %
#ok<*PROP>    74             self.map=
self.mapFactory.getInstance(
'storageBranchKey',...
    75                 'aaa',
self.testParamList{:});
    76             inpObjList={rel1,rel2};
    77             keyList={
'rel1',
'rel2'};
    79             self.map.put(keyList,inpObjList);
    80             valueObjList=fliplr(
self.map.get(fliplr(keyList),
'UniformOutput',
false));
    81             isEqual=all(cellfun(@isequal,inpObjList,valueObjList));
    82             self.verifyEqual(isEqual,
true);
    89         function self=test_longKeyPutGet(
self)
    91             self.map=self.mapFactory.getInstance('storageBranchKey',...
    92                 'aaa',self.testParamList{:});
    95             keyStr=
repmat(
'a',namelengthmax); %#ok<NASGU>
    96             self.runAndCheckError(
'map.put({keyStr},{rel})',
':wrongInput');
    97             self.runAndCheckError(
'map.get({keyStr})',
':wrongInput');
    99             keyStr=
repmat(
'a',1,namelengthmax);
   100             map.put({keyStr},{rel});
   101             resObj=map.get({keyStr});
   102             isEqual=isequal(rel,resObj);
   103             self.verifyEqual(
true,isEqual);
   106         function self=test_getKeyList(
self)
   109             self.map=self.mapFactory.getInstance('storageBranchKey',...
   110                 'aaa',self.testParamList{:});
   111             self.map.removeAll();
   112             inpObjList={rel1,rel2};
   113             keyList={
'rel1',
'rel2'};
   114             self.map.put(keyList,inpObjList);
   115             isEqual=isequal(sort(keyList),sort(
self.map.getKeyList));
   116             self.verifyEqual(isEqual,
true);
   117             self.map.remove(
'rel2');
   118             isEqual=isequal({
'rel1'},
self.map.getKeyList);
   119             self.verifyEqual(isEqual,
true);
   120             self.map.removeAll();
   123         function self=test_putGetWithoutCells(
self)
   125             self.map=self.mapFactory.getInstance('storageBranchKey',...
   126                 'aaa',self.testParamList{:});
   129             self.map.put(keyList,inpObjList);
   130             valueObjList=
self.map.get(keyList,
'UniformOutput',
false);
   131             isEqual=all(cellfun(@isequal,inpObjList,valueObjList));
   132             self.verifyEqual(isEqual,
true);
   135             self.map.put(keyList,inpObjList);
   136             valueObjList=
self.map.get(keyList,
'UniformOutput',
false);
   137             inpObjList={inpObjList};
   138             isEqual=all(cellfun(@isequal,inpObjList,valueObjList));
   139             self.verifyEqual(isEqual,
true);
   142         function self=test_isKeyAndRemove(
self)
   146             self.map=self.mapFactory.getInstance('storageBranchKey',...
   147                 'aaa',self.testParamList{:});
   148             inpObjList={rel1,rel2,rel3};
   149             keyList={
'rel1',
'rel2',
'rel3'};
   150             self.map.put(keyList,inpObjList);
   151             self.map.remove(keyList{3});
   152             self.verifyEqual(
self.map.isKey(keyList{3}),
false);
   153             inpObjList=inpObjList(1:2);
   154             keyList=keyList(1:2);
   155             valueObjList=fliplr(
self.map.get(fliplr(keyList),...
   156                 'UniformOutput',
false));
   157             isEqual=all(cellfun(@isequal,inpObjList,valueObjList));
   158             self.verifyEqual(isEqual,
true);
   159             self.map.removeAll();
   162         function self=test_removeAll(
self)
   165             inpObjList={rel1,rel2};
   166             keyList={
'rel1',
'rel2'};
   167             self.map.put(keyList,inpObjList);
   168             self.map.remove(
'rel2');
   170             map1=
self.mapFactory.getInstance(
'storageBranchKey',...
   171                 'testBranch2',
self.testParamList{:});
   173             map1.put(
'rel1',rel1);
   175             isThere1=
self.map.isKey(keyList);
   176             isThere2=map1.isKey(keyList);
   177             self.verifyEqual(all(isThere1==isThere2),
true);
   179             isThere=map1.isKey({
'rel1'});
   180             self.verifyEqual(isThere,
false);
   181             self.map.removeAll();
   184         function self=test_getFileNameByKey(
self)
   186             self.map=self.mapFactory.getInstance('storageBranchKey',...
   187                 'aaa',self.testParamList{:});
   190             self.map.put(keyList,inpObjList);
   191             self.map.getFileNameByKey(keyList);
 
TMPDATAMANAGER provides a basic functionality for managing temporary data folders, root folder name is determined automatically. 
 
function repmat(in inpArray, in varargin)
 
function rmdir(in dirName, in sFlag)
RMDIR removes a directory (optionally recursively) 
 
static function getDirByCallerKey(in keyName)
GETDIRBYCALLERKEY returns a unique temporary directory name based on caller name and optionally based...
 
function parseparams(in args, in propNameList, in nRegExpected, in nPropExpected)
PARSEPARAMS behaves exactly as a built-in Matlab function apart from the incorrect behavior of Matlab...