1 package org.onap.sdc.impl;
3 import static org.junit.jupiter.api.extension.ExtensionContext.Namespace.GLOBAL;
5 import org.junit.jupiter.api.extension.BeforeAllCallback;
6 import org.junit.jupiter.api.extension.ExtensionContext;
7 import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException;
9 public abstract class BaseSetupExtension implements BeforeAllCallback, ExtensionContext.Store.CloseableResource {
12 public void beforeAll(ExtensionContext context) throws Exception {
13 // We need to use a unique key here, across all usages of this particular extension.
14 String uniqueKey = this.getClass().getName();
15 Object value = context.getRoot().getStore(GLOBAL).get(uniqueKey);
17 // First test container invocation.
18 context.getRoot().getStore(GLOBAL).put(uniqueKey, this);
23 // Callback that is invoked <em>exactly once</em>
24 // before the start of <em>all</em> test containers.
25 abstract void setup() throws SdcToscaParserException;
27 // Callback that is invoked <em>exactly once</em>
28 // after the end of <em>all</em> test containers.
29 // Inherited from {@code CloseableResource}
30 public abstract void close() throws Throwable;