CONSTRAINT `FK3njadtw43ieph7ftt4kxdhcko` FOREIGN KEY (`db_type_id`) REFERENCES `db_type` (`id`)\r
) ENGINE=InnoDB DEFAULT CHARSET=utf8;\r
\r
-CREATE TABLE `portal` (\r
- `name` varchar(255) NOT NULL,\r
- `enabled` bit(1) DEFAULT NULL,\r
- `host` varchar(255) DEFAULT NULL,\r
- `login` varchar(255) DEFAULT NULL,\r
- `pass` varchar(255) DEFAULT NULL,\r
- `port` int(11) DEFAULT NULL,\r
- `related_db` int(11) DEFAULT NULL,\r
- PRIMARY KEY (`name`),\r
- KEY `FKtl6e8ydm1k7k9r5ukv9j0bd0n` (`related_db`),\r
- CONSTRAINT `FKtl6e8ydm1k7k9r5ukv9j0bd0n` FOREIGN KEY (`related_db`) REFERENCES `db` (`id`)\r
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;\r
-\r
CREATE TABLE `design_type` (\r
`id` varchar(255) NOT NULL,\r
`name` varchar(255) DEFAULT NULL,\r
`note` varchar(255) DEFAULT NULL,\r
`db_type_id` varchar(255) NOT NULL,\r
- `portal` varchar(255) DEFAULT NULL,\r
PRIMARY KEY (`id`),\r
KEY `FKm8rkv2qkq01gsmeq1c3y4w02x` (`db_type_id`),\r
KEY `FKs2nspbhf5wv5d152l4j69yjhi` (`portal`),\r
- CONSTRAINT `FKm8rkv2qkq01gsmeq1c3y4w02x` FOREIGN KEY (`db_type_id`) REFERENCES `db_type` (`id`),\r
- CONSTRAINT `FKs2nspbhf5wv5d152l4j69yjhi` FOREIGN KEY (`portal`) REFERENCES `portal` (`name`)\r
+ CONSTRAINT `FKm8rkv2qkq01gsmeq1c3y4w02x` FOREIGN KEY (`db_type_id`) REFERENCES `db_type` (`id`)\r
) ENGINE=InnoDB DEFAULT CHARSET=utf8;\r
\r
CREATE TABLE `design` (\r
+++ /dev/null
-/*
- * ============LICENSE_START=======================================================
- * ONAP : DataLake
- * ================================================================================
- * Copyright 2019 China Mobile
- *=================================================================================
- * 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.datalake.feeder.controller;
-
-import io.swagger.annotations.ApiOperation;
-import org.onap.datalake.feeder.controller.domain.PostReturnBody;
-import org.onap.datalake.feeder.domain.Portal;
-import org.onap.datalake.feeder.dto.PortalConfig;
-import org.onap.datalake.feeder.repository.PortalRepository;
-import org.onap.datalake.feeder.service.PortalService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.MediaType;
-import org.springframework.validation.BindingResult;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * This controller manages Portal settings
- *
- *
- * @author guochunmeng
- */
-@RestController
-@RequestMapping(value = "/portals", produces = { MediaType.APPLICATION_JSON_VALUE })
-public class PortalController {
-
- private final Logger log = LoggerFactory.getLogger(this.getClass());
-
- @Autowired
- private PortalRepository portalRepository;
-
- @Autowired
- private PortalService portalService;
-
- @PutMapping("")
- @ResponseBody
- @ApiOperation("update portal")
- public PostReturnBody<PortalConfig> updatePortal(@RequestBody PortalConfig portalConfig, BindingResult result, HttpServletResponse response) throws IOException {
-
- if (result.hasErrors()) {
- sendError(response, 400, "Error binding PortalConfig: "+result.toString());
- return null;
- }
-
- Portal portal = null;
- try {
- portal = portalRepository.findById(portalConfig.getName()).get();
- log.info("Update portal "+portalConfig);
- portalService.fillPortalConfiguration(portalConfig, portal);
- portalRepository.save(portal);
- return mkPostReturnBody(200, portal);
- } catch (Exception e) {
- log.debug("Update or delete portal failed, Portal: "+portalConfig, e.getMessage());
- sendError(response, 400, "Error update or delete portal: "+portal);
- return null;
- }
- }
-
-
- @GetMapping("")
- @ResponseBody
- @ApiOperation(value = "List all portals")
- public List<PortalConfig> getPortals() {
-
- List<Portal> portalList = null;
- List<PortalConfig> portalConfigList = new ArrayList<>();
- portalList = (List<Portal>)portalRepository.findAll();
- if (portalList != null && portalList.size() > 0) {
- log.info("PortalList is not null");
- for(Portal portal : portalList) {
- portalConfigList.add(portal.getPortalConfig());
- }
- }
- return portalConfigList;
- }
-
-
- private void sendError(HttpServletResponse response, int sc, String msg) throws IOException {
- log.info(msg);
- response.sendError(sc, msg);
- }
-
-
- private PostReturnBody<PortalConfig> mkPostReturnBody(int statusCode, Portal portal) {
- PostReturnBody<PortalConfig> retBody = new PostReturnBody<>();
- retBody.setStatusCode(statusCode);
- retBody.setReturnBody(portal.getPortalConfig());
- return retBody;
- }
-
-}
\ No newline at end of file
import lombok.Getter;
import lombok.Setter;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Set;
import javax.persistence.*;
designConfig.setSubmitted(getSubmitted());
designConfig.setTopicName(getTopicName().getId());
designConfig.setDesignType(getDesignType().getId());
+ designConfig.setDesignTypeName(getDesignType().getName());
+
+ Set<Db> designDb = getDbs();
+ List<Integer> dbList = new ArrayList<>();
+ if (designDb != null) {
+ for (Db item : designDb) {
+ dbList.add(item.getId());
+ }
+ }
+ designConfig.setDbs(dbList);
return designConfig;
}
@Column(name = "`name`")
private String name;
- //To be removed
- @ManyToOne(fetch=FetchType.EAGER)
- @JoinColumn(name="portal")
- @JsonBackReference
- private Portal portal;
-
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="db_type_id", nullable = false)
@JsonBackReference
+++ /dev/null
-/*
- * ============LICENSE_START=======================================================
- * ONAP : DataLake
- * ================================================================================
- * Copyright 2019 China Mobile
- *=================================================================================
- * 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.datalake.feeder.domain;
-
-import com.fasterxml.jackson.annotation.JsonBackReference;
-import lombok.Getter;
-import lombok.Setter;
-import org.onap.datalake.feeder.dto.PortalConfig;
-
-import javax.persistence.*;
-
-/**
- * Domain class representing portal
- *
- * @author guochunmeng
- */
-
-@Getter
-@Setter
-@Entity
-@Table(name = "portal")
-public class Portal {
-
- @Id
- @Column(name = "`name`")
- private String name;
-
- @Column(name = "`enabled`")
- private Boolean enabled;
-
- @Column(name = "`host`")
- private String host;
-
- @Column(name = "`port`")
- private Integer port;
-
- @Column(name = "`login`")
- private String login;
-
- @Column(name = "`pass`")
- private String pass;
-
- @ManyToOne(fetch=FetchType.EAGER)
- @JoinColumn(name = "related_db")
- @JsonBackReference
- private Db db;
-
- public PortalConfig getPortalConfig() {
- PortalConfig portalConfig = new PortalConfig();
-
- portalConfig.setName(getName());
- portalConfig.setLogin(getLogin());
- portalConfig.setPass(getPass());
- portalConfig.setEnabled(getEnabled());
- portalConfig.setHost(getHost());
- portalConfig.setPort(getPort());
- portalConfig.setDb(getDb().getName());
-
- return portalConfig;
- }
-}
import lombok.Getter;
import lombok.Setter;
+import java.util.List;
+
/**
* JSON request body for portalDesign Config.
*
private String note;
private String topicName;
private String designType;
+ private String designTypeName;//UI show name
+ private List<Integer> dbs;
}
+++ /dev/null
-/*
- * ============LICENSE_START=======================================================
- * ONAP : DataLake
- * ================================================================================
- * Copyright 2019 QCT
- *=================================================================================
- * 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.datalake.feeder.dto;
-
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * JSON request body for Portal Config.
- *
- * @author guochunmeng
- *
- */
-@Setter
-@Getter
-public class PortalConfig {
-
- private String name;
-
- private Boolean enabled;
-
- private String host;
-
- private Integer port;
-
- private String login;
-
- private String pass;
-
- private String db;
-
-}
+++ /dev/null
-/*
- * ============LICENSE_START=======================================================
- * ONAP : DataLake
- * ================================================================================
- * Copyright 2019 China Mobile
- *=================================================================================
- * 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.datalake.feeder.repository;
-
-import org.onap.datalake.feeder.domain.Portal;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.CrudRepository;
-import org.springframework.data.repository.Repository;
-
-import java.util.List;
-
-/**
- * Portal Repository
- *
- * @author guochunmeng
- */
-
-public interface PortalRepository extends CrudRepository<Portal, String> {
-
- List<Portal> findByEnabled(Boolean enabled);
-
-}
*/\r
package org.onap.datalake.feeder.repository;\r
\r
-import java.util.List;\r
-\r
-import org.onap.datalake.feeder.domain.Portal;\r
import org.onap.datalake.feeder.domain.Topic;\r
\r
import org.springframework.data.repository.CrudRepository;\r
import java.util.List;\r
import java.util.Optional;\r
import java.util.Set;\r
+import java.util.HashSet;\r
\r
import org.onap.datalake.feeder.config.ApplicationConfiguration;\r
import org.onap.datalake.feeder.domain.*;\r
import org.onap.datalake.feeder.domain.Design;\r
import org.onap.datalake.feeder.dto.DesignConfig;\r
import org.onap.datalake.feeder.enumeration.DesignTypeEnum;\r
+import org.onap.datalake.feeder.repository.DbRepository;\r
import org.onap.datalake.feeder.repository.DesignTypeRepository;\r
import org.onap.datalake.feeder.repository.DesignRepository;\r
import org.onap.datalake.feeder.repository.TopicNameRepository;\r
@Autowired\r
private ApplicationConfiguration applicationConfiguration;\r
\r
+ @Autowired\r
+ private DbRepository dbRepository;\r
+\r
public Design fillDesignConfiguration(DesignConfig designConfig) {\r
Design design = new Design();\r
fillDesign(designConfig, design);\r
throw new IllegalArgumentException("topicName is null " + designConfig.getTopicName());\r
design.setTopicName(topicName.get());\r
\r
-\r
if (designConfig.getDesignType() == null)\r
throw new IllegalArgumentException("Can not find designType in design_type, designType id " + designConfig.getDesignType());\r
Optional<DesignType> designType = designTypeRepository.findById(designConfig.getDesignType());\r
throw new IllegalArgumentException("designType is null");\r
design.setDesignType(designType.get());\r
\r
+ Set<Db> dbs = new HashSet<>();\r
+ if (designConfig.getDbs() != null) {\r
+ for (Integer item : designConfig.getDbs()) {\r
+ Optional<Db> db = dbRepository.findById(item);\r
+ if (db.isPresent()) {\r
+ dbs.add(db.get());\r
+ }\r
+ }\r
+ if (dbs.size() > 0)\r
+ design.setDbs(dbs);\r
+ else {\r
+ design.getDbs().clear();\r
+ design.setDbs(dbs);\r
+ }\r
+ } else {\r
+ design.setDbs(dbs);\r
+ }\r
}\r
\r
public Design getDesign(Integer id) {\r
List<DesignConfig> designConfigList = new ArrayList<>();\r
designList = (List<Design>) designRepository.findAll();\r
if (designList != null && designList.size() > 0) {\r
- log.info("PortalDesignList is not null");\r
+ log.info("DesignList is not null");\r
for (Design design : designList) {\r
designConfigList.add(design.getDesignConfig());\r
}\r
private boolean deployKibanaImport(Design design) throws RuntimeException {\r
POST_FLAG = "KibanaDashboardImport";\r
String requestBody = design.getBody();\r
- Portal portal = design.getDesignType().getPortal();\r
- String portalHost = portal.getHost();\r
- Integer portalPort = portal.getPort();\r
String url = "";\r
-\r
- if (portalHost == null || portalPort == null) {\r
- String dbHost = portal.getDb().getHost();\r
- Integer dbPort = portal.getDb().getPort();\r
- url = kibanaImportUrl(dbHost, dbPort);\r
- } else {\r
- url = kibanaImportUrl(portalHost, portalPort);\r
- }\r
+ //TODO\r
return HttpClientUtil.sendPostHttpClient(url, requestBody, POST_FLAG);\r
\r
}\r
+++ /dev/null
-/*
- * ============LICENSE_START=======================================================
- * ONAP : DataLake
- * ================================================================================
- * Copyright 2019 China Mobile
- *=================================================================================
- * 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.datalake.feeder.service;
-
-
-import org.onap.datalake.feeder.domain.Portal;
-import org.onap.datalake.feeder.dto.PortalConfig;
-import org.onap.datalake.feeder.repository.PortalRepository;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Service for portals
- *
- * @author guochunmeng
- *
- */
-@Service
-public class PortalService {
-
- @Autowired
- private PortalRepository portalRepository;
-
- public Portal fillPortalConfiguration(PortalConfig portalConfig)
- {
- Portal portal = new Portal();
- fillPortal(portalConfig, portal);
- return portal;
- }
- public void fillPortalConfiguration(PortalConfig portalConfig, Portal portal)
- {
- fillPortal(portalConfig, portal);
- }
-
- private void fillPortal(PortalConfig portalConfig, Portal portal) {
-
- portal.setName(portalConfig.getName());
- portal.setLogin(portalConfig.getLogin());
- portal.setPass(portalConfig.getPass());
- portal.setEnabled(portalConfig.getEnabled());
- portal.setHost(portalConfig.getHost());
- portal.setPort(portalConfig.getPort());
-
- }
-
-
- public List<String> listNames(boolean enabled){
-
- List<String> names = new ArrayList<>();
- Iterable<Portal> ret = portalRepository.findByEnabled(enabled);
- for(Portal portal:ret) {
- names.add(portal.getName());
- }
-
- return names;
- }
-
-}
design.setNote("test");
DesignType designType = new DesignType();
designType.setName("Kibana Dashboard");
- Portal portal = new Portal();
- portal.setName("Kibana");
- portal.setHost("127.0.0.1");
- portal.setPort(5601);
- designType.setPortal(portal);
design.setDesignType(designType);
design.setTopicName(new TopicName("unauthenticated.SEC_FAULT_OUTPUT"));
return design;
import org.mockito.MockitoAnnotations;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.datalake.feeder.domain.DesignType;
-import org.onap.datalake.feeder.domain.Portal;
import org.onap.datalake.feeder.service.DesignTypeService;
import java.lang.reflect.Field;
public DesignType fillDomain(){
DesignType designType = new DesignType();
designType.setName("Kibana Dashboard");
- Portal portal = new Portal();
- portal.setName("Kibana");
- portal.setHost("127.0.0.1");
- portal.setPort(5601);
- designType.setPortal(portal);
return designType;
}
}
\ No newline at end of file
+++ /dev/null
-/*
- * ============LICENSE_START=======================================================
- * ONAP : DATALAKE
- * ================================================================================
- * Copyright 2019 China Mobile
- *=================================================================================
- * 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.datalake.feeder.controller;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.datalake.feeder.controller.domain.PostReturnBody;
-import org.onap.datalake.feeder.domain.Db;
-import org.onap.datalake.feeder.domain.Portal;
-import org.onap.datalake.feeder.dto.PortalConfig;
-import org.onap.datalake.feeder.repository.PortalRepository;
-import org.onap.datalake.feeder.service.PortalService;
-import org.springframework.validation.BindingResult;
-
-import javax.servlet.http.HttpServletResponse;
-
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.when;
-
-@RunWith(MockitoJUnitRunner.class)
-public class PortalControllerTest {
-
- @Mock
- private HttpServletResponse httpServletResponse;
-
- @Mock
- private BindingResult mockBindingResult;
-
- @Mock
- private PortalRepository portalRepository;
-
- @InjectMocks
- private PortalService portalService;
-
- @Before
- public void setupTest() {
- MockitoAnnotations.initMocks(this);
- when(mockBindingResult.hasErrors()).thenReturn(false);
- }
-
-
- @Test
- public void testUpdatePortal() throws NoSuchFieldException, IllegalAccessException, IOException {
-
- PortalController testPortalController = new PortalController();
- setAccessPrivateFields(testPortalController);
- Portal testPortal = fillDomain();
- when(portalRepository.findById("Kibana")).thenReturn(Optional.of(testPortal));
- PostReturnBody<PortalConfig> postPortal = testPortalController.updatePortal(testPortal.getPortalConfig(), mockBindingResult, httpServletResponse);
- assertEquals(postPortal.getStatusCode(), 200);
- //when(mockBindingResult.hasErrors()).thenReturn(true);
-
- }
-
-
- @Test
- public void testGetPortals() throws NoSuchFieldException, IllegalAccessException {
-
- PortalController testPortalController = new PortalController();
- setAccessPrivateFields(testPortalController);
- Portal testPortal = fillDomain();
- List<Portal> portalList = new ArrayList<>();
- portalList.add(testPortal);
- when(portalRepository.findAll()).thenReturn(portalList);
- assertEquals(1, testPortalController.getPortals().size());
-
- }
-
-
- public void setAccessPrivateFields(PortalController portalController) throws NoSuchFieldException, IllegalAccessException {
-
- Field testPortalService = portalController.getClass().getDeclaredField("portalService");
- testPortalService.setAccessible(true);
- testPortalService.set(portalController, portalService);
- Field testPortalRepository = portalController.getClass().getDeclaredField("portalRepository");
- testPortalRepository.setAccessible(true);
- testPortalRepository.set(portalController, portalRepository);
- }
-
-
- public Portal fillDomain(){
- Portal portal = new Portal();
- portal.setName("Kibana");
- portal.setEnabled(true);
- portal.setHost("127.0.0.1");
- portal.setPort(5601);
- portal.setLogin("admin");
- portal.setPass("password");
- portal.setDb(new Db());
- return portal;
- }
-}
\ No newline at end of file
DesignType designType = new DesignType();
designType.setName("Kibana Dashboard");
designType.setNote("test");
- Portal portal = new Portal();
- portal.setName("Kibana");
- designType.setPortal(portal);
assertEquals("Kibana Dashboard", designType.getName());
assertEquals("test", designType.getNote());
- assertNotEquals("Kibana", designType.getPortal());
designType.setDbType(null);
designType.getDbType();
-
designType.setDesigns(null);
designType.getDesigns();
-
designType.getDesignTypeConfig();
}
}
\ No newline at end of file
+++ /dev/null
-/*
- * ============LICENSE_START=======================================================
- * ONAP : DATALAKE
- * ================================================================================
- * Copyright 2019 China Mobile
- *=================================================================================
- * 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.datalake.feeder.domain;
-
-import org.junit.Test;
-import org.onap.datalake.feeder.util.TestUtil;
-
-import static org.junit.Assert.*;
-import static org.junit.Assert.assertTrue;
-
-public class PortalTest {
-
- @Test
- public void testIs() {
-
- Portal portal = new Portal();
- portal.setName("Kibana");
- portal.setEnabled(true);
- portal.setHost("localhost");
- portal.setPort(5601);
- portal.setLogin("admin");
- portal.setPass("password");
- portal.setDb(TestUtil.newDb("Elasticsearch"));
- assertTrue("Kibana".equals(portal.getName()));
- assertFalse("true".equals(portal.getEnabled()));
- assertTrue("localhost".equals(portal.getHost()));
- assertFalse("5601".equals(portal.getPort()));
- assertTrue("admin".equals(portal.getLogin()));
- assertTrue("password".equals(portal.getPass()));
- assertFalse("Elasticsearch".equals(portal.getDb()));
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * ============LICENSE_START=======================================================
- * ONAP : DATALAKE
- * ================================================================================
- * Copyright 2019 China Mobile
- *=================================================================================
- * 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.datalake.feeder.dto;
-
-import org.junit.Test;
-import org.onap.datalake.feeder.domain.Db;
-import org.onap.datalake.feeder.domain.Portal;
-import org.onap.datalake.feeder.util.TestUtil;
-
-import static org.junit.Assert.*;
-
-public class PortalConfigTest {
-
- @Test
- public void testIs(){
-
- Portal testPortal = new Portal();
- testPortal.setName("Kibana");
- testPortal.setDb(TestUtil.newDb("Elasticsearch"));
- Portal testPortal2 = new Portal();
- testPortal2.setName("Kibana");
- testPortal2.setDb(TestUtil.newDb("Elasticsearch"));
- PortalConfig testPortalConfig = testPortal.getPortalConfig();
- assertNotEquals(testPortalConfig, testPortal2.getPortalConfig());
- assertNotEquals(testPortalConfig, testPortal);
- assertNotEquals(testPortalConfig, null);
- assertEquals(testPortalConfig.getHost(), null);
- assertEquals(testPortalConfig.getPort(), null);
- assertEquals(testPortalConfig.getEnabled(), null);
- assertEquals(testPortalConfig.getLogin(), null);
- assertEquals(testPortalConfig.getPass(), null);
- assertEquals(testPortalConfig.getDb(), "Elasticsearch");
- }
-}
\ No newline at end of file
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.datalake.feeder.config.ApplicationConfiguration;
-import org.onap.datalake.feeder.domain.Db;
import org.onap.datalake.feeder.domain.Design;
import org.onap.datalake.feeder.domain.DesignType;
-import org.onap.datalake.feeder.domain.Portal;
import static org.mockito.Mockito.when;
Design design = new Design();
design.setDesignType(designType);
design.setBody("jsonString");
-
- Portal portal = new Portal();
- Db db = new Db();
- db.setHost("localhost");
- portal.setDb(db);
- when(designType.getPortal()).thenReturn(portal);
- when(applicationConfiguration.getKibanaDashboardImportApi()).thenReturn("/api/kibana/dashboards/import?exclude=index-pattern");
- when(applicationConfiguration.getKibanaPort()).thenReturn(5601);
+ //when(applicationConfiguration.getKibanaDashboardImportApi()).thenReturn("/api/kibana/dashboards/import?exclude=index-pattern");
+ //when(applicationConfiguration.getKibanaPort()).thenReturn(5601);
designService.deploy(design);
System.out.println();
}