MatrixBerryCore
AConfRepoAdaptiveTC.m
Go to the documentation of this file.
1 classdef AConfRepoAdaptiveTC < mxberry.conf.test.AConfRepoMgrTC
2  properties (Access=protected)
3  tcm
4  initialConfNameList
5  end
6  methods (Access=protected)
7  function self=initData(self)
8  import mxberry.conf.test.*;
9 
10  self.cm=self.factory.getInstance();
11  self.cm.removeAll();
12  self.tcm=self.cm.getTemplateRepo();
13  self.tcm.putConf('testConfC',struct());
14  self.tcm.removeAll();
15  SConfA=genteststruct(1);
16  SConfB=genteststruct(2);
17  %
18  self.tcm.putConf('testConfA',SConfA);
19  self.tcm.putConf('testConfB',SConfB);
20  self.cm.putConf('testConfA',SConfB);
21  self.initialConfNameList=self.tcm.getConfNameList();
22  end
23  end
24  methods
25  function self = AConfRepoAdaptiveTC(varargin)
26  self = self@mxberry.conf.test.AConfRepoMgrTC(varargin{:});
27  end
28  end
29  properties (MethodSetupParameter, Abstract)
30  factoryParam
31  end
32  methods (TestMethodSetup)
33  function self = setUp(self,factoryParam)
34  self.factory=factoryParam;
35  self=self.initData();
36  end
37  end
38  methods (Test)
39  function self = test_setGetConf(self)
40  import mxberry.conf.test.*;
41  SConf=genteststruct(3);
42  self.tcm.putConf('testConfB',SConf);
43  SRes=self.cm.getConf('testConfB');
44  self.verifyEqual(isequaln(SConf,SRes),true);
45  end
46  function self = test_setGetConfWithVer(self)
47  import mxberry.conf.test.*;
48  SConf=genteststruct(3);
49  [~,lastRev]=self.tcm.getConf('testConfA');
50  testVer=min(333,lastRev);
51  self.tcm.putConf('testConfB',SConf,testVer);
52  [SRes,resVer]=self.cm.getConf('testConfB');
53  self.verifyEqual(isequaln(SConf,SRes),true);
54  self.verifyEqual(testVer,resVer);
55  end
56  function self=test_deployConfTemplate(self)
57  confNameList=[self.tcm.getConfNameList,{'testConfD'}];
58  self.tcm.copyConf('testConfA','testConfD');
59  self.cm.deployConfTemplate('*');
60  isEqual=isequal(confNameList,...
61  sort(self.cm.getConfNameList()));
62  self.verifyEqual(isEqual,true);
63  end
64  end
65 end
function genteststruct(in inpNum)