added svcapi ui and camunda code
[it/otf.git] / otf-service-api / src / test / java / org / oran / otf / api / tests / config / InMemory.java
diff --git a/otf-service-api/src/test/java/org/oran/otf/api/tests/config/InMemory.java b/otf-service-api/src/test/java/org/oran/otf/api/tests/config/InMemory.java
new file mode 100644 (file)
index 0000000..a5243a5
--- /dev/null
@@ -0,0 +1,69 @@
+/*  Copyright (c) 2019 AT&T Intellectual Property.                             #\r
+#                                                                              #\r
+#   Licensed under the Apache License, Version 2.0 (the "License");            #\r
+#   you may not use this file except in compliance with the License.           #\r
+#   You may obtain a copy of the License at                                    #\r
+#                                                                              #\r
+#       http://www.apache.org/licenses/LICENSE-2.0                             #\r
+#                                                                              #\r
+#   Unless required by applicable law or agreed to in writing, software        #\r
+#   distributed under the License is distributed on an "AS IS" BASIS,          #\r
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #\r
+#   See the License for the specific language governing permissions and        #\r
+#   limitations under the License.                                             #\r
+##############################################################################*/\r
+\r
+\r
+package org.oran.otf.api.tests.config;\r
+\r
+import de.flapdoodle.embed.mongo.Command;\r
+import de.flapdoodle.embed.mongo.MongodExecutable;\r
+import de.flapdoodle.embed.mongo.MongodStarter;\r
+import de.flapdoodle.embed.mongo.config.DownloadConfigBuilder;\r
+import de.flapdoodle.embed.mongo.config.ExtractedArtifactStoreBuilder;\r
+import de.flapdoodle.embed.mongo.config.IMongodConfig;\r
+import de.flapdoodle.embed.mongo.config.MongodConfigBuilder;\r
+import de.flapdoodle.embed.mongo.config.Net;\r
+import de.flapdoodle.embed.mongo.config.RuntimeConfigBuilder;\r
+import de.flapdoodle.embed.mongo.distribution.Version.Main;\r
+import de.flapdoodle.embed.process.config.IRuntimeConfig;\r
+import de.flapdoodle.embed.process.config.store.HttpProxyFactory;\r
+import de.flapdoodle.embed.process.runtime.Network;\r
+import org.springframework.beans.factory.annotation.Autowired;\r
+import org.springframework.context.annotation.Bean;\r
+import org.springframework.context.annotation.Configuration;\r
+import org.springframework.context.annotation.Profile;\r
+\r
+@Configuration\r
+@Profile("test")\r
+public class InMemory {\r
+  @Autowired MongodStarter mongodStarter;\r
+\r
+  @Bean\r
+  public MongodStarter mongodStarter(){\r
+    Command command = Command.MongoD;\r
+    IRuntimeConfig runtimeConfig = new RuntimeConfigBuilder()\r
+        .defaults(command)\r
+        .artifactStore(new ExtractedArtifactStoreBuilder()\r
+            .defaults(command)\r
+            .download(new DownloadConfigBuilder()\r
+                .defaultsForCommand(command)\r
+                //.downloadPath("http://fastdl.mongodb.org/win32/")\r
+                .proxyFactory(new HttpProxyFactory("localhost",8080))))\r
+             .build();\r
+\r
+    MongodStarter starter = MongodStarter.getInstance(runtimeConfig);\r
+\r
+    return MongodStarter.getInstance(runtimeConfig);\r
+  }\r
+  @Bean\r
+  public MongodExecutable mongodExecutable()throws Exception{\r
+    IMongodConfig mongodConfig = new MongodConfigBuilder().version(Main.PRODUCTION)\r
+        .net(new Net("localhost", 5555, Network.localhostIsIPv6()))\r
+        .build();\r
+    //MongodStarter starter = MongodStarter.getDefaultInstance();\r
+    return mongodStarter.prepare(mongodConfig);\r
+\r
+  }\r
+\r
+}\r