File tree Expand file tree Collapse file tree
artemis-test-support/src/main/java/org/apache/activemq/artemis/utils
e2e-tests/src/test/java/org/apache/activemq/artemis/tests/e2e/common
smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/upgradeTest Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /*
2+ * Licensed to the Apache Software Foundation (ASF) under one or more
3+ * contributor license agreements. See the NOTICE file distributed with
4+ * this work for additional information regarding copyright ownership.
5+ * The ASF licenses this file to You under the Apache License, Version 2.0
6+ * (the "License"); you may not use this file except in compliance with
7+ * the License. You may obtain a copy of the License at
8+ *
9+ * http://www.apache.org/licenses/LICENSE-2.0
10+ *
11+ * Unless required by applicable law or agreed to in writing, software
12+ * distributed under the License is distributed on an "AS IS" BASIS,
13+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+ * See the License for the specific language governing permissions and
15+ * limitations under the License.
16+ */
17+
18+ package org .apache .activemq .artemis .utils ;
19+
20+ import java .io .File ;
21+ import java .io .IOException ;
22+
23+ public class BasedirSupport {
24+
25+ public static String getBasedir () {
26+ String basedir = System .getProperty ("basedir" );
27+ if (basedir == null ) {
28+ try {
29+ basedir = new File ("." ).getCanonicalPath ();
30+ } catch (IOException e ) {
31+ throw new RuntimeException ("Failed to resolve canonical path for current directory" , e );
32+ }
33+ }
34+ return basedir ;
35+ }
36+
37+ }
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ public class RealServerTestBase extends ActiveMQTestBase {
6262 private static final String JMX_SERVER_HOSTNAME = "localhost" ;
6363 private static final int JMX_SERVER_PORT = 10099 ;
6464
65- public static final String basedir = System . getProperty ( "basedir" );
65+ public static final String basedir = BasedirSupport . getBasedir ( );
6666
6767 public static final String ARTEMIS_HOME_PROPERTY = "artemis.distribution.output" ;
6868
Original file line number Diff line number Diff line change 1919import org .apache .activemq .artemis .api .jms .ActiveMQJMSClient ;
2020import org .apache .activemq .artemis .jms .client .ActiveMQConnectionFactory ;
2121import org .apache .activemq .artemis .tests .util .ActiveMQTestBase ;
22+ import org .apache .activemq .artemis .utils .BasedirSupport ;
2223
2324public class E2ETestBase extends ActiveMQTestBase {
2425
25- public static final String basedir = System . getProperty ( "basedir" );
26+ public static final String basedir = BasedirSupport . getBasedir ( );
2627
2728 protected static final void recreateBrokerDirectory (final String homeInstance ) {
2829 recreateDirectory (homeInstance + "/data" );
Original file line number Diff line number Diff line change 4343import org .apache .activemq .artemis .cli .commands .ActionContext ;
4444import org .apache .activemq .artemis .cli .commands .Create ;
4545import org .apache .activemq .artemis .cli .commands .Upgrade ;
46+ import org .apache .activemq .artemis .utils .BasedirSupport ;
4647import org .apache .activemq .artemis .utils .FileUtil ;
4748import org .junit .jupiter .api .Test ;
4849import org .slf4j .Logger ;
@@ -55,8 +56,7 @@ public class CompareUpgradeTest {
5556
5657 private static final Logger logger = LoggerFactory .getLogger (MethodHandles .lookup ().lookupClass ());
5758
58- public static final String basedir = System .getProperty ("basedir" );
59-
59+ public static final String basedir = BasedirSupport .getBasedir ();
6060
6161 @ Test
6262 public void testCompareWindowsFreshInstance () throws Exception {
You can’t perform that action at this time.
0 commit comments