Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release-33.x' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
mershad-manesh committed Nov 5, 2024
2 parents b0bf275 + 106025f commit a45d808
Show file tree
Hide file tree
Showing 13 changed files with 6,861 additions and 7,340 deletions.
2 changes: 1 addition & 1 deletion .circleci/epoch
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# increment this to force a full build
4
5
13,999 changes: 6,683 additions & 7,316 deletions core/web-assets/package-lock.json

Large diffs are not rendered by default.

28 changes: 19 additions & 9 deletions core/web-assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@babel/preset-env": "^7.16.5",
"@babel/preset-typescript": "^7.16.5",
"@babel/runtime-corejs3": "^7.24.8",
"@babel/runtime-corejs3": "^7.24.8",
"@rangerrick/moment-javaformat": "^2.0.1",
"@types/jest": "^29.5.2",
"@types/lodash": "^4.14.141",
Expand All @@ -37,7 +38,7 @@
"babel-preset-es2015-nostrict": "^6.6.2",
"cache-loader": "^4.1.0",
"copy-webpack-plugin": "^6.4.1",
"core-js": "^3.37.1",
"core-js": "^3.38.0",
"css-loader": "^3.2.0",
"cssnano": "^4.1.10",
"eslint": "^8.28.0",
Expand All @@ -47,6 +48,7 @@
"file": "^0.2.2",
"file-loader": "^6.2.0",
"html-loader": "^1.3.2",
"html-loader": "^1.3.2",
"identity-obj-proxy": "^3.0.0",
"imports-loader": "^1.2.0",
"jasmine": "^5.0.0",
Expand Down Expand Up @@ -92,7 +94,7 @@
"angular-ui-sortable": "^0.19.0",
"backshift": "github:OpenNMS/backshift#v1.3.3",
"bootbox": "^6.0.0",
"bootstrap": "~4.6.1",
"bootstrap": "~4.6.2",
"c3": "^0.4.24",
"cron-parser": "^4.2.1",
"cross-env": "^7.0.3",
Expand All @@ -112,11 +114,12 @@
"jquery-migrate": "^3.3.2",
"jquery-sparkline": "https://github.com/kapusta/jquery.sparkline#2.1.3",
"jquery-treegrid": "^0.3.0",
"jquery-ui": "^1.13.0",
"jquery-ui": "~1.13.3",
"jquery-ui-treemap": "https://github.com/RangerRick/jsTreemap#master",
"jquery.flot.tooltip": "^0.9.0",
"leaflet": "^1.9.3",
"leaflet.markercluster": "^1.5.3",
"loader-utils": "^2.0.4",
"moment": "^2.29.1",
"popper.js": "^1.16.1",
"regenerator-runtime": "^0.14.0",
Expand Down Expand Up @@ -179,19 +182,26 @@
"<rootDir>/src/test/java/",
"<rootDir>/src/test/resources/",
"<rootDir>/target/"
]
],
"globals": {
"ts-jest": {
"diagnostics": {
"warnOnly": true
}
}
}
},
"scripts": {
"webpack": "cross-env NODE_OPTIONS=--max-old-space-size=4096 webpack --colors --display-error-details --env=development",
"webpack-release": "cross-env NODE_OPTIONS=--max-old-space-size=4096 webpack --colors --display-error-details --env=production",
"webpack": "cross-env NODE_OPTIONS=\"--max-old-space-size=4096 --openssl-legacy-provider\" webpack --colors --display-error-details --env=development",
"webpack-release": "cross-env NODE_OPTIONS=\"--max-old-space-size=4096 --openssl-legacy-provider\" webpack --colors --display-error-details --env=production",
"check-git": "node check-git.js",
"install-deps": "npm --prefer-offline --no-progress --no-audit ci",
"build": "npm run check-git && npm run webpack",
"build-release": "npm run check-git && npm run webpack-release",
"build-verbose": "npm run check-git && npm run lint && cross-env NODE_OPTIONS=--max-old-space-size=4096 webpack --debug --colors --display-modules --display-chunks --display-error-details --display-origins --display-reasons --env=development",
"build-verbose": "npm run check-git && npm run lint && cross-env NODE_OPTIONS=\"--max-old-space-size=4096 --openssl-legacy-provider\" webpack --debug --colors --display-modules --display-chunks --display-error-details --display-origins --display-reasons --env=development",
"release": "npm run lint && npm run build-release",
"watch": "nodetouch package.json && cross-env NODE_OPTIONS=--max-old-space-size=4096 webpack --colors --display-error-details --watch --env=development",
"watch-release": "nodetouch package.json && cross-env NODE_OPTIONS=--max-old-space-size=4096 webpack --colors --display-error-details --watch --env=production",
"watch": "nodetouch package.json && cross-env NODE_OPTIONS=\"--max-old-space-size=4096 --openssl-legacy-provider\" webpack --colors --display-error-details --watch --env=development",
"watch-release": "nodetouch package.json && cross-env NODE_OPTIONS=\"--max-old-space-size=4096 --openssl-legacy-provider\" webpack --colors --display-error-details --watch --env=production",
"lint": "eslint \"src/**/*.[jt]s\"",
"maven-test": "jest --all --verbose --useStderr=false --color=false",
"test": "jest"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ org.opennms.newts.config.keyspace=newts
org.opennms.newts.config.port=9043
org.opennms.newts.config.max_batch_size=16
org.opennms.newts.config.max_batch_delay=0
org.opennms.newts.config.ttl=315360000
# another ten years before tests will fail, see NMS-16936
org.opennms.newts.config.ttl=630720000
20 changes: 20 additions & 0 deletions features/search/providers/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,31 @@
<artifactId>opennms-dao-mock</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.opennms</groupId>
<artifactId>opennms-rrd-jrobin</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.opennms</groupId>
<artifactId>opennms-rrdtool-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.opennms.features.collection</groupId>
<artifactId>org.opennms.features.collection.persistence.rrd</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.opennms.core.ipc.rpc</groupId>
<artifactId>org.opennms.core.ipc.rpc.mock-impl</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.opennms.core.test-api</groupId>
<artifactId>org.opennms.core.test-api.db</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public SearchResult query(SearchQuery query) {
Restrictions.ilike("assetRecord.leaseExpires", QueryUtils.ilike(input)),
Restrictions.ilike("assetRecord.supportPhone", QueryUtils.ilike(input)),
Restrictions.ilike("assetRecord.maintContractExpiration", QueryUtils.ilike(input)),
Restrictions.ilike("assetRecord.maintContract", QueryUtils.ilike(input)),
Restrictions.ilike("assetRecord.maintcontract", QueryUtils.ilike(input)),
Restrictions.ilike("assetRecord.displayCategory", QueryUtils.ilike(input)),
Restrictions.ilike("assetRecord.pollerCategory", QueryUtils.ilike(input)),
Restrictions.ilike("assetRecord.thresholdCategory", QueryUtils.ilike(input)),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/*******************************************************************************
* This file is part of OpenNMS(R).
*
* Copyright (C) 2019-2019 The OpenNMS Group, Inc.
* OpenNMS(R) is Copyright (C) 1999-2019 The OpenNMS Group, Inc.
*
* OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc.
*
* OpenNMS(R) is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* OpenNMS(R) is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with OpenNMS(R). If not, see:
* http://www.gnu.org/licenses/
*
* For more information contact:
* OpenNMS(R) Licensing <[email protected]>
* http://www.opennms.org/
* http://www.opennms.com/
*******************************************************************************/

package org.opennms.netmgt.search.providers.node;


import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.opennms.core.mate.api.EntityScopeProvider;
import org.opennms.core.test.OpenNMSJUnit4ClassRunner;
import org.opennms.core.test.db.annotations.JUnitTemporaryDatabase;
import org.opennms.netmgt.dao.api.NodeDao;
import org.opennms.netmgt.model.NetworkBuilder;
import org.opennms.netmgt.model.OnmsAssetRecord;
import org.opennms.netmgt.model.OnmsMetaData;
import org.opennms.netmgt.model.OnmsNode;
import org.opennms.netmgt.search.api.SearchQuery;
import org.opennms.netmgt.search.api.SearchResult;
import org.opennms.test.JUnitConfigurationEnvironment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertEquals;

@RunWith(OpenNMSJUnit4ClassRunner.class)
@ContextConfiguration(locations={
"classpath:/META-INF/opennms/applicationContext-soa.xml",
"classpath:/META-INF/opennms/applicationContext-dao.xml",
"classpath:/META-INF/opennms/applicationContext-mockConfigManager.xml",
"classpath:/META-INF/opennms/applicationContext-commonConfigs.xml",
"classpath:/META-INF/opennms/applicationContext-rpc-client-mock.xml"
})
@JUnitConfigurationEnvironment
@JUnitTemporaryDatabase(reuseDatabase = false)
public class NodeAssetSearchProviderTest {

@Autowired
private NodeDao nodeDao;

@Autowired
private EntityScopeProvider entityScopeProvider;

private NodeAssetSearchProvider nodeAssetSearchProvider;


@Before
public void setUp() {
nodeAssetSearchProvider = new NodeAssetSearchProvider(nodeDao, entityScopeProvider);
nodeDao.save(buildTestNode());
}

@Test
public void testShouldReturnEmptyAssetWhenQuerying() {
final SearchQuery searchQuery = new SearchQuery("Not available");
final SearchResult results = nodeAssetSearchProvider.query(searchQuery);
assertTrue(results.isEmpty());
}

@Test
public void testShouldReturnAssetWhenQuerying() {
final SearchQuery searchQuery = new SearchQuery("Greek-120");
final SearchResult results = nodeAssetSearchProvider.query(searchQuery);
assertFalse(results.isEmpty());
assertEquals(1, results.getResults().size());
}

@Test
public void testShouldReturnAssetWhenQueryingWithHalfString() {
final SearchQuery searchQuery = new SearchQuery("eek");
final SearchResult results = nodeAssetSearchProvider.query(searchQuery);
assertFalse( results.isEmpty());
assertEquals(1, results.getResults().size());
}

private OnmsNode buildTestNode() {
NetworkBuilder builder = new NetworkBuilder();
builder.addNode("nodeA")
.setForeignSource("nodeIdTest:")
.setForeignId("A")
.setType(OnmsNode.NodeType.ACTIVE);
builder.addInterface("192.168.99.99")
.setIsManaged("M")
.setIsSnmpPrimary("P");

OnmsNode node = builder.getCurrentNode();
node.getMetaData().add(new OnmsMetaData("testContext", "testKey", "99099"));

OnmsAssetRecord asset = new OnmsAssetRecord();
asset.setSerialNumber("1001");
asset.setMaintcontract("Greek-120");
node.setAssetRecord(asset);

return node;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@
<!-- Jackson JAXB JSON provider -->
<bean id="jacksonJaxbJsonProvider" class="org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider"/>

<!-- Atom Serialization @Provider classes -->
<bean id="atomEntryProvider" class="org.apache.cxf.jaxrs.provider.atom.AtomEntryProvider"/>
<bean id="atomFeedProvider" class="org.apache.cxf.jaxrs.provider.atom.AtomFeedProvider"/>
<!-- <bean id="atomPojoProvider" class="org.apache.cxf.jaxrs.provider.atom.AtomPojoProvider"/> -->

<!-- FIQL search @Provider class -->
<bean id="searchContextProvider" class="org.apache.cxf.jaxrs.ext.search.SearchContextProvider"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@
<ref bean="lenientJaxbProvider"/>
<ref bean="jaxbProvider"/>
<ref bean="jacksonJaxbJsonProvider"/>
<ref bean="atomEntryProvider"/>
<ref bean="atomFeedProvider"/>
<!-- <ref bean="atomPojoProvider"/> -->
<ref bean="errorResponseProvider" />
<ref bean="noSuchElementProvider" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@
<ref bean="lenientJaxbProvider"/>
<ref bean="jaxbProvider"/>
<ref bean="jacksonJaxbJsonProvider"/>
<ref bean="atomEntryProvider"/>
<ref bean="atomFeedProvider"/>
<!-- <ref bean="atomPojoProvider"/> -->
<ref bean="searchContextProvider"/>
<ref bean="noSuchElementProvider" />
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1781,7 +1781,7 @@
<cronParserCoreVersion>3.5</cronParserCoreVersion>
<c3p0Version>0.9.5.5</c3p0Version>
<curatorVersion>5.6.0</curatorVersion>
<cxfVersion>3.5.9</cxfVersion>
<cxfVersion>3.6.2</cxfVersion>
<cxfXjcVersion>3.3.2</cxfXjcVersion>
<dhcp4javaVersion>1.1.0</dhcp4javaVersion>
<serviceMixDnsjavaVersion>3.5.3_1</serviceMixDnsjavaVersion>
Expand Down
10 changes: 9 additions & 1 deletion smoke-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,10 @@
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
</exclusion>
<exclusion>
<groupId>org.opennms.dependencies</groupId>
<artifactId>cxf-dependencies</artifactId>
</exclusion>
</exclusions>
<scope>test</scope>
</dependency>
Expand Down Expand Up @@ -844,7 +848,7 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.13</version>
<version>1.4.8</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down Expand Up @@ -955,6 +959,10 @@
<groupId>jaxen</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.opennms.dependencies</groupId>
<artifactId>cxf-dependencies</artifactId>
</exclusion>
</exclusions>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import joptsimple.internal.Strings;
import org.glassfish.jersey.client.ClientProperties;
import org.opennms.core.xml.JaxbUtils;
import org.opennms.netmgt.measurements.model.QueryRequest;
Expand Down Expand Up @@ -419,7 +420,7 @@ public JsonNode getBackups() throws IOException {
.accept(MediaType.APPLICATION_JSON)
.get(String.class);

if (result == null) {
if (Strings.isNullOrEmpty(result)) {
return null;
}

Expand Down

0 comments on commit a45d808

Please sign in to comment.