summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sparkybe-onap-application/src/main/java/org/onap/aai/sparky/aai/FrontEndLayoutApi.java49
-rw-r--r--sparkybe-onap-service/src/test/java/org/onap/aai/sparky/aggregatevnf/search/VnfSearchQueryBuilderTest.java48
-rw-r--r--sparkybe-onap-service/src/test/java/org/onap/aai/sparky/search/filters/entity/FilterQueryBuilderTest.java75
-rw-r--r--sparkybe-onap-service/src/test/java/org/onap/aai/sparky/security/BaseCookieDecryptorTest.java45
4 files changed, 211 insertions, 6 deletions
diff --git a/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/aai/FrontEndLayoutApi.java b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/aai/FrontEndLayoutApi.java
new file mode 100644
index 0000000..0590cd6
--- /dev/null
+++ b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/aai/FrontEndLayoutApi.java
@@ -0,0 +1,49 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 Amdocs
+ * ================================================================================
+ * 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.aai.sparky.aai;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@RestController
+public class FrontEndLayoutApi {
+
+
+ public FrontEndLayoutApi() {
+
+ }
+
+ @RequestMapping(value = "/layouts", method = {RequestMethod.GET})
+ @ResponseBody
+ public String getLayouts() {
+
+ ObjectMapper objectMapper = new ObjectMapper();
+ JsonNode layouts = objectMapper.createObjectNode();
+
+ return layouts.toString();
+
+ }
+}
diff --git a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/aggregatevnf/search/VnfSearchQueryBuilderTest.java b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/aggregatevnf/search/VnfSearchQueryBuilderTest.java
index 9949702..e4006ba 100644
--- a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/aggregatevnf/search/VnfSearchQueryBuilderTest.java
+++ b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/aggregatevnf/search/VnfSearchQueryBuilderTest.java
@@ -1,30 +1,66 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 Amdocs
+ * ================================================================================
+ * 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.aai.sparky.aggregatevnf.search;
import static org.junit.Assert.assertNotNull;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.json.Json;
+import javax.json.JsonObjectBuilder;
+
import org.junit.Before;
import org.junit.Test;
public class VnfSearchQueryBuilderTest {
private VnfSearchQueryBuilder vnfSearchQueryBuilder;
+ private Map<String, String> attritbutes;
+ private JsonObjectBuilder jsonBuilder;
@Before
- public void init() throws Exception {
+ public void init() throws Exception {
vnfSearchQueryBuilder = new VnfSearchQueryBuilder();
+ attritbutes = new HashMap<String, String>();
+ jsonBuilder = Json.createObjectBuilder();
- }
+ }
@SuppressWarnings("static-access")
@Test
public void updateValues() {
-
- assertNotNull(vnfSearchQueryBuilder.createSuggestionsQuery("10","queryString"));
- assertNotNull(vnfSearchQueryBuilder.getTermBlob("suggest-vnf","firewall"));
- assertNotNull(vnfSearchQueryBuilder.getSortCriteria("term","ascending"));
+ assertNotNull(vnfSearchQueryBuilder.createSuggestionsQuery("10", "queryString"));
+ assertNotNull(vnfSearchQueryBuilder.getTermBlob("suggest-vnf", "firewall"));
+ assertNotNull(vnfSearchQueryBuilder.getSortCriteria("term", "ascending"));
+ assertNotNull(vnfSearchQueryBuilder.createEntityCountsQuery(attritbutes));
+ assertNotNull(vnfSearchQueryBuilder.createSummaryByEntityTypeQuery(attritbutes, ""));
+ vnfSearchQueryBuilder.buildMultiTermCountQuery(jsonBuilder, attritbutes);
+ vnfSearchQueryBuilder.buildZeroTermSummaryQuery(jsonBuilder, "");
+ vnfSearchQueryBuilder.buildMultiTermSummaryQuery(jsonBuilder, attritbutes, "");
+ vnfSearchQueryBuilder.buildSingleTermSummaryQuery(jsonBuilder, "", "", "");
+ vnfSearchQueryBuilder.buildSingleTermCountQuery(jsonBuilder, "", "");
}
}
diff --git a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/search/filters/entity/FilterQueryBuilderTest.java b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/search/filters/entity/FilterQueryBuilderTest.java
new file mode 100644
index 0000000..be4a215
--- /dev/null
+++ b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/search/filters/entity/FilterQueryBuilderTest.java
@@ -0,0 +1,75 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 Amdocs
+ * ================================================================================
+ * 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.aai.sparky.search.filters.entity;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.json.Json;
+import javax.json.JsonObjectBuilder;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.aai.sparky.search.filters.FilterQueryBuilder;
+import org.onap.aai.sparky.search.filters.config.FiltersConfig;
+
+public class FilterQueryBuilderTest {
+
+ private FilterQueryBuilder filterQueryBuilder;
+ private FiltersConfig filterConfig;
+ private List<SearchFilter> searchFilter;
+ private List<String> fields;
+ private JsonObjectBuilder jsonBuilder;
+
+ @Before
+ public void init() throws Exception {
+
+ filterQueryBuilder = new FilterQueryBuilder();
+ filterConfig = new FiltersConfig();
+ searchFilter = new ArrayList<SearchFilter>();
+ fields = new ArrayList<String>();
+ jsonBuilder = Json.createObjectBuilder();
+
+
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void updateValues() {
+
+
+ assertNull(
+ filterQueryBuilder.createFilteredBoolQueryObject(filterConfig, searchFilter, 4, fields));
+ assertNull(filterQueryBuilder.createAggregationQueryArray(filterConfig, searchFilter));
+ assertNotNull(filterQueryBuilder.createCombinedBoolAndAggQuery(filterConfig, searchFilter, 5));
+ assertNotNull(filterQueryBuilder.createFilterValueQueryObject(""));
+ assertNotNull(filterQueryBuilder.createNestedFilterValueQueryObject("", ""));
+ filterQueryBuilder.buildZeroTermSummaryQuery(jsonBuilder, "");
+ filterQueryBuilder.getSummaryAggsBlob(jsonBuilder, "", 5);
+ filterQueryBuilder.addNestedSummaryAggsBlob(jsonBuilder, "", "", 6);
+ filterQueryBuilder.generateNestedAggregations(jsonBuilder, "", "");
+
+ }
+
+}
diff --git a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/security/BaseCookieDecryptorTest.java b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/security/BaseCookieDecryptorTest.java
new file mode 100644
index 0000000..5ba06a4
--- /dev/null
+++ b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/security/BaseCookieDecryptorTest.java
@@ -0,0 +1,45 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 Amdocs
+ * ================================================================================
+ * 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.aai.sparky.security;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class BaseCookieDecryptorTest {
+
+ private BaseCookieDecryptor cookieDecryptor;
+
+ @Before
+ public void init() throws Exception {
+
+ cookieDecryptor = new BaseCookieDecryptor();
+
+ }
+
+
+ @Test
+ public void updateValues() {
+ cookieDecryptor.decryptCookie("changeit");
+
+
+ }
+
+}