Subversion Repositories DevTools

Rev

Rev 7169 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6914 dpurdie 1
package com.erggroup.buildtool.utf;
2
 
3
import java.sql.SQLException;
4
import java.util.ArrayList;
5
import java.util.List;
6
 
7
import com.erggroup.buildtool.ripple.BuildExclusion;
8
import com.erggroup.buildtool.ripple.BuildFile;
9
import com.erggroup.buildtool.ripple.Package;
7186 dpurdie 10
import com.erggroup.buildtool.ripple.PackageCollection;
7169 dpurdie 11
import com.erggroup.buildtool.ripple.PlanControl;
6914 dpurdie 12
import com.erggroup.buildtool.ripple.ReleaseManager;
13
import com.erggroup.buildtool.ripple.RippleEngine;
14
import com.erggroup.buildtool.ripple.ReleaseConfig;
15
import com.erggroup.buildtool.ripple.RunLevelData;
16
import com.erggroup.buildtool.ripple.RunLevel.BuildState;
17
 
18
 
19
/** Subclass and override key methods so that the test can control
20
 *  the data being used
21
 */
22
public class ReleaseManagerUtf extends ReleaseManager 
23
{
24
    int mAreleaseManagerUtf = 2;
25
 
26
    /** Container of persisted run levels for unit test usage
27
     * @attribute
28
     */
29
    public List<Integer> mPersistedRunLevelCollection = new ArrayList<Integer>();
30
 
31
 
32
    public ReleaseManagerUtf(final String connectionString, final String username, final String password)
33
    {
34
        super(connectionString, username, password);
7046 dpurdie 35
        mUseDatabase = false;
6914 dpurdie 36
    }
37
 
38
    public ReleaseManagerUtf()
39
    {
40
        super();
7046 dpurdie 41
        mUseDatabase = false;
6914 dpurdie 42
    }
43
 
44
    //
45
    //  Used by Slave
46
    //      Set a single run level entry
47
    //
48
    @Override
49
    public void querySingleRunLevel(final int rconId, String hostname, char daemonMode) throws SQLException, Exception
50
    {
51
        mRunLevelCollection.clear();
52
        RunLevelData runLevel = new RunLevelData(rconId, BuildState.DB_ACTIVE, 'S', 1);
53
        mRunLevelCollection.add(runLevel);
54
    }
55
 
56
    //
57
    //  Used by Master
58
    //
59
    @Override
60
    public void queryRunLevel(final int rtag_id) throws SQLException, Exception
61
    {
62
        // Nothing to do here
63
    }
64
 
65
    // Used by Master and Slave
66
    @Override
67
    public int queryMasterCount(final int rtag_id) throws SQLException, Exception
68
    {
69
        return 1;
70
    }
71
 
72
    @Override
73
    public void queryReleaseConfig(final int rtag_id) throws SQLException, Exception
74
    {
75
        mReleaseConfigCollection.resetData();
76
 
77
        ReleaseConfig releaseConfig = new ReleaseConfig(1,1,'M', "LinuxHost","BuildLinux", "linux_i386", "Linux");
78
        mReleaseConfigCollection.add(releaseConfig);
79
 
80
        releaseConfig = new ReleaseConfig(1,2,'S', "SparcHost","BuildSparc", "sparc", "Solaris");
81
        mReleaseConfigCollection.add(releaseConfig);
82
 
83
        releaseConfig = new ReleaseConfig(1,3,'S', "Sparc10X86Host","BuildSparc10X86", "solaris10_x86", "Solaris");
84
        mReleaseConfigCollection.add(releaseConfig);
85
 
86
    }
87
 
88
    @Override
89
    public String queryMailServer() throws SQLException, Exception
90
    {
91
        return "dummyEmailServer.vixtechnology.com";
92
    }
93
 
94
    @Override
95
    public String queryMailSender() throws SQLException, Exception
96
    {
97
        return "dummyEmailSender.vixtechnology.com";
98
    }
99
 
100
    @Override
101
    public String queryGlobalAddresses() throws SQLException, Exception
102
    {
103
        return "dummyEmailSender.vixtechnology.com";
104
    }
105
 
106
    @Override
107
    public String queryBaselineName(int baseline) throws SQLException, Exception
108
    {
109
        return "TIMBUKTU (TIM) > R7";
110
    }
111
 
112
    @Override
113
    public List<String> queryProjectEmail(int baseline) throws SQLException
114
    {
115
        ArrayList<String> emailCollection = new ArrayList<String>();
116
        emailCollection.add("global1@vixtechnology.com");
117
        emailCollection.add("global2@vixtechnology.com");
118
        emailCollection.add("global1@vixtechnology.com");
119
        return emailCollection;
120
    }
121
 
122
    @Override
123
    public void connect()
124
    {
125
        // Nothing to do here
126
    }
127
 
128
    @Override
129
    public void disconnect()
130
    {
131
        // Nothing to do here
132
    }
133
 
134
    @Override
135
    public void queryBuildExclusions(List<BuildExclusion> buildExclusionCollection, int baseline)
136
            throws SQLException, Exception
137
    {
138
        //  Nothing to do here
139
    }
140
 
141
    @Override
7186 dpurdie 142
    public void queryPackageVersions(RippleEngine rippleEngine, PackageCollection packageCollection,
6914 dpurdie 143
            int baseline) throws SQLException, Exception
144
    {
145
        // Nothing to do here
146
    }
147
 
148
    @Override
7186 dpurdie 149
    public void queryWips(RippleEngine rippleEngine, PackageCollection packageCollection, int baseline) throws SQLException, Exception
7082 dpurdie 150
    {
151
    }
152
 
153
    @Override
7186 dpurdie 154
    public void queryTest(RippleEngine rippleEngine, PackageCollection packageCollection, int baseline) throws SQLException, Exception
7082 dpurdie 155
    {
156
    }
157
 
158
    @Override
7186 dpurdie 159
    public void queryRipples(RippleEngine rippleEngine, PackageCollection packageCollection, int baseline) throws SQLException, Exception
7082 dpurdie 160
    {
161
    }
162
 
163
    @Override
7169 dpurdie 164
    public void queryPlanControl(int mRtagId, PlanControl mPlanControl) throws Exception
165
    {
166
    }
167
 
168
    @Override
6914 dpurdie 169
    public int queryRtagIdForSbom(int sbomId) throws SQLException
170
    {
171
        return 123456;
172
    }
173
 
174
    @Override
175
    public void updateCurrentRunLevel(final int rconId, final int runLevel) throws SQLException, Exception
176
    {
177
        Integer i = Integer.valueOf(runLevel);
178
        mPersistedRunLevelCollection.add(i);
179
    }
180
 
181
    @Override
182
    public long currentTimeMillis()
183
    {
184
        return 123456789;
185
    }
186
 
187
    @Override
188
    public String getMajorVersionNumber()
189
    {
190
        return "11";
191
    }
192
 
193
    @Override
194
    public void publishBuildFile(int rtag_id, BuildFile buildFile) throws SQLException, Exception
195
    {
196
    }
7186 dpurdie 197
 
198
	/**
199
	 * Compatibility function to find a package in a collection
200
	 * Do not use for new code
201
	 * @param id
202
	 * @param packageCollection
203
	 * @return The package or a NULL_PACKAGE
204
	 */
205
 
206
	public Package findPackage(int id, PackageCollection packageCollection) {
207
		Package p = packageCollection.contains(id);
208
		if (p == null)
209
			p = NULL_PACKAGE;
210
		return p;
211
	}
212
 
213
	/**
214
	 * Compatibility function to find a package in a collection
215
	 * Do not use for new code
216
	 * @param mAlias
217
	 * @param packageCollection
218
	 * @return The package or a NULL_PACKAGE
219
	 */
220
	public Package findPackage(String mAlias, PackageCollection packageCollection) {
221
		Package p = packageCollection.contains(mAlias);
222
		if (p == null)
223
			p = NULL_PACKAGE;
224
		return p;	}
225
 
6914 dpurdie 226
}
227
 
228