587
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
package com.nokia.helium.checktools;
|
|
18 |
|
|
19 |
import java.util.Properties;
|
|
20 |
|
|
21 |
/**
|
|
22 |
* CheckEngine is used to verify the versions of tools required by the Helium.
|
|
23 |
*
|
|
24 |
* Currently it verifies the following tools:
|
|
25 |
* <p>
|
|
26 |
* <ul>
|
|
27 |
* <li>Ant</li>
|
|
28 |
* <li>Python</li>
|
|
29 |
* </ul>
|
|
30 |
*
|
|
31 |
*/
|
|
32 |
public class CheckEngine extends ToolChecker {
|
|
33 |
|
|
34 |
private Properties configuration;
|
|
35 |
|
|
36 |
/**
|
|
37 |
* Create an instance of CheckEngine.
|
|
38 |
*
|
|
39 |
* @param configuration
|
|
40 |
* is the configuration details of tools
|
|
41 |
*/
|
|
42 |
public CheckEngine(Properties configuration) {
|
|
43 |
this.configuration = configuration;
|
|
44 |
}
|
|
45 |
|
|
46 |
/**
|
|
47 |
* Method verifies Ant version.
|
|
48 |
*/
|
628
|
49 |
public void verifyAntVersion() throws CheckToolException {
|
587
|
50 |
String expVersion = configuration.getProperty("ant.version");
|
|
51 |
String errorMsg = "Supported Ant version is not defined in 'helium.basic.tools.config' file under helium config folder.";
|
|
52 |
verifyIsExpectedToolVersionConfigured(expVersion, errorMsg);
|
|
53 |
errorMsg = "Ant " + expVersion
|
|
54 |
+ " not found. Kindly install and run again.";
|
|
55 |
verifyToolVersion(OSResolver.getCommand("ant -version"), expVersion,
|
|
56 |
"Apache Ant version ", errorMsg);
|
|
57 |
}
|
|
58 |
|
|
59 |
/**
|
|
60 |
* Method verifies Python version.
|
|
61 |
*/
|
628
|
62 |
public void verifyPythonVersion() throws CheckToolException {
|
587
|
63 |
String expVersion = configuration.getProperty("python.version");
|
|
64 |
String errorMsg = "Supported Python version is not defined in 'helium.basic.tools.config' file under helium config folder.";
|
|
65 |
verifyIsExpectedToolVersionConfigured(expVersion, errorMsg);
|
|
66 |
|
|
67 |
errorMsg = "Python " + expVersion
|
|
68 |
+ " not found. Kindly install and run again.";
|
|
69 |
verifyToolVersion(OSResolver.getCommand("python -V"), expVersion,
|
|
70 |
"Python ", errorMsg);
|
|
71 |
}
|
|
72 |
}
|