From 3505a52ac853c134ecaf40f2977667de8770ec59 Mon Sep 17 00:00:00 2001 From: Instrumental Date: Thu, 31 Jan 2019 14:49:24 -0600 Subject: Implement public private locator Issue-ID: AAF-723 Change-Id: Ib5507ccaab0b7e565c98a16733d1b42dfb608095 Signed-off-by: Instrumental --- .../onap/aaf/auth/server/test/JU_AbsService.java | 2 +- .../aaf/auth/server/test/JU_AbsServiceStarter.java | 2 +- .../java/org/onap/aaf/auth/util/test/TestKill.java | 65 ++++++++++++++++++++++ 3 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 auth/auth-core/src/test/java/org/onap/aaf/auth/util/test/TestKill.java (limited to 'auth/auth-core/src/test/java') diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsService.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsService.java index 65f019f0..b89e2e5d 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsService.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsService.java @@ -103,7 +103,7 @@ public class JU_AbsService { BasicEnv bEnv = new BasicEnv(); PropAccess prop = new PropAccess(); - prop.setProperty(Config.AAF_LOCATOR_NAMES, "te.st"); + prop.setProperty(Config.AAF_LOCATOR_ENTRIES, "te.st"); prop.setProperty(Config.AAF_LOCATOR_VERSION, "te.st"); prop.setLogLevel(Level.DEBUG); AbsServiceStub absServiceStub = new AbsServiceStub(prop, bEnv); //Testing other branches requires "fails" due to exception handling, will leave that off for now. diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java index 1fe98d84..2fa9e123 100644 --- a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java @@ -131,7 +131,7 @@ public class JU_AbsServiceStarter { BasicEnv bEnv = new BasicEnv(); PropAccess prop = new PropAccess(); - prop.setProperty(Config.AAF_LOCATOR_NAMES, "te.st"); + prop.setProperty(Config.AAF_LOCATOR_ENTRIES, "te.st"); prop.setProperty(Config.AAF_LOCATOR_VERSION, "te.st"); prop.setLogLevel(Level.DEBUG); absServiceStub = new AbsServiceStub(prop, bEnv); diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/util/test/TestKill.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/util/test/TestKill.java new file mode 100644 index 00000000..c6ddc79f --- /dev/null +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/util/test/TestKill.java @@ -0,0 +1,65 @@ +/** + * ============LICENSE_START==================================================== + * org.onap.aaf + * =========================================================================== + * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. + * =========================================================================== + * Licensed 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. + * ============LICENSE_END==================================================== + */ + +package org.onap.aaf.auth.util.test; + +import java.io.IOException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +public class TestKill implements Runnable { + + public static void main(String[] args) { + ExecutorService es = Executors.newSingleThreadExecutor(); + TestKill tk = new TestKill(); + Future app = es.submit(tk); + Runtime.getRuntime().addShutdownHook(new Thread() { + @Override + public void run() { + System.out.println("Shutdown Hook, thread: setting interrupt"); + app.cancel(true); + tk.longProcess(); + es.shutdown(); + } + }); + System.out.println("Service Start"); + System.out.print("Hit to end:"); + try { + System.in.read(); + System.exit(0); + } catch (IOException e) { + } + } + + @Override + public void run() { + } + + private void longProcess() { + System.out.println("Starting long cleanup process"); + try { + Thread.sleep(10000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + System.out.println("Ending long cleanup process"); + } +} -- cgit 1.2.3-korg