MatrixBerryCore
ConfRepoMgrVersionedAdaptiveTC.m
Go to the documentation of this file.
1 classdef ConfRepoMgrVersionedAdaptiveTC < mxberry.conf.test.AConfRepoAdaptiveTC
2  properties (Access=private)
3  cm1
4  tcm1
5  cm2
6  end
7  methods
8  function self = ConfRepoMgrVersionedAdaptiveTC(varargin)
9  self = self@mxberry.conf.test.AConfRepoAdaptiveTC(varargin{:});
10  end
11  end
12  properties (MethodSetupParameter)
13  factoryParam=struct('versioned',...
15  end
16  methods (TestMethodSetup)
17  function self = setUp(self,factoryParam)
18  self=setUp@mxberry.conf.test.AConfRepoAdaptiveTC(self,factoryParam);
19  SConfC=struct('alpha',0,'beta',0);
20  self.cm1=self.factory.getInstance('repoSubFolderName','confRepoVersioned');
21  self.cm1.removeAll();
22  self.tcm1=self.cm1.getTemplateRepo();
23  self.tcm1.putConf('testConfC',struct());
24  self.tcm1.removeAll();
25  %
26  self.tcm1.putConf('testConfC',SConfC,0);
27  self.tcm1.putConf('testConfCK',SConfC,0);
28  self.cm1.putConf('testConfK',SConfC,0);
29  self.cm1.putConf('testConfCK',SConfC,0);
30  %
31  self.cm2=self.factory.getInstance('repoSubFolderName','confRepoFixedExamples');
32  end
33  end
34  methods
35  function self=aux_test_updateConf(self,confName)
36  [SConf,confVersion]=self.cm1.getConf(confName);
37  self.verifyEqual(103,confVersion);
38  self.verifyEqual(2,SConf.beta);
39  end
40  end
41  methods (Test)
42  function self=test_updateConfFromTemplate(self)
43  self.aux_test_updateConf('testConfC');
44  end
45  function self=test_updateConfLocally(self)
46  self.cm1.updateConf('testConfK');
47  self.aux_test_updateConf('testConfK');
48  end
49  function self=test_updateConfOnSelect(self)
50  self.cm1.selectConf('testConfK');
51  self.aux_test_updateConf('testConfK');
52  self.cm1.selectConf('testConfC');
53  self.aux_test_updateConf('testConfC');
54  end
55  function self=test_updateAll(self)
56  self.cm1.updateAll();
57  self.aux_test_updateConf('testConfK');
58  self.aux_test_updateConf('testConfC');
59  self.aux_test_updateConf('testConfCK');
60  end
61  function self=test_updateAll_wrongKey(self)
62  try
63  self.cm2.updateAll();
64  self.verifyEqual(false,true);
65  catch meObj
66  self.verifyEqual(false,...
67  isempty(strfind(meObj.identifier,':badConfRepo')));
68  end
69  end
70  end
71 end