atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shweth...@apache.org
Subject incubator-atlas git commit: ATLAS-201 Rename org.apache.atlas.Main to org.apache.atlas.Atlas (rishabhbhardwaj via shwethags)
Date Wed, 14 Oct 2015 17:03:30 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/master fdafb3598 -> b37c030d7


ATLAS-201 Rename org.apache.atlas.Main to org.apache.atlas.Atlas (rishabhbhardwaj via shwethags)


Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/b37c030d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/b37c030d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/b37c030d

Branch: refs/heads/master
Commit: b37c030d70c5cc4fe7b17fa860536a089b30035d
Parents: fdafb35
Author: Shwetha GS <sshivalingamurthy@hortonworks.com>
Authored: Wed Oct 14 10:02:56 2015 -0700
Committer: Shwetha GS <sshivalingamurthy@hortonworks.com>
Committed: Wed Oct 14 10:02:56 2015 -0700

----------------------------------------------------------------------
 distro/src/bin/atlas_start.py                   |   2 +-
 distro/src/test/python/scripts/TestMetadata.py  |   4 +-
 release-log.txt                                 |   1 +
 .../src/main/java/org/apache/atlas/Atlas.java   | 172 +++++++++++++++++++
 webapp/src/main/java/org/apache/atlas/Main.java | 172 -------------------
 .../src/test/java/org/apache/atlas/AtlasIT.java |  55 ++++++
 .../src/test/java/org/apache/atlas/MainIT.java  |  55 ------
 7 files changed, 231 insertions(+), 230 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/b37c030d/distro/src/bin/atlas_start.py
----------------------------------------------------------------------
diff --git a/distro/src/bin/atlas_start.py b/distro/src/bin/atlas_start.py
index c07b076..0d37732 100755
--- a/distro/src/bin/atlas_start.py
+++ b/distro/src/bin/atlas_start.py
@@ -65,7 +65,7 @@ def main():
     args = ["-app", os.path.join(web_app_dir, "atlas")]
     args.extend(sys.argv[1:])
 
-    process = mc.java("org.apache.atlas.Main", args, metadata_classpath, jvm_opts_list, logdir)
+    process = mc.java("org.apache.atlas.Atlas", args, metadata_classpath, jvm_opts_list,
logdir)
     mc.writePid(metadata_pid_file, process)
 
     print "Apache Atlas Server started!!!\n"

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/b37c030d/distro/src/test/python/scripts/TestMetadata.py
----------------------------------------------------------------------
diff --git a/distro/src/test/python/scripts/TestMetadata.py b/distro/src/test/python/scripts/TestMetadata.py
index a6db7b4..d47be69 100644
--- a/distro/src/test/python/scripts/TestMetadata.py
+++ b/distro/src/test/python/scripts/TestMetadata.py
@@ -48,13 +48,13 @@ class TestMetadata(unittest.TestCase):
     self.assertTrue(java_mock.called)
     if IS_WINDOWS:
       java_mock.assert_called_with(
-        'org.apache.atlas.Main',
+        'org.apache.atlas.Atlas',
         ['-app', 'metadata_home\\server\\webapp\\atlas'],
         'metadata_home\\conf;metadata_home\\server\\webapp\\atlas\\WEB-INF\\classes;metadata_home\\server\\webapp\\atlas\\WEB-INF\\lib\\*;metadata_home\\libext\\*',
         ['-Datlas.log.dir=metadata_home\\logs', '-Datlas.log.file=application.log', '-Datlas.home=metadata_home',
'-Datlas.conf=metadata_home\\conf', '-Xmx1024m', '-XX:MaxPermSize=512m', '-Dlog4j.configuration=atlas-log4j.xml'],
'metadata_home\\logs')
     else:
       java_mock.assert_called_with(
-        'org.apache.atlas.Main',
+        'org.apache.atlas.Atlas',
         ['-app', 'metadata_home/server/webapp/atlas'],
         'metadata_home/conf:metadata_home/server/webapp/atlas/WEB-INF/classes:metadata_home/server/webapp/atlas/WEB-INF/lib/*:metadata_home/libext/*',
         ['-Datlas.log.dir=metadata_home/logs', '-Datlas.log.file=application.log', '-Datlas.home=metadata_home',
'-Datlas.conf=metadata_home/conf', '-Xmx1024m', '-XX:MaxPermSize=512m', '-Dlog4j.configuration=atlas-log4j.xml'],
 'metadata_home/logs')

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/b37c030d/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 132e7c6..9c6b079 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -9,6 +9,7 @@ ATLAS-54 Rename configs in hive hook (shwethags)
 ATLAS-3 Mixed Index creation fails with Date types (sumasai via shwethags)
 
 ALL CHANGES:
+ATLAS-201 Rename org.apache.atlas.Main to org.apache.atlas.Atlas (rishabhbhardwaj via shwethags)
 ATLAS-179 Atlas hook causes mem leak and hive server 2 crashes (shwethags)
 ATLAS-212 Remove test class usage of hive configuration property "atlas.rest.address" (jspeidel
via shwethags)
 ATLAS-159 UI generated files should be target (sanjayp via sumasai)

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/b37c030d/webapp/src/main/java/org/apache/atlas/Atlas.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/Atlas.java b/webapp/src/main/java/org/apache/atlas/Atlas.java
new file mode 100755
index 0000000..5ae1e44
--- /dev/null
+++ b/webapp/src/main/java/org/apache/atlas/Atlas.java
@@ -0,0 +1,172 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.atlas;
+
+import org.apache.atlas.web.service.EmbeddedServer;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.GnuParser;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Iterator;
+
+/**
+ * Driver for running Metadata as a standalone server with embedded jetty server.
+ */
+public final class Atlas {
+    private static final Logger LOG = LoggerFactory.getLogger(Atlas.class);
+    private static final String APP_PATH = "app";
+    private static final String APP_PORT = "port";
+    private static final String ATLAS_HOME = "atlas.home";
+    private static final String ATLAS_LOG_DIR = "atlas.log.dir";
+    public static final String ATLAS_SERVER_HTTPS_PORT = "atlas.server.https.port";
+    public static final String ATLAS_SERVER_HTTP_PORT = "atlas.server.http.port";
+
+    private static EmbeddedServer server;
+
+    static {
+        Runtime.getRuntime().addShutdownHook(new Thread() {
+            @Override
+            public void run() {
+                try {
+                    shutdown();
+                } catch (Exception e) {
+                    LOG.debug("Failed to shutdown", e);
+                }
+            }
+        });
+    }
+
+    private static void shutdown() {
+        server.stop();
+    }
+
+    /**
+     * Prevent users from constructing this.
+     */
+    private Atlas() {
+    }
+
+    protected static CommandLine parseArgs(String[] args) throws ParseException {
+        Options options = new Options();
+        Option opt;
+
+        opt = new Option(APP_PATH, true, "Application Path");
+        opt.setRequired(false);
+        options.addOption(opt);
+
+        opt = new Option(APP_PORT, true, "Application Port");
+        opt.setRequired(false);
+        options.addOption(opt);
+
+        return new GnuParser().parse(options, args);
+    }
+
+    public static void main(String[] args) throws Exception {
+        CommandLine cmd = parseArgs(args);
+        PropertiesConfiguration buildConfiguration = new PropertiesConfiguration("atlas-buildinfo.properties");
+        String appPath = "webapp/target/atlas-webapp-" + getProjectVersion(buildConfiguration);
+
+        if (cmd.hasOption(APP_PATH)) {
+            appPath = cmd.getOptionValue(APP_PATH);
+        }
+
+        setApplicationHome();
+        Configuration configuration = ApplicationProperties.get();
+        final String enableTLSFlag = configuration.getString("atlas.enableTLS");
+        final int appPort = getApplicationPort(cmd, enableTLSFlag, configuration);
+        final boolean enableTLS = isTLSEnabled(enableTLSFlag, appPort);
+        configuration.setProperty("atlas.enableTLS", String.valueOf(enableTLS));
+
+        showStartupInfo(buildConfiguration, enableTLS, appPort);
+
+        server = EmbeddedServer.newServer(appPort, appPath, enableTLS);
+        server.start();
+    }
+
+    private static void setApplicationHome() {
+        if (System.getProperty(ATLAS_HOME) == null) {
+            System.setProperty(ATLAS_HOME, "target");
+        }
+        if (System.getProperty(ATLAS_LOG_DIR) == null) {
+            System.setProperty(ATLAS_LOG_DIR, "target/logs");
+        }
+    }
+
+    public static String getProjectVersion(PropertiesConfiguration buildConfiguration) {
+        return buildConfiguration.getString("project.version");
+    }
+
+    static int getApplicationPort(CommandLine cmd, String enableTLSFlag, Configuration configuration)
{
+        final int appPort;
+        if (cmd.hasOption(APP_PORT)) {
+            appPort = Integer.valueOf(cmd.getOptionValue(APP_PORT));
+        } else {
+            // default : atlas.enableTLS is true
+            appPort = getPortValue(configuration, enableTLSFlag);
+        }
+
+        return appPort;
+    }
+
+    private static int getPortValue(Configuration configuration, String enableTLSFlag) {
+        int appPort;
+
+        assert configuration != null;
+        appPort = StringUtils.isEmpty(enableTLSFlag) || enableTLSFlag.equals("true") ?
+            configuration.getInt(ATLAS_SERVER_HTTPS_PORT, 21443) :
+            configuration.getInt(ATLAS_SERVER_HTTP_PORT, 21000);
+        return appPort;
+    }
+
+    private static boolean isTLSEnabled(String enableTLSFlag, int appPort) {
+        return Boolean.valueOf(StringUtils.isEmpty(enableTLSFlag) ?
+                System.getProperty("atlas.enableTLS", (appPort % 1000) == 443 ? "true" :
"false") : enableTLSFlag);
+    }
+
+    private static void showStartupInfo(PropertiesConfiguration buildConfiguration, boolean
enableTLS, int appPort) {
+        StringBuilder buffer = new StringBuilder();
+        buffer.append("\n############################################");
+        buffer.append("############################################");
+        buffer.append("\n                               Atlas Server (STARTUP)");
+        buffer.append("\n");
+        try {
+            final Iterator<String> keys = buildConfiguration.getKeys();
+            while (keys.hasNext()) {
+                String key = keys.next();
+                buffer.append('\n').append('\t').append(key).
+                        append(":\t").append(buildConfiguration.getProperty(key));
+            }
+        } catch (Throwable e) {
+            buffer.append("*** Unable to get build info ***");
+        }
+        buffer.append("\n############################################");
+        buffer.append("############################################");
+        LOG.info(buffer.toString());
+        LOG.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
+        LOG.info("Server starting with TLS ? {} on port {}", enableTLS, appPort);
+        LOG.info("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/b37c030d/webapp/src/main/java/org/apache/atlas/Main.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/Main.java b/webapp/src/main/java/org/apache/atlas/Main.java
deleted file mode 100755
index d91680d..0000000
--- a/webapp/src/main/java/org/apache/atlas/Main.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas;
-
-import org.apache.atlas.web.service.EmbeddedServer;
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.GnuParser;
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.Options;
-import org.apache.commons.cli.ParseException;
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.PropertiesConfiguration;
-import org.apache.commons.lang.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Iterator;
-
-/**
- * Driver for running Metadata as a standalone server with embedded jetty server.
- */
-public final class Main {
-    private static final Logger LOG = LoggerFactory.getLogger(Main.class);
-    private static final String APP_PATH = "app";
-    private static final String APP_PORT = "port";
-    private static final String ATLAS_HOME = "atlas.home";
-    private static final String ATLAS_LOG_DIR = "atlas.log.dir";
-    public static final String ATLAS_SERVER_HTTPS_PORT = "atlas.server.https.port";
-    public static final String ATLAS_SERVER_HTTP_PORT = "atlas.server.http.port";
-
-    private static EmbeddedServer server;
-
-    static {
-        Runtime.getRuntime().addShutdownHook(new Thread() {
-            @Override
-            public void run() {
-                try {
-                    shutdown();
-                } catch (Exception e) {
-                    LOG.debug("Failed to shutdown", e);
-                }
-            }
-        });
-    }
-
-    private static void shutdown() {
-        server.stop();
-    }
-
-    /**
-     * Prevent users from constructing this.
-     */
-    private Main() {
-    }
-
-    protected static CommandLine parseArgs(String[] args) throws ParseException {
-        Options options = new Options();
-        Option opt;
-
-        opt = new Option(APP_PATH, true, "Application Path");
-        opt.setRequired(false);
-        options.addOption(opt);
-
-        opt = new Option(APP_PORT, true, "Application Port");
-        opt.setRequired(false);
-        options.addOption(opt);
-
-        return new GnuParser().parse(options, args);
-    }
-
-    public static void main(String[] args) throws Exception {
-        CommandLine cmd = parseArgs(args);
-        PropertiesConfiguration buildConfiguration = new PropertiesConfiguration("atlas-buildinfo.properties");
-        String appPath = "webapp/target/atlas-webapp-" + getProjectVersion(buildConfiguration);
-
-        if (cmd.hasOption(APP_PATH)) {
-            appPath = cmd.getOptionValue(APP_PATH);
-        }
-
-        setApplicationHome();
-        Configuration configuration = ApplicationProperties.get();
-        final String enableTLSFlag = configuration.getString("atlas.enableTLS");
-        final int appPort = getApplicationPort(cmd, enableTLSFlag, configuration);
-        final boolean enableTLS = isTLSEnabled(enableTLSFlag, appPort);
-        configuration.setProperty("atlas.enableTLS", String.valueOf(enableTLS));
-
-        showStartupInfo(buildConfiguration, enableTLS, appPort);
-
-        server = EmbeddedServer.newServer(appPort, appPath, enableTLS);
-        server.start();
-    }
-
-    private static void setApplicationHome() {
-        if (System.getProperty(ATLAS_HOME) == null) {
-            System.setProperty(ATLAS_HOME, "target");
-        }
-        if (System.getProperty(ATLAS_LOG_DIR) == null) {
-            System.setProperty(ATLAS_LOG_DIR, "target/logs");
-        }
-    }
-
-    public static String getProjectVersion(PropertiesConfiguration buildConfiguration) {
-        return buildConfiguration.getString("project.version");
-    }
-
-    static int getApplicationPort(CommandLine cmd, String enableTLSFlag, Configuration configuration)
{
-        final int appPort;
-        if (cmd.hasOption(APP_PORT)) {
-            appPort = Integer.valueOf(cmd.getOptionValue(APP_PORT));
-        } else {
-            // default : atlas.enableTLS is true
-            appPort = getPortValue(configuration, enableTLSFlag);
-        }
-
-        return appPort;
-    }
-
-    private static int getPortValue(Configuration configuration, String enableTLSFlag) {
-        int appPort;
-
-        assert configuration != null;
-        appPort = StringUtils.isEmpty(enableTLSFlag) || enableTLSFlag.equals("true") ?
-            configuration.getInt(ATLAS_SERVER_HTTPS_PORT, 21443) :
-            configuration.getInt(ATLAS_SERVER_HTTP_PORT, 21000);
-        return appPort;
-    }
-
-    private static boolean isTLSEnabled(String enableTLSFlag, int appPort) {
-        return Boolean.valueOf(StringUtils.isEmpty(enableTLSFlag) ?
-                System.getProperty("atlas.enableTLS", (appPort % 1000) == 443 ? "true" :
"false") : enableTLSFlag);
-    }
-
-    private static void showStartupInfo(PropertiesConfiguration buildConfiguration, boolean
enableTLS, int appPort) {
-        StringBuilder buffer = new StringBuilder();
-        buffer.append("\n############################################");
-        buffer.append("############################################");
-        buffer.append("\n                               Atlas Server (STARTUP)");
-        buffer.append("\n");
-        try {
-            final Iterator<String> keys = buildConfiguration.getKeys();
-            while (keys.hasNext()) {
-                String key = keys.next();
-                buffer.append('\n').append('\t').append(key).
-                        append(":\t").append(buildConfiguration.getProperty(key));
-            }
-        } catch (Throwable e) {
-            buffer.append("*** Unable to get build info ***");
-        }
-        buffer.append("\n############################################");
-        buffer.append("############################################");
-        LOG.info(buffer.toString());
-        LOG.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
-        LOG.info("Server starting with TLS ? {} on port {}", enableTLS, appPort);
-        LOG.info("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/b37c030d/webapp/src/test/java/org/apache/atlas/AtlasIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/AtlasIT.java b/webapp/src/test/java/org/apache/atlas/AtlasIT.java
new file mode 100644
index 0000000..ae3a813
--- /dev/null
+++ b/webapp/src/test/java/org/apache/atlas/AtlasIT.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ *
+ */
+public class AtlasIT {
+
+  @Test
+  public void testPortSelection () throws Exception {
+    PropertiesConfiguration config = new PropertiesConfiguration();
+    // test ports via config
+    config.setProperty(Atlas.ATLAS_SERVER_HTTP_PORT, 21001);
+    config.setProperty(Atlas.ATLAS_SERVER_HTTPS_PORT, 22443);
+    int port = Atlas.getApplicationPort(Atlas.parseArgs(new String[] {}), "false",
+                                       config );
+    Assert.assertEquals(21001, port, "wrong http port");
+    port = Atlas.getApplicationPort(Atlas.parseArgs(new String[] {}), "true",
+                                   config );
+    Assert.assertEquals(22443, port, "wrong https port");
+    // test defaults
+    port = Atlas.getApplicationPort(Atlas.parseArgs(new String[] {}), "false",
+                                   new PropertiesConfiguration() );
+    Assert.assertEquals(21000, port, "wrong http port");
+    port = Atlas.getApplicationPort(Atlas.parseArgs(new String[] {}), "true",
+                                   new PropertiesConfiguration() );
+    Assert.assertEquals(21443, port, "wrong https port");
+    // test command line override
+    CommandLine commandLine = Atlas.parseArgs(new String[] {"--port", "22000"});
+    port = Atlas.getApplicationPort(commandLine, "true", config);
+    Assert.assertEquals(22000, port, "wrong https port");
+    port = Atlas.getApplicationPort(commandLine, "false", config);
+    Assert.assertEquals(22000, port, "wrong https port");
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/b37c030d/webapp/src/test/java/org/apache/atlas/MainIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/MainIT.java b/webapp/src/test/java/org/apache/atlas/MainIT.java
deleted file mode 100644
index 19cc4b7..0000000
--- a/webapp/src/test/java/org/apache/atlas/MainIT.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.atlas;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.configuration.PropertiesConfiguration;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-/**
- *
- */
-public class MainIT {
-
-  @Test
-  public void testPortSelection () throws Exception {
-    PropertiesConfiguration config = new PropertiesConfiguration();
-    // test ports via config
-    config.setProperty(Main.ATLAS_SERVER_HTTP_PORT, 21001);
-    config.setProperty(Main.ATLAS_SERVER_HTTPS_PORT, 22443);
-    int port = Main.getApplicationPort(Main.parseArgs(new String[] {}), "false",
-                                       config );
-    Assert.assertEquals(21001, port, "wrong http port");
-    port = Main.getApplicationPort(Main.parseArgs(new String[] {}), "true",
-                                   config );
-    Assert.assertEquals(22443, port, "wrong https port");
-    // test defaults
-    port = Main.getApplicationPort(Main.parseArgs(new String[] {}), "false",
-                                   new PropertiesConfiguration() );
-    Assert.assertEquals(21000, port, "wrong http port");
-    port = Main.getApplicationPort(Main.parseArgs(new String[] {}), "true",
-                                   new PropertiesConfiguration() );
-    Assert.assertEquals(21443, port, "wrong https port");
-    // test command line override
-    CommandLine commandLine = Main.parseArgs(new String[] {"--port", "22000"});
-    port = Main.getApplicationPort(commandLine, "true", config);
-    Assert.assertEquals(22000, port, "wrong https port");
-    port = Main.getApplicationPort(commandLine, "false", config);
-    Assert.assertEquals(22000, port, "wrong https port");
-  }
-}


Mime
View raw message