Repository: sqoop Updated Branches: refs/heads/sqoop2 d8e9ebc45 -> fde0eb177
SQOOP-1515: VersionRequestHandler - fixes (Veena Basavaraj via Jarek Jarcec Cecho) Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/fde0eb17 Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/fde0eb17 Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/fde0eb17 Branch: refs/heads/sqoop2 Commit: fde0eb177d73c5bd6902f601048854dfd8c630df Parents: d8e9ebc Author: Jarek Jarcec Cecho <[email protected]> Authored: Mon Oct 27 11:02:19 2014 -0700 Committer: Jarek Jarcec Cecho <[email protected]> Committed: Mon Oct 27 11:02:19 2014 -0700 ---------------------------------------------------------------------- .../apache/sqoop/common/VersionAnnotation.java | 6 +- .../org/apache/sqoop/common/VersionInfo.java | 15 +-- .../java/org/apache/sqoop/json/VersionBean.java | 102 +++++++++---------- .../apache/sqoop/common/TestVersionInfo.java | 8 +- .../connector/jdbc/GenericJdbcConnector.java | 8 +- .../sqoop/connector/hdfs/HdfsConnector.java | 11 +- .../sqoop/handler/VersionRequestHandler.java | 16 ++- .../apache/sqoop/shell/ShowVersionFunction.java | 45 ++++---- .../org/apache/sqoop/shell/core/Constants.java | 16 +-- .../main/resources/shell-resource.properties | 10 +- .../sqoop/integration/server/VersionTest.java | 10 +- .../java/org/apache/sqoop/tools/ToolRunner.java | 6 +- .../sqoop/tools/tool/RepositoryDumpTool.java | 6 +- .../sqoop/tools/tool/RepositoryLoadTool.java | 2 +- 14 files changed, 133 insertions(+), 128 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sqoop/blob/fde0eb17/common/src/main/java/org/apache/sqoop/common/VersionAnnotation.java ---------------------------------------------------------------------- diff --git a/common/src/main/java/org/apache/sqoop/common/VersionAnnotation.java b/common/src/main/java/org/apache/sqoop/common/VersionAnnotation.java index acd901f..728a3a7 100644 --- a/common/src/main/java/org/apache/sqoop/common/VersionAnnotation.java +++ b/common/src/main/java/org/apache/sqoop/common/VersionAnnotation.java @@ -28,18 +28,18 @@ import java.lang.annotation.*; public @interface VersionAnnotation { /** - * Get the Hadoop version + * Get the sqoop build version * @return the version string (eg. "2.0.0") */ String version(); /** - * Get the username that compiled the code. + * Get the system username that compiled the code. */ String user(); /** - * Get the date when the code was compiled. + * Get the date when the code was compiled and built * @return the date in unix 'date' format */ String date(); http://git-wip-us.apache.org/repos/asf/sqoop/blob/fde0eb17/common/src/main/java/org/apache/sqoop/common/VersionInfo.java ---------------------------------------------------------------------- diff --git a/common/src/main/java/org/apache/sqoop/common/VersionInfo.java b/common/src/main/java/org/apache/sqoop/common/VersionInfo.java index dcf522f..1b4873b 100644 --- a/common/src/main/java/org/apache/sqoop/common/VersionInfo.java +++ b/common/src/main/java/org/apache/sqoop/common/VersionInfo.java @@ -20,6 +20,7 @@ package org.apache.sqoop.common; public final class VersionInfo { private static Package myPackage; + // NOTE: The annotation details on generated on the fly during build step private static VersionAnnotation annotation; static { @@ -32,10 +33,12 @@ public final class VersionInfo { } /** - * Get the version. + * Get the build version of the package * @return the version string, eg. "2.0.0" + * NOTE: Read here for some background on why we are using 2.0.0 to begin with + * http://markmail.org/message/5jygqqy3oryxqdib */ - public static String getVersion() { + public static String getBuildVersion() { return annotation != null ? annotation.version() : "Unknown"; } @@ -43,15 +46,15 @@ public final class VersionInfo { * Get the subversion revision number for the root directory * @return the revision number, eg. "451451" */ - public static String getRevision() { + public static String getSourceRevision() { return annotation != null ? annotation.revision() : "Unknown"; } /** - * The date that the code was compiled. + * The date that the code was compiled and built * @return the compilation date in unix date format */ - public static String getDate() { + public static String getBuildDate() { return annotation != null ? annotation.date() : "Unknown"; } @@ -67,7 +70,7 @@ public final class VersionInfo { * Get the subversion URL for the root directory. * @return the url */ - public static String getUrl() { + public static String getSourceUrl() { return annotation != null ? annotation.url() : "Unknown"; } http://git-wip-us.apache.org/repos/asf/sqoop/blob/fde0eb17/common/src/main/java/org/apache/sqoop/json/VersionBean.java ---------------------------------------------------------------------- diff --git a/common/src/main/java/org/apache/sqoop/json/VersionBean.java b/common/src/main/java/org/apache/sqoop/json/VersionBean.java index 029a776..53d19b1 100644 --- a/common/src/main/java/org/apache/sqoop/json/VersionBean.java +++ b/common/src/main/java/org/apache/sqoop/json/VersionBean.java @@ -22,30 +22,30 @@ import org.json.simple.JSONObject; public class VersionBean implements JsonBean { - public static final String VERSION = "version"; - public static final String REVISION = "revision"; - public static final String DATE = "date"; - public static final String USER = "user"; - public static final String URL = "url"; - public static final String PROTOCOLS = "protocols"; + public static final String BUILD_VERSION = "build-version"; + public static final String SOURCE_REVISION = "source-revision"; + public static final String BUILD_DATE = "build-date"; + public static final String SYSTEM_USER_NAME = "user"; + public static final String SOURCE_URL = "source-url"; + public static final String SUPPORTED_API_VERSIONS = "api-versions"; - private String version; - private String revision; - private String date; - private String user; - private String url; - private String[] protocols; + private String buildVersion; + private String sourceRevision; + private String buildDate; + private String systemUser; + private String sourceUrl; + private String[] supportedRestAPIVersions; // for "extract" - public VersionBean(String version, String revision, String date, - String user, String url, String[] protocols) { - this.version = version; - this.revision = revision; - this.date = date; - this.user = user; - this.url = url; - this.protocols = new String[protocols.length]; - System.arraycopy(protocols, 0, this.protocols, 0, protocols.length); + public VersionBean(String serverVersion, String sourceRevision, String buildDate, + String user, String sourceUrl, String[] supportedAPIVersions) { + this.buildVersion = serverVersion; + this.sourceRevision = sourceRevision; + this.buildDate = buildDate; + this.systemUser = user; + this.sourceUrl = sourceUrl; + this.supportedRestAPIVersions = new String[supportedAPIVersions.length]; + System.arraycopy(supportedAPIVersions, 0, this.supportedRestAPIVersions, 0, supportedAPIVersions.length); } // for "restore" @@ -56,56 +56,56 @@ public class VersionBean implements JsonBean { @Override public JSONObject extract(boolean skipSensitive) { JSONObject result = new JSONObject(); - result.put(VERSION, version); - result.put(REVISION, revision); - result.put(DATE, date); - result.put(USER, user); - result.put(URL, url); - JSONArray protocolsArray = new JSONArray(); - for (String protocol : protocols) { - protocolsArray.add(protocol); + result.put(BUILD_VERSION, buildVersion); + result.put(SOURCE_REVISION, sourceRevision); + result.put(BUILD_DATE, buildDate); + result.put(SYSTEM_USER_NAME, systemUser); + result.put(SOURCE_URL, sourceUrl); + JSONArray apiVersionsArray = new JSONArray(); + for (String version : supportedRestAPIVersions) { + apiVersionsArray.add(version); } - result.put(PROTOCOLS, protocolsArray); + result.put(SUPPORTED_API_VERSIONS, apiVersionsArray); return result; } @Override public void restore(JSONObject jsonObject) { - this.version = (String)jsonObject.get(VERSION); - this.revision = (String)jsonObject.get(REVISION); - this.date = (String)jsonObject.get(DATE); - this.user = (String)jsonObject.get(USER); - this.url = (String)jsonObject.get(URL); - JSONArray protocolsArray = (JSONArray) jsonObject.get(PROTOCOLS); - int size = protocolsArray.size(); - this.protocols = new String[size]; + this.buildVersion = (String)jsonObject.get(BUILD_VERSION); + this.sourceRevision = (String)jsonObject.get(SOURCE_REVISION); + this.buildDate = (String)jsonObject.get(BUILD_DATE); + this.systemUser = (String)jsonObject.get(SYSTEM_USER_NAME); + this.sourceUrl = (String)jsonObject.get(SOURCE_URL); + JSONArray apiVersionsArray = (JSONArray) jsonObject.get(SUPPORTED_API_VERSIONS); + int size = apiVersionsArray.size(); + this.supportedRestAPIVersions = new String[size]; for (int i = 0; i<size; i++) { - protocols[i] = (String) protocolsArray.get(i); + supportedRestAPIVersions[i] = (String) apiVersionsArray.get(i); } } - public String getVersion() { - return this.version; + public String getBuildVersion() { + return this.buildVersion; } - public String getRevision() { - return this.revision; + public String getSourceRevision() { + return this.sourceRevision; } - public String getDate() { - return this.date; + public String getBuildDate() { + return this.buildDate; } - public String getUser() { - return this.user; + public String getSystemUser() { + return this.systemUser; } - public String getUrl() { - return this.url; + public String getSourceUrl() { + return this.sourceUrl; } - public String[] getProtocols() { - return this.protocols; + public String[] getSupportedAPIVersions() { + return this.supportedRestAPIVersions; } } http://git-wip-us.apache.org/repos/asf/sqoop/blob/fde0eb17/common/src/test/java/org/apache/sqoop/common/TestVersionInfo.java ---------------------------------------------------------------------- diff --git a/common/src/test/java/org/apache/sqoop/common/TestVersionInfo.java b/common/src/test/java/org/apache/sqoop/common/TestVersionInfo.java index 27d78f4..43575da 100644 --- a/common/src/test/java/org/apache/sqoop/common/TestVersionInfo.java +++ b/common/src/test/java/org/apache/sqoop/common/TestVersionInfo.java @@ -24,11 +24,11 @@ public class TestVersionInfo { @Test public void testValues() throws Exception { - Assert.assertNotSame("Unknown", VersionInfo.getVersion()); - Assert.assertNotSame("Unknown", VersionInfo.getRevision()); - Assert.assertNotSame("Unknown", VersionInfo.getDate()); + Assert.assertNotSame("Unknown", VersionInfo.getBuildVersion()); + Assert.assertNotSame("Unknown", VersionInfo.getSourceRevision()); + Assert.assertNotSame("Unknown", VersionInfo.getBuildDate()); Assert.assertNotSame("Unknown", VersionInfo.getUser()); - Assert.assertNotSame("Unknown", VersionInfo.getUrl()); + Assert.assertNotSame("Unknown", VersionInfo.getSourceUrl()); } } http://git-wip-us.apache.org/repos/asf/sqoop/blob/fde0eb17/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcConnector.java ---------------------------------------------------------------------- diff --git a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcConnector.java b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcConnector.java index 8469064..3a6621a 100644 --- a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcConnector.java +++ b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcConnector.java @@ -50,12 +50,12 @@ public class GenericJdbcConnector extends SqoopConnector { /** * {@inheritDoc} * - * As this is build-in connector it will return same version as rest of the - * Sqoop infrastructure. + * As this is built-in connector it will return same version as rest of the + * Sqoop code. */ @Override public String getVersion() { - return VersionInfo.getVersion(); + return VersionInfo.getBuildVersion(); } @Override @@ -64,11 +64,13 @@ public class GenericJdbcConnector extends SqoopConnector { GenericJdbcConnectorConstants.RESOURCE_BUNDLE_NAME, locale); } + @SuppressWarnings("rawtypes") @Override public Class getLinkConfigurationClass() { return LinkConfiguration.class; } + @SuppressWarnings("rawtypes") @Override public Class getJobConfigurationClass(Direction jobType) { switch (jobType) { http://git-wip-us.apache.org/repos/asf/sqoop/blob/fde0eb17/connector/connector-hdfs/src/main/java/org/apache/sqoop/connector/hdfs/HdfsConnector.java ---------------------------------------------------------------------- diff --git a/connector/connector-hdfs/src/main/java/org/apache/sqoop/connector/hdfs/HdfsConnector.java b/connector/connector-hdfs/src/main/java/org/apache/sqoop/connector/hdfs/HdfsConnector.java index cce0e29..b5f1f77 100644 --- a/connector/connector-hdfs/src/main/java/org/apache/sqoop/connector/hdfs/HdfsConnector.java +++ b/connector/connector-hdfs/src/main/java/org/apache/sqoop/connector/hdfs/HdfsConnector.java @@ -49,13 +49,14 @@ public class HdfsConnector extends SqoopConnector { private static final HdfsValidator hdfsValidator = new HdfsValidator(); /** - * Retrieve connector version. + * {@inheritDoc} * - * @return Version encoded as a string + * As this is built-in connector it will return same version as rest of the + * Sqoop code. */ @Override public String getVersion() { - return VersionInfo.getVersion(); + return VersionInfo.getBuildVersion(); } /** @@ -126,9 +127,9 @@ public class HdfsConnector extends SqoopConnector { /** * Returns an {@linkplain org.apache.sqoop.connector.spi.ConnectorConfigurableUpgrader} object that can upgrade the - * connection and job metadata. + * connection and job configs. * - * @return MetadataUpgrader object + * @return configurable upgrader object */ @Override public ConnectorConfigurableUpgrader getConfigurableUpgrader() { http://git-wip-us.apache.org/repos/asf/sqoop/blob/fde0eb17/server/src/main/java/org/apache/sqoop/handler/VersionRequestHandler.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/sqoop/handler/VersionRequestHandler.java b/server/src/main/java/org/apache/sqoop/handler/VersionRequestHandler.java index 64c4536..0bf188c 100644 --- a/server/src/main/java/org/apache/sqoop/handler/VersionRequestHandler.java +++ b/server/src/main/java/org/apache/sqoop/handler/VersionRequestHandler.java @@ -36,22 +36,20 @@ public class VersionRequestHandler implements RequestHandler { private static final Logger LOG = Logger.getLogger(VersionRequestHandler.class); - /** The API version supported by this server */ - public static final String PROTOCOL_V1 = "1"; - + /** The latest API version supported by the server */ + public static final String CURRENT_REST_API_VERSION = "v1"; private final VersionBean versionBean; public VersionRequestHandler() { - String[] protocols = { PROTOCOL_V1 }; - versionBean = new VersionBean(VersionInfo.getVersion(), - VersionInfo.getRevision(), VersionInfo.getDate(), - VersionInfo.getUser(), VersionInfo.getUrl(), protocols); - + // this will hold all the possible API versions supported by sqoop + String[] apiVersions = { CURRENT_REST_API_VERSION }; + versionBean = new VersionBean(VersionInfo.getBuildVersion(), + VersionInfo.getSourceRevision(), VersionInfo.getBuildDate(), + VersionInfo.getUser(), VersionInfo.getSourceUrl(), apiVersions); LOG.info("VersionRequestHandler initialized"); } - @Override public JsonBean handleEvent(RequestContext ctx) { AuditLoggerManager.getInstance() http://git-wip-us.apache.org/repos/asf/sqoop/blob/fde0eb17/shell/src/main/java/org/apache/sqoop/shell/ShowVersionFunction.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/ShowVersionFunction.java b/shell/src/main/java/org/apache/sqoop/shell/ShowVersionFunction.java index 4e7ad38..3b4bb3f 100644 --- a/shell/src/main/java/org/apache/sqoop/shell/ShowVersionFunction.java +++ b/shell/src/main/java/org/apache/sqoop/shell/ShowVersionFunction.java @@ -41,17 +41,17 @@ public class ShowVersionFunction extends SqoopFunction { .withLongOpt(Constants.OPT_ALL) .create(Constants.OPT_ALL_CHAR)); this.addOption(OptionBuilder - .withDescription(resourceString(Constants.RES_SHOW_PROMPT_DISPLAY_VERSION_SERVER)) + .withDescription(resourceString(Constants.RES_SHOW_PROMPT_DISPLAY_SERVER_VERSION)) .withLongOpt(Constants.OPT_SERVER) .create(Constants.OPT_SERVER_CHAR)); this.addOption(OptionBuilder - .withDescription(resourceString(Constants.RES_SHOW_PROMPT_DISPLAY_VERSION_CLIENT)) + .withDescription(resourceString(Constants.RES_SHOW_PROMPT_DISPLAY_CLIENT_VERSION)) .withLongOpt(Constants.OPT_CLIENT) .create(Constants.OPT_CLIENT_CHAR)); this.addOption(OptionBuilder - .withDescription(resourceString(Constants.RES_SHOW_PROMPT_DISPLAY_VERSION_PROTOCOL)) - .withLongOpt(Constants.OPT_PROTOCOL) - .create(Constants.OPT_PROTOCOL_CHAR)); + .withDescription(resourceString(Constants.RES_SHOW_PROMPT_DISPLAY_REST_API_VERSION)) + .withLongOpt(Constants.OPT_REST_API) + .create(Constants.OPT_API_CHAR)); } @Override @@ -65,27 +65,27 @@ public class ShowVersionFunction extends SqoopFunction { showVersion(true, true, true); } else { - boolean server = false, client = false, protocol = false; + boolean server = false, client = false, restApi = false; if (line.hasOption(Constants.OPT_SERVER)) { server = true; } if (line.hasOption(Constants.OPT_CLIENT)) { client = true; } - if (line.hasOption(Constants.OPT_PROTOCOL)) { - protocol = true; + if (line.hasOption(Constants.OPT_REST_API)) { + restApi = true; } - showVersion(server, client, protocol); + showVersion(server, client, restApi); } return Status.FINE; } - private void showVersion(boolean server, boolean client, boolean protocol) { + private void showVersion(boolean server, boolean client, boolean restApi) { // If no option has been given, print out client version as default - if (!client && !server && !protocol) { + if (!client && !server && !restApi) { client = true; } @@ -93,15 +93,16 @@ public class ShowVersionFunction extends SqoopFunction { if (client) { printlnResource(Constants.RES_SHOW_PROMPT_VERSION_CLIENT_SERVER, Constants.OPT_CLIENT, - VersionInfo.getVersion(), - VersionInfo.getRevision(), + // See SQOOP-1623 to understand how the client version is derived. + VersionInfo.getBuildVersion(), + VersionInfo.getSourceRevision(), VersionInfo.getUser(), - VersionInfo.getDate() + VersionInfo.getBuildDate() ); } // If only client version was required we do not need to continue - if(!server && !protocol) { + if(!server && !restApi) { return; } @@ -113,16 +114,16 @@ public class ShowVersionFunction extends SqoopFunction { if (server) { printlnResource(Constants.RES_SHOW_PROMPT_VERSION_CLIENT_SERVER, Constants.OPT_SERVER, - versionBean.getVersion(), - versionBean.getRevision(), - versionBean.getUser(), - versionBean.getDate() + versionBean.getBuildVersion(), + versionBean.getSourceRevision(), + versionBean.getSystemUser(), + versionBean.getBuildDate() ); } - if (protocol) { - printlnResource(Constants.RES_SHOW_PROMPT_VERSION_PROTOCOL, - Arrays.toString(versionBean.getProtocols()) + if (restApi) { + printlnResource(Constants.RES_SHOW_PROMPT_API_VERSIONS, + Arrays.toString(versionBean.getSupportedAPIVersions()) ); } } http://git-wip-us.apache.org/repos/asf/sqoop/blob/fde0eb17/shell/src/main/java/org/apache/sqoop/shell/core/Constants.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/sqoop/shell/core/Constants.java b/shell/src/main/java/org/apache/sqoop/shell/core/Constants.java index f2bbe7f..44d5920 100644 --- a/shell/src/main/java/org/apache/sqoop/shell/core/Constants.java +++ b/shell/src/main/java/org/apache/sqoop/shell/core/Constants.java @@ -49,7 +49,7 @@ public class Constants { public static final String OPT_URL = "url"; public static final String OPT_SERVER = "server"; public static final String OPT_CLIENT = "client"; - public static final String OPT_PROTOCOL = "protocol"; + public static final String OPT_REST_API = "api"; public static final String OPT_SYNCHRONOUS = "synchronous"; public static final String OPT_POLL_TIMEOUT = "poll-timeout"; public static final String OPT_DETAIL = "detail"; @@ -68,7 +68,7 @@ public class Constants { public static final char OPT_URL_CHAR = 'u'; public static final char OPT_SERVER_CHAR = 's'; public static final char OPT_CLIENT_CHAR = 'c'; - public static final char OPT_PROTOCOL_CHAR = 'p'; + public static final char OPT_API_CHAR = 'p'; public static final char OPT_SYNCHRONOUS_CHAR = 's'; public static final char OPT_POLL_TIMEOUT_CHAR = 'p'; public static final char OPT_DETAIL_CHAR = 'd'; @@ -293,18 +293,18 @@ public class Constants { public static final String RES_SHOW_PROMPT_DISPLAY_ALL_VERSIONS = "show.prompt_display_all_versions"; - public static final String RES_SHOW_PROMPT_DISPLAY_VERSION_SERVER = + public static final String RES_SHOW_PROMPT_DISPLAY_SERVER_VERSION = "show.prompt_display_version_server"; - public static final String RES_SHOW_PROMPT_DISPLAY_VERSION_CLIENT = + public static final String RES_SHOW_PROMPT_DISPLAY_CLIENT_VERSION = "show.prompt_display_version_client"; - public static final String RES_SHOW_PROMPT_DISPLAY_VERSION_PROTOCOL = - "show.prompt_display_version_protocol"; + public static final String RES_SHOW_PROMPT_DISPLAY_REST_API_VERSION = + "show.prompt_display_version_api"; public static final String RES_SHOW_VERSION_USAGE = "show.version_usage"; public static final String RES_SHOW_PROMPT_VERSION_CLIENT_SERVER = "show.prompt_version_client_server"; - public static final String RES_SHOW_PROMPT_VERSION_PROTOCOL = - "show.prompt_version_protocol"; + public static final String RES_SHOW_PROMPT_API_VERSIONS = + "show.prompt_version_api"; public static final String RES_PROMPT_SYNCHRONOUS = "start.prompt_synchronous"; http://git-wip-us.apache.org/repos/asf/sqoop/blob/fde0eb17/shell/src/main/resources/shell-resource.properties ---------------------------------------------------------------------- diff --git a/shell/src/main/resources/shell-resource.properties b/shell/src/main/resources/shell-resource.properties index e2381dd..0e63c50 100644 --- a/shell/src/main/resources/shell-resource.properties +++ b/shell/src/main/resources/shell-resource.properties @@ -163,13 +163,13 @@ show.prompt_server_port = @|bold Server port:|@ {0} show.prompt_server_webapp = @|bold Server webapp:|@ {0} show.prompt_display_all_versions = Display all versions -show.prompt_display_version_server = Display server version -show.prompt_display_version_client = Display client version -show.prompt_display_version_protocol = Display protocol version +show.prompt_display_version_server = Display server build version +show.prompt_display_version_client = Display client build version +show.prompt_display_version_api = Display Rest API version show.version_usage = Usage: show version show.prompt_version_client_server = @|bold {0} version:|@\n Sqoop {1} \ -revision {2} \n Compiled by {3} on {4} -show.prompt_version_protocol = @|bold Protocol version:|@\n {0} +source revision {2} \n Compiled by {3} on {4} +show.prompt_version_api = @|bold API versions:|@\n {0} sqoop.shell_banner = @|green Sqoop Shell:|@ Type '@|bold help|@' or '@|bold \\h|@' for help. sqoop.prompt_shell_loadrc = Loading resource file {0} http://git-wip-us.apache.org/repos/asf/sqoop/blob/fde0eb17/test/src/test/java/org/apache/sqoop/integration/server/VersionTest.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/sqoop/integration/server/VersionTest.java b/test/src/test/java/org/apache/sqoop/integration/server/VersionTest.java index beed82e..b3254bd 100644 --- a/test/src/test/java/org/apache/sqoop/integration/server/VersionTest.java +++ b/test/src/test/java/org/apache/sqoop/integration/server/VersionTest.java @@ -35,11 +35,11 @@ public class VersionTest extends TomcatTestCase { VersionResourceRequest versionRequest = new VersionResourceRequest(); VersionBean versionBean = versionRequest.read(getServerUrl()); - assertEquals(versionBean.getVersion(), VersionInfo.getVersion()); - assertEquals(versionBean.getDate(), VersionInfo.getDate()); - assertEquals(versionBean.getRevision(), VersionInfo.getRevision()); - assertEquals(versionBean.getUser(), VersionInfo.getUser()); - assertEquals(versionBean.getRevision(), VersionInfo.getRevision()); + assertEquals(versionBean.getBuildVersion(), VersionInfo.getBuildVersion()); + assertEquals(versionBean.getBuildDate(), VersionInfo.getBuildDate()); + assertEquals(versionBean.getSourceRevision(), VersionInfo.getSourceRevision()); + assertEquals(versionBean.getSystemUser(), VersionInfo.getUser()); + assertEquals(versionBean.getSourceRevision(), VersionInfo.getSourceRevision()); } } http://git-wip-us.apache.org/repos/asf/sqoop/blob/fde0eb17/tools/src/main/java/org/apache/sqoop/tools/ToolRunner.java ---------------------------------------------------------------------- diff --git a/tools/src/main/java/org/apache/sqoop/tools/ToolRunner.java b/tools/src/main/java/org/apache/sqoop/tools/ToolRunner.java index 769c2b4..f6a84e3 100644 --- a/tools/src/main/java/org/apache/sqoop/tools/ToolRunner.java +++ b/tools/src/main/java/org/apache/sqoop/tools/ToolRunner.java @@ -41,9 +41,9 @@ public final class ToolRunner { */ public static void main(String[] args) throws Exception { System.out.println("Sqoop tool executor:"); - System.out.println("\tVersion: " + VersionInfo.getVersion()); - System.out.println("\tRevision: " + VersionInfo.getRevision()); - System.out.println("\tCompiled on " + VersionInfo.getDate() + " by " + VersionInfo.getUser()); + System.out.println("\tVersion: " + VersionInfo.getBuildVersion()); + System.out.println("\tRevision: " + VersionInfo.getSourceRevision()); + System.out.println("\tCompiled on " + VersionInfo.getBuildDate() + " by " + VersionInfo.getUser()); if(args.length < 1) { throw new IllegalArgumentException("Name of the tool is missing."); http://git-wip-us.apache.org/repos/asf/sqoop/blob/fde0eb17/tools/src/main/java/org/apache/sqoop/tools/tool/RepositoryDumpTool.java ---------------------------------------------------------------------- diff --git a/tools/src/main/java/org/apache/sqoop/tools/tool/RepositoryDumpTool.java b/tools/src/main/java/org/apache/sqoop/tools/tool/RepositoryDumpTool.java index 534877f..c219e68 100644 --- a/tools/src/main/java/org/apache/sqoop/tools/tool/RepositoryDumpTool.java +++ b/tools/src/main/java/org/apache/sqoop/tools/tool/RepositoryDumpTool.java @@ -120,9 +120,9 @@ public class RepositoryDumpTool extends ConfiguredTool { private JSONObject repoMetadata(boolean skipSensitive) { JSONObject metadata = new JSONObject(); - metadata.put(JSONConstants.VERSION, VersionInfo.getVersion()); - metadata.put(JSONConstants.REVISION, VersionInfo.getRevision()); - metadata.put(JSONConstants.COMPILE_DATE, VersionInfo.getDate()); + metadata.put(JSONConstants.VERSION, VersionInfo.getBuildVersion()); + metadata.put(JSONConstants.REVISION, VersionInfo.getSourceRevision()); + metadata.put(JSONConstants.COMPILE_DATE, VersionInfo.getBuildDate()); metadata.put(JSONConstants.COMPILE_USER, VersionInfo.getUser()); metadata.put(JSONConstants.INCLUDE_SENSITIVE,!skipSensitive ); http://git-wip-us.apache.org/repos/asf/sqoop/blob/fde0eb17/tools/src/main/java/org/apache/sqoop/tools/tool/RepositoryLoadTool.java ---------------------------------------------------------------------- diff --git a/tools/src/main/java/org/apache/sqoop/tools/tool/RepositoryLoadTool.java b/tools/src/main/java/org/apache/sqoop/tools/tool/RepositoryLoadTool.java index 45c21a1..64b08fc 100644 --- a/tools/src/main/java/org/apache/sqoop/tools/tool/RepositoryLoadTool.java +++ b/tools/src/main/java/org/apache/sqoop/tools/tool/RepositoryLoadTool.java @@ -220,7 +220,7 @@ public class RepositoryLoadTool extends ConfiguredTool { private boolean validateMetadata(JSONObject metadata) { String jsonVersion = (String) metadata.get(JSONConstants.VERSION); Boolean includeSensitive = (Boolean) metadata.get(JSONConstants.INCLUDE_SENSITIVE); - String repoVersion = VersionInfo.getVersion(); + String repoVersion = VersionInfo.getBuildVersion(); if (!jsonVersion.equals(repoVersion)) { LOG.error("Repository version in file (" + jsonVersion
