* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
* ================================================================================
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* 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
import lombok.NonNull;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaControlLoop;
-import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstantiationResponse;
import org.onap.policy.models.base.PfAuthorative;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfKey;
Map<String, ToscaNodeTemplate> savedNodeTemplates = new HashMap<>();
serviceTemplate.getToscaTopologyTemplate().getNodeTemplates().forEach((key, template) -> {
- JpaToscaNodeTemplate jpaToscaNodeTemplate = new JpaToscaNodeTemplate(template);
+ var jpaToscaNodeTemplate = new JpaToscaNodeTemplate(template);
getPfDao().create(jpaToscaNodeTemplate);
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
* ================================================================================
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* 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
package org.onap.policy.clamp.controlloop.models.messages.rest.instantiation;
-import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.apache.http.HttpStatus;
import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ClampEndPoints;
import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters;
-import org.onap.policy.clamp.controlloop.participant.dcae.model.ExternalComponent;
import org.onap.policy.clamp.controlloop.participant.dcae.model.Loop;
import org.springframework.stereotype.Component;
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
* ================================================================================
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* 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
Map<String, Object> map = this.errorAttributes.getErrorAttributes(new ServletWebRequest(request),
ErrorAttributeOptions.defaults());
- StringBuilder sb = new StringBuilder();
+ var sb = new StringBuilder();
final Object error = map.get("error");
if (error != null) {
sb.append(error.toString()).append(" ");
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
* ================================================================================
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* 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
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
* ================================================================================
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* 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
return;
}
- boolean completed = true;
+ var completed = true;
for (ControlLoopElement element : controlLoop.getElements().values()) {
if (!element.getState().equals(element.getOrderedState().asState())) {
completed = false;
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
* ================================================================================
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* 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
}
controlLoopUpdateMsg.setParticipantUpdatesList(participantUpdates);
- LOGGER.debug("ControlLoopUpdate message sent", controlLoopUpdateMsg);
+ LOGGER.debug("ControlLoopUpdate message sent {}", controlLoopUpdateMsg);
super.send(controlLoopUpdateMsg);
}
if (participantUpdates.isEmpty()) {
participantUpdates.add(getControlLoopElementList(clElement));
} else {
- boolean participantExists = false;
+ var participantExists = false;
for (ParticipantUpdates participantUpdate : participantUpdates) {
if (participantUpdate.getParticipantId().equals(clElement.getParticipantId())) {
participantUpdate.getControlLoopElementList().add(clElement);
}
private ParticipantUpdates getControlLoopElementList(ControlLoopElement clElement) {
- ParticipantUpdates participantUpdate = new ParticipantUpdates();
+ var participantUpdate = new ParticipantUpdates();
List<ControlLoopElement> controlLoopElementList = new ArrayList<>();
participantUpdate.setParticipantId(clElement.getParticipantId());
controlLoopElementList.add(clElement);
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
* ================================================================================
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* 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
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplates;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
participantDefinitionUpdates.add(getParticipantDefinition(clDefinition, clParticipantId,
controlLoopElementDefinitionList));
} else {
- boolean participantExists = false;
+ var participantExists = false;
for (ParticipantDefinition participantDefinitionUpdate : participantDefinitionUpdates) {
if (participantDefinitionUpdate.getParticipantId().equals(clParticipantId)) {
participantDefinitionUpdate.getControlLoopElementDefinitionList().add(clDefinition);
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
* ================================================================================
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* 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
var element = new ControlLoopElement();
element.setParticipantId(new ToscaConceptIdentifier("name1", "1.001"));
controlLoop.setElements(Map.of(UUID.randomUUID(), element));
- when(mockClProvider.getControlLoop(eq(new ToscaConceptIdentifier("testName", "1.001"))))
+ when(mockClProvider.getControlLoop(new ToscaConceptIdentifier("testName", "1.001")))
.thenReturn(controlLoop);
ParticipantStatisticsList getResponse = provider.fetchParticipantStatsPerControlLoop("testName", "1.001");
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
* ================================================================================
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* 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
var supervisionScanner = spy(mock(SupervisionScanner.class));
try (var supervisionAspect = new SupervisionAspect(supervisionScanner)) {
supervisionAspect.schedule();
- verify(supervisionScanner, timeout(500)).run(eq(true));
+ verify(supervisionScanner, timeout(500)).run(true);
}
}
try (var supervisionAspect = new SupervisionAspect(supervisionScanner)) {
supervisionAspect.doCheck();
supervisionAspect.doCheck();
- verify(supervisionScanner, timeout(500).times(2)).run(eq(false));
+ verify(supervisionScanner, timeout(500).times(2)).run(false);
}
}
try (var supervisionAspect = new SupervisionAspect(supervisionScanner)) {
supervisionAspect.handleParticipantStatus(participantStatusMessage);
- verify(supervisionScanner, timeout(500)).handleParticipantStatus(eq(identifier));
+ verify(supervisionScanner, timeout(500)).handleParticipantStatus(identifier);
}
}
}
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
+ <includes>
+ <include>**/*Test.java</include>
+ </includes>
<forkCount>1C</forkCount>
<reuseForks>true</reuseForks>
<useSystemClassLoader>false</useSystemClassLoader>
</additionalClasspathElement>
</additionalClasspathElements>
<includes>
- <include>**/*ItCase.java</include>
+ <include>**/*ItTestCase.java</include>
</includes>
<forkCount>1C</forkCount>
<reuseForks>true</reuseForks>
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
package org.onap.policy.clamp.clds;
import java.io.IOException;
-import java.security.Principal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.User;
-import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
public class ClampServlet extends CamelHttpTransportServlet {
import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
-import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.ExchangeBuilder;
import org.onap.policy.clamp.clds.exception.cds.CdsParametersException;
import org.onap.policy.clamp.clds.model.cds.CdsBpWorkFlowListResponse;
package org.onap.policy.clamp.clds.config;
import java.io.IOException;
-import java.net.URL;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
-import java.io.InputStream;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.StandardCopyOption;
-
/*-
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
- * Modifications Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
* 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
package org.onap.policy.clamp.clds.sdc.controller.installer;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
-import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Enumeration;
import java.util.HashMap;
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* @return a boolean
*/
public boolean checkFields(JsonTemplate jsonTemplate) {
- boolean duplicateFields = false;
+ var duplicateFields = false;
if (jsonTemplate.getJsonTemplateFields().size() == this.getJsonTemplateFields().size()) {
- int countMatchingFields = 0;
+ var countMatchingFields = 0;
//loop each component of first
for (JsonTemplateField jsonTemplateFieldToCheck : jsonTemplate.getJsonTemplateFields()) {
for (JsonTemplateField jsonTemplateField : this.getJsonTemplateFields()) {
* @param targetServiceName The target service name
*/
public void invoke(String targetEntity, String targetServiceName) {
- final String invocationId = UUID.randomUUID().toString();
+ final var invocationId = UUID.randomUUID().toString();
invokeContext(targetEntity, targetServiceName, invocationId);
private <T extends URLConnection> T invokeGeneric(final T con, String targetEntity,
String targetServiceName) {
- final String invocationId = UUID.randomUUID().toString();
+ final var invocationId = UUID.randomUUID().toString();
// Set standard HTTP headers on (southbound request) builder.
con.setRequestProperty(OnapLogConstants.Headers.REQUEST_ID,
package org.onap.policy.clamp.loop;
import com.google.gson.JsonObject;
-import java.io.IOException;
import java.util.List;
import java.util.Set;
import javax.persistence.EntityNotFoundException;
import org.onap.policy.clamp.clds.tosca.update.ToscaConverterWithDictionarySupport;
import org.onap.policy.clamp.loop.template.LoopTemplatesService;
-import org.onap.policy.clamp.loop.template.PolicyModel;
import org.onap.policy.clamp.loop.template.PolicyModelsService;
import org.onap.policy.clamp.policy.microservice.MicroServicePolicy;
import org.onap.policy.clamp.policy.microservice.MicroServicePolicyService;
* @throws SdcArtifactInstallerException The SdcArtifactInstallerException
*/
public boolean isServiceAlreadyDeployed(CsarHandler csar) throws SdcArtifactInstallerException {
- boolean alreadyInstalled = true;
+ var alreadyInstalled = true;
var serviceDetails = JsonUtils.GSON.fromJson(
JsonUtils.GSON.toJson(csar.getSdcCsarHelper().getServiceMetadataAllProperties()), JsonObject.class);
alreadyInstalled = serviceRepository.existsById(serviceDetails.get("UUID").getAsString());
import javax.persistence.Transient;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
-import org.hibernate.annotations.TypeDefs;
import org.onap.policy.clamp.clds.util.JsonUtils;
import org.onap.policy.clamp.dao.model.jsontype.StringJsonUserType;
import org.slf4j.Logger;
@Override
public int hashCode() {
- final int prime = 31;
- int result = 1;
+ final var prime = 31;
+ var result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
import javax.persistence.Table;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
-import org.hibernate.annotations.TypeDefs;
import org.onap.policy.clamp.dao.model.jsontype.StringJsonUserType;
import org.onap.policy.clamp.loop.common.AuditEntity;
import org.onap.policy.clamp.util.SemanticVersioning;
import javax.persistence.Table;
import org.apache.commons.lang3.RandomStringUtils;
import org.hibernate.annotations.TypeDef;
-import org.hibernate.annotations.TypeDefs;
import org.onap.policy.clamp.clds.tosca.update.ToscaConverterWithDictionarySupport;
import org.onap.policy.clamp.dao.model.jsontype.StringJsonUserType;
import org.onap.policy.clamp.loop.Loop;
import javax.persistence.Transient;
import org.apache.commons.lang3.RandomStringUtils;
import org.hibernate.annotations.TypeDef;
-import org.hibernate.annotations.TypeDefs;
import org.onap.policy.clamp.clds.tosca.update.ToscaConverterWithDictionarySupport;
import org.onap.policy.clamp.dao.model.jsontype.StringJsonUserType;
import org.onap.policy.clamp.loop.Loop;
import org.onap.policy.clamp.loop.Loop;
import org.onap.policy.clamp.loop.template.PolicyModelsRepository;
import org.onap.policy.clamp.policy.PolicyService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
* reserved.
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
+ * Modifications Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
assertThat(usersArray).hasSize(1);
CldsUser user = usersArray[0];
assertThat(user.getUser()).isEqualTo(user1);
- assertThat(user.getPassword()).isEqualTo(null);
+ assertThat(user.getPassword()).isNull();
assertThat(user.getPermissionsString()).isEmpty();
}
assertEquals(10, sdcConfig.getPollingInterval());
assertEquals(30, sdcConfig.getPollingTimeout());
- assertThat(SdcSingleControllerConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST)
- .hasSameSizeAs(sdcConfig.getRelevantArtifactTypes());
+ assertThat(sdcConfig.getRelevantArtifactTypes())
+ .hasSameSizeAs(SdcSingleControllerConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST);
assertEquals("ThePassword", sdcConfig.getKeyStorePassword());
assertTrue(sdcConfig.activateServerTLSAuth());
assertThat(sdcConfig.getMsgBusAddress()).contains("localhost");
public final void testConsumerGroupWithNull() throws IOException {
SdcSingleControllerConfiguration sdcConfig = loadControllerConfiguration("clds/sdc-controller-config-NULL.json",
"sdc-controller1");
- assertTrue(sdcConfig.getConsumerGroup() == null);
+ assertNull(sdcConfig.getConsumerGroup());
}
}
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-public class AuthorizationControllerItCase {
+public class AuthorizationControllerItTestCase {
@Autowired
private AuthorizationController auth;
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
+ * Copyright (C) 2017-2018, 2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
+ * 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
+ *
+ * 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============================================
* ===================================================================
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
-public class CldsHealthcheckServiceItCase {
+public class CldsHealthcheckServiceItTestCase {
@Autowired
private CldsHealthcheckService cldsHealthcheckService;
@SpringBootTest(webEnvironment = WebEnvironment.DEFINED_PORT)
@TestPropertySource(locations = "classpath:https/https-test.properties")
@DirtiesContext
-public class HttpsItCase {
+public class HttpsItTestCase {
@Value("${server.port}")
private String httpsPort;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
@TestPropertySource(locations = "classpath:robotframework/robotframework-test.properties")
@DirtiesContext
-public class RobotItCase {
+public class RobotItTestCase {
@Value("${server.port}")
private String httpPort;
private static final int TIMEOUT_S = 150;
- protected static final Logger logger = LoggerFactory.getLogger(RobotItCase.class);
+ protected static final Logger logger = LoggerFactory.getLogger(RobotItTestCase.class);
@Test
public void robotTests() throws Exception {
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
+ * Copyright (C) 2017-2018, 2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@RunWith(SpringRunner.class)
@SpringBootTest
-public class CldsReferencePropertiesItCase {
+public class CldsReferencePropertiesItTestCase {
@Autowired
private ClampProperties refProp;
package org.onap.policy.clamp.clds.it.config;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import com.google.gson.JsonSyntaxException;
@RunWith(SpringRunner.class)
@SpringBootTest
@ActiveProfiles({"clamp-default", "clamp-default-user", "clamp-sdc-controller"})
-public class SdcControllersConfigurationItCase {
+public class SdcControllersConfigurationItTestCase {
@Autowired
private SdcControllersConfiguration sdcControllersConfiguration;
loadFile("classpath:clds/sdc-controllers-config.json");
Map<String, SdcSingleControllerConfiguration> mapResult = sdcControllersConfiguration
.getAllDefinedControllers();
- assertTrue(mapResult.size() == 2);
+ assertThat(mapResult).hasSize(2);
assertEquals("sdc-controller1", mapResult.get("sdc-controller1").getSdcControllerName());
assertEquals("sdc-controller2", mapResult.get("sdc-controller2").getSdcControllerName());
}
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights
+ * Copyright (C) 2018, 2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
@RunWith(SpringRunner.class)
@SpringBootTest
@ActiveProfiles({"clamp-default", "clamp-default-user", "clamp-sdc-controller"})
-public class SdcSingleControllerItCase {
+public class SdcSingleControllerItTestCase {
private static final String CSAR_ARTIFACT_NAME = "testArtifact.csar";
private static final String SERVICE_UUID = "serviceUUID";
// when
sdcSingleController.treatNotification(buildFakeSdcNotification());
// then
- Assertions.assertThat(sdcSingleController.getNbOfNotificationsOngoing()).isEqualTo(0);
+ Assertions.assertThat(sdcSingleController.getNbOfNotificationsOngoing()).isZero();
}
@Test
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
-public class DcaeInventoryResponseCacheTestItCase {
+public class DcaeInventoryResponseCacheItTestCase {
public static DcaeInventoryCache inventoryCache = new DcaeInventoryCache();
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
int value = 0;
for (DcaeInventoryResponse inventoryResponse : responseSet) {
- assertThat(Integer.valueOf(inventoryResponse.getAsdcResourceId()) == value++).isTrue();
+ assertThat(Integer.valueOf(inventoryResponse.getAsdcResourceId())).isSameAs(value++);
}
}
}
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = Application.class)
-public class DictionaryRepositoriesTestItCase {
+public class DictionaryRepositoriesTestItTestCase {
@Autowired
private DictionaryRepository dictionaryRepository;
dictionaryRepository.save(dictionaryTest1);
List<String> res1 = dictionaryRepository.getAllDictionaryNames();
- assertThat(res1.size()).isGreaterThanOrEqualTo(1);
+ assertThat(res1.size()).isPositive();
assertThat(res1).contains("testDictionary1");
dictionaryRepository.save(dictionaryTest2);
List<String> res2 = dictionaryRepository.getAllDictionaryNames();
assertThat(res2.size()).isGreaterThanOrEqualTo(2);
- assertThat(res2).contains("testDictionary1");
- assertThat(res2).contains("testDictionary2");
+ assertThat(res2).contains("testDictionary1")
+ .contains("testDictionary2");
}
}
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* Test equals method.
*/
public void testEqualsMethod() {
- assertTrue(field1.equals(field2));
- assertTrue(field1.equals(field3));
- assertTrue(field1.equals(field4));
- assertTrue(field1.equals(field5));
- assertTrue(field1.equals(field6));
+ assertEquals(field1, field2);
+ assertEquals(field1, field3);
+ assertEquals(field1, field4);
+ assertEquals(field1, field5);
+ assertEquals(field1, field6);
}
/**
assertFalse(field1.compareWithField(field3));
assertFalse(field1.compareWithField(field4));
assertFalse(field1.compareWithField(field5));
- assertTrue(field1.equals(field6));
+ assertEquals(field1, field6);
}
-}
\ No newline at end of file
+}
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
toTest.setVisibility("moreField", true);
toTest.setStatic("moreField", true);
toTest.updateValueField("moreField", "testValue");
-
+
assertTrue(toTest.isVisible("moreField"));
- assertTrue(toTest.getSpecificField("moreField").getValue().equals("testValue"));
+ assertEquals("testValue", toTest.getSpecificField("moreField").getValue());
assertTrue(toTest.fieldStaticStatus("moreField"));
- assertTrue(toTest.toString()
- .equals(" templateFields : [type null null null, description null null null, "
- + "enum null null null, moreField testValue true true]"));
+ assertEquals(" templateFields : [type null null null, description null null null, "
+ + "enum null null null, moreField testValue true true]", toTest.toString());
}
-}
\ No newline at end of file
+}
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = Application.class)
@ActiveProfiles({"clamp-default", "clamp-default-user", "default-dictionary-elements"})
-public class ToscaConverterWithDictionarySupportItCase {
+public class ToscaConverterWithDictionarySupportItTestCase {
@Autowired
private DictionaryService dictionaryService;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
@ActiveProfiles({"clamp-default", "clamp-default-user", "clamp-sdc-controller"})
-public class CsarInstallerItCase {
+public class CsarInstallerItTestCase {
private static final String CSAR_ARTIFACT_NAME_CDS = "example/sdc/service_Vloadbalancerms_cds.csar";
private static final String CSAR_ARTIFACT_NAME_NO_CDS = "example/sdc/service_Vloadbalancerms_no_cds.csar";
assertThat(((LoopTemplateLoopElementModel) (loopTemplate.getLoopElementModelsUsed().toArray()[0]))
.getLoopElementModel().getName()).isNotEmpty();
- assertThat(policyModelsRepository.findAll().size()).isGreaterThanOrEqualTo(1);
+ assertThat(policyModelsRepository.findAll().size()).isPositive();
assertThat(policyModelsRepository
.existsById(new PolicyModelId("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0"))).isTrue();
assertThat(policyModelsRepository
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
-public class DeployFlowTestItCase {
+public class DeployFlowItTestCase {
private Gson gson = new Gson();
@Autowired
camelContext.createProducerTemplate().send("direct:undeploy-loop", myCamelExchange);
Loop loopAfterTest = loopService.getLoop("ControlLoopTest");
- assertThat(loopAfterTest.getDcaeDeploymentStatusUrl().contains("/uninstall")).isTrue();
+ assertThat(loopAfterTest.getDcaeDeploymentStatusUrl()).contains("/uninstall");
assertThat(loopAfterTest.getDcaeDeploymentId()).isNull();
}
Loop loopAfterTest = loopService.getLoop("ControlLoopTest2");
Set<MicroServicePolicy> policyList = loopAfterTest.getMicroServicePolicies();
for (MicroServicePolicy policy : policyList) {
- assertThat(policy.getDcaeDeploymentStatusUrl().contains("/uninstall")).isTrue();
+ assertThat(policy.getDcaeDeploymentStatusUrl()).contains("/uninstall");
assertThat(policy.getDcaeDeploymentId()).isNull();
-
}
assertThat(loopAfterTest.getDcaeDeploymentStatusUrl()).isNull();
assertThat(loopAfterTest.getDcaeDeploymentId()).isNull();
"{\"param1\":\"value1\"}", true);
loopTest.addMicroServicePolicy(microServicePolicy);
loopService.saveOrUpdateLoop(loopTest);
- assertThat(loopTest.getComponents().size()).isEqualTo(2);
+ assertThat(loopTest.getComponents()).hasSize(2);
assertThat(loopTest.getComponent("DCAE")).isNotNull();
assertThat(loopTest.getComponent("POLICY")).isNotNull();
Exchange myCamelExchange = ExchangeBuilder.anExchange(camelContext).withProperty("loopObject", loopTest)
assertThat(loopTest.getComponent("DCAE").getState().getStateName()).isEqualTo("BLUEPRINT_DEPLOYED");
Loop loopAfterTest = loopService.getLoop("ControlLoopTest");
- assertThat(loopAfterTest.getComponents().size()).isEqualTo(2);
+ assertThat(loopAfterTest.getComponents()).hasSize(2);
assertThat(loopAfterTest.getComponent("DCAE")).isNotNull();
assertThat(loopAfterTest.getComponent("POLICY")).isNotNull();
}
loopTest.addMicroServicePolicy(microServicePolicy);
loopTest.addMicroServicePolicy(microServicePolicy2);
loopService.saveOrUpdateLoop(loopTest);
- assertThat(loopTest.getComponents().size()).isEqualTo(3);
+ assertThat(loopTest.getComponents()).hasSize(3);
assertThat(loopTest.getComponent("DCAE")).isNull();
assertThat(loopTest.getComponent("DCAE_configPolicyTest")).isNotNull();
assertThat(loopTest.getComponent("DCAE_configPolicyTest2")).isNotNull();
.isEqualTo("BLUEPRINT_DEPLOYED");
Loop loopAfterTest = loopService.getLoop("ControlLoopTest");
- assertThat(loopAfterTest.getComponents().size()).isEqualTo(3);
+ assertThat(loopAfterTest.getComponents()).hasSize(3);
assertThat(loopAfterTest.getComponent("DCAE")).isNull();
assertThat(loopAfterTest.getComponent("POLICY")).isNotNull();
assertThat(loopTest.getComponent("DCAE_configPolicyTest")).isNotNull();
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@Test
public void generalTest() {
- assertThat(state.toString()).isEqualTo("NOT_SENT");
+ assertThat(state).hasToString("NOT_SENT");
state.setLevel(70);
assertThat(state.getLevel()).isEqualTo(70);
}
@Test
public void equalsTest() {
- assertThat(state.equals(null)).isEqualTo(false);
+ assertThat(state.equals(null)).isFalse();
ExternalComponentState state2 = new ExternalComponentState("NOT_SENT",
"The policies defined have NOT yet been created on the policy engine", 90);
- assertThat(state.equals(state2)).isEqualTo(true);
+ assertThat(state.equals(state2)).isTrue();
- assertThat(state.equals(12)).isEqualTo(false);
+ assertThat(state.equals(12)).isFalse();
state2.setLevel(70);
- assertThat(state.equals(state2)).isEqualTo(true);
+ assertThat(state.equals(state2)).isTrue();
ExternalComponentState state3 = new ExternalComponentState("SENT",
"The policies defined have NOT yet been created on the policy engine", 90);
- assertThat(state.equals(state3)).isEqualTo(false);
+ assertThat(state.equals(state3)).isFalse();
ExternalComponentState state4 = new ExternalComponentState(null,
"The policies defined have NOT yet been created on the policy engine", 90);
ExternalComponentState state5 = new ExternalComponentState(null,
"The policies defined have NOT yet been", 50);
- assertThat(state4.equals(state3)).isEqualTo(false);
- assertThat(state4.equals(state5)).isEqualTo(true);
+ assertThat(state4.equals(state3)).isFalse();
+ assertThat(state4.equals(state5)).isTrue();
}
@Test
assertThat(state.compareTo(state4)).isEqualTo(-1);
}
-}
\ No newline at end of file
+}
* ================================================================================
* Copyright (C) 2019 Nokia Intellectual Property. All rights
* reserved.
+ * ================================================================================
* Modifications Copyright (C) 2019 Huawei Technologies Co., Ltd.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
-public class LoopControllerTestItCase {
+public class LoopControllerItTestCase {
private static final String EXAMPLE_LOOP_NAME = "ClosedLoopTest";
private static final String EXAMPLE_JSON = "{\"testName\":\"testValue\"}";
Set<OperationalPolicy> opPolicyList = newLoop.getOperationalPolicies();
assertThat(opPolicyList.size()).isEqualTo(1);
for (OperationalPolicy policy : opPolicyList) {
- assertThat(policy.getName().contains("OPERATIONAL_serviceName")).isTrue();
+ assertThat(policy.getName()).contains("OPERATIONAL_serviceName");
Assertions.assertThat(policy.getPolicyModel().getPolicyModelType()).isEqualTo("testPolicyModel");
Assertions.assertThat(policy.getPolicyModel().getVersion()).isEqualTo("1.0.0");
}
* ================================================================================
* Copyright (C) 2019 Huawei Technologies Co., Ltd.
* ================================================================================
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* 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
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
-public class LoopLogServiceTestItCase {
+public class LoopLogServiceItTestCase {
private static final String EXAMPLE_LOOP_NAME = "ClosedLoopTest";
private static final String EXAMPLE_JSON = "{\"testName\":\"testValue\"}";
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = Application.class)
-public class LoopRepositoriesItCase {
+public class LoopRepositoriesItTestCase {
private Gson gson = new GsonBuilder().setPrettyPrinting().excludeFieldsWithoutExposeAnnotation().create();
assertThat(loopInDb).isEqualToIgnoringGivenFields(loopTest, "components", "createdDate", "updatedDate",
"createdBy", "updatedBy");
- assertThat(loopRepository.existsById(loopTest.getName())).isEqualTo(true);
- assertThat(operationalPolicyService.isExisting(opPolicy.getName())).isEqualTo(true);
- assertThat(microServicePolicyService.isExisting(microServicePolicy.getName())).isEqualTo(true);
+ assertThat(loopRepository.existsById(loopTest.getName())).isTrue();
+ assertThat(operationalPolicyService.isExisting(opPolicy.getName())).isTrue();
+ assertThat(microServicePolicyService.isExisting(microServicePolicy.getName())).isTrue();
assertThat(loopLogRepository.existsById(loopLog.getId())).isEqualTo(true);
- assertThat(loopTemplateRepository.existsById(loopInDb.getLoopTemplate().getName())).isEqualTo(true);
- assertThat(loopTemplateRepository.existsById(loopInDb.getLoopTemplate().getName())).isEqualTo(true);
- assertThat(servicesRepository.existsById(loopInDb.getModelService().getServiceUuid())).isEqualTo(true);
+ assertThat(loopTemplateRepository.existsById(loopInDb.getLoopTemplate().getName())).isTrue();
+ assertThat(loopTemplateRepository.existsById(loopInDb.getLoopTemplate().getName())).isTrue();
+ assertThat(servicesRepository.existsById(loopInDb.getModelService().getServiceUuid())).isTrue();
assertThat(microServiceModelsRepository.existsById(
loopInDb.getLoopTemplate().getLoopElementModelsUsed().first().getLoopElementModel().getName()))
- .isEqualTo(true);
+ .isTrue();
assertThat(policyModelsRepository.existsById(new PolicyModelId(
loopInDb.getLoopTemplate().getLoopElementModelsUsed().first().getLoopElementModel().getPolicyModels()
.first().getPolicyModelType(),
loopInDb.getLoopTemplate().getLoopElementModelsUsed().first().getLoopElementModel().getPolicyModels()
- .first().getVersion()))).isEqualTo(true);
+ .first().getVersion()))).isTrue();
// Now attempt to read from database
Loop loopInDbRetrieved = loopRepository.findById(loopTest.getName()).get();
// Attempt to delete the object and check it has well been cascaded
loopRepository.delete(loopInDbRetrieved);
- assertThat(loopRepository.existsById(loopTest.getName())).isEqualTo(false);
- assertThat(operationalPolicyService.isExisting(opPolicy.getName())).isEqualTo(false);
- assertThat(microServicePolicyService.isExisting(microServicePolicy.getName())).isEqualTo(true);
- assertThat(loopLogRepository.existsById(loopLog.getId())).isEqualTo(false);
- assertThat(loopTemplateRepository.existsById(loopInDb.getLoopTemplate().getName())).isEqualTo(true);
- assertThat(servicesRepository.existsById(loopInDb.getModelService().getServiceUuid())).isEqualTo(true);
+ assertThat(loopRepository.existsById(loopTest.getName())).isFalse();
+ assertThat(operationalPolicyService.isExisting(opPolicy.getName())).isFalse();
+ assertThat(microServicePolicyService.isExisting(microServicePolicy.getName())).isTrue();
+ assertThat(loopLogRepository.existsById(loopLog.getId())).isFalse();
+ assertThat(loopTemplateRepository.existsById(loopInDb.getLoopTemplate().getName())).isTrue();
+ assertThat(servicesRepository.existsById(loopInDb.getModelService().getServiceUuid())).isTrue();
assertThat(microServiceModelsRepository.existsById(
loopInDb.getLoopTemplate().getLoopElementModelsUsed().first().getLoopElementModel().getName()))
- .isEqualTo(true);
+ .isTrue();
assertThat(policyModelsRepository.existsById(new PolicyModelId(
loopInDb.getLoopTemplate().getLoopElementModelsUsed().first().getLoopElementModel().getPolicyModels()
.first().getPolicyModelType(),
loopInDb.getLoopTemplate().getLoopElementModelsUsed().first().getLoopElementModel().getPolicyModels()
- .first().getVersion()))).isEqualTo(true);
+ .first().getVersion()))).isTrue();
}
}
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
-public class LoopServiceTestItCase {
+public class LoopServiceItTestCase {
private static final String EXAMPLE_LOOP_NAME = "ClosedLoopTest";
private static final String EXAMPLE_JSON = "{\"testName\":\"testValue\"}";
loopService.updateAndSaveMicroservicePolicies(EXAMPLE_LOOP_NAME, Lists.newArrayList(microServicePolicy));
// Verify it's there
- assertThat(loopsRepository.findById(EXAMPLE_LOOP_NAME).orElse(null)).isNotNull();
+ assertThat(loopsRepository.findById(EXAMPLE_LOOP_NAME)).isPresent();
loopService.deleteLoop(EXAMPLE_LOOP_NAME);
// Verify it's well deleted and has been cascaded, except for Microservice
- assertThat(loopsRepository.findById(EXAMPLE_LOOP_NAME).orElse(null)).isNull();
+ assertThat(loopsRepository.findById(EXAMPLE_LOOP_NAME)).isNotPresent();
assertThat(microServicePolicyService.isExisting("microPolicy")).isTrue();
assertThat(operationalPolicyService.isExisting("opPolicy")).isFalse();
assertThat(loopLogService.isExisting(((LoopLog) loop.getLoopLogs().toArray()[0]).getId())).isFalse();
private Loop createTestLoop(String loopName, String loopBlueprint) {
return new Loop(loopName);
}
-}
\ No newline at end of file
+}
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
-public class LoopTemplatesServiceItCase {
+public class LoopTemplatesServiceItTestCase {
@Autowired
LoopTemplatesService loopTemplatesService;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
-public class PolicyModelServiceItCase {
+public class PolicyModelServiceItTestCase {
@Autowired
PolicyModelsService policyModelsService;
PolicyModel actualPolicyModel = policyModelsService.saveOrUpdatePolicyModel(policyModel);
// then
- assertThat(actualPolicyModel).isNotNull();
- assertThat(actualPolicyModel).isEqualTo(policyModelsRepository
+ assertThat(actualPolicyModel).isNotNull().isEqualTo(policyModelsRepository
.findById(new PolicyModelId(actualPolicyModel.getPolicyModelType(),
actualPolicyModel.getVersion()))
.get());
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
Service service2 = new Service(JsonUtils.GSON.fromJson(serviceStr2, JsonObject.class), null, "1.0");
- Service service3 = new Service(JsonUtils.GSON.fromJson(serviceStr3, JsonObject.class),
+ Service service3 = new Service(JsonUtils.GSON.fromJson(serviceStr3, JsonObject.class),
JsonUtils.GSON.fromJson(resourceStr, JsonObject.class), "1.0");
- assertThat(service1.equals(service2)).isEqualTo(true);
- assertThat(service1.equals(service3)).isEqualTo(false);
+ assertThat(service2).isEqualTo(service1);
+ assertThat(service3).isNotEqualTo(service1);
}
}
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* Modifications Copyright (C) 2021 Nordix Foundation.
* ================================================================================
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
@ActiveProfiles({"clamp-default", "clamp-policy-controller"})
-public class PolicyEngineControllerTestItCase {
+public class PolicyEngineControllerItTestCase {
@Autowired
PolicyEngineController policyController;
List<PolicyModel> policyModelsList = policyModelsRepository.findAll();
assertThat(policyModelsList.size()).isGreaterThanOrEqualTo(5);
assertThat(policyModelsList).contains(new PolicyModel("onap.policies.controlloop.operational.common.Drools",
- null, "1.0.0"));
- assertThat(policyModelsList).contains(new PolicyModel("onap.policies.controlloop.operational.common.Apex",
- null, "1.0.0"));
+ null, "1.0.0"))
+ .contains(new PolicyModel("onap.policies.controlloop.operational.common.Apex", null, "1.0.0"));
assertThat(policyModelsList)
.contains(new PolicyModel("onap.policies.controlloop.guard.common.FrequencyLimiter", null, "1.0.0"));
assertThat(policyModelsList)
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
* ================================================================================
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* 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
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
-public class RuntimeCommissioningResponseTestItCase {
+public class RuntimeCommissioningResponseItTestCase {
@Autowired
CamelContext camelContext;
.withProperty("raiseHttpExceptionFlag", "true")
.build());
- assertThat(exchangeResponse.getIn().getBody().toString()).isEqualTo(SAMPLE_TOSCA_TEMPLATE);
+ assertThat(exchangeResponse.getIn().getBody()).hasToString(SAMPLE_TOSCA_TEMPLATE);
}
@Test
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.clamp.tosca;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
-public class DictionaryServiceItCase {
+public class DictionaryServiceItTestCase {
@Autowired
private DictionaryService dictionaryService;
assertTrue(updatedDictionary2.getDictionaryElements().contains(dictionaryElement));
updatedDictionary2.getDictionaryElements().forEach(element -> {
if (element.equals(dictionaryElement)) {
- assertTrue(element.getDescription().equals(dictionaryElement.getDescription()));
+ assertEquals(dictionaryElement.getDescription(), element.getDescription());
}
});
dictionaryService.getDictionary("Test");
} catch (Exception e) {
assertThat(e).isInstanceOf(EntityNotFoundException.class);
- assertTrue(e.getMessage().equals("Couldn't find Dictionary named: Test"));
+ assertEquals("Couldn't find Dictionary named: Test", e.getMessage());
}
}
try {
dictionaryService.getDictionary("Dictionary1");
} catch (EntityNotFoundException e) {
- assertTrue(e.getMessage().equals("Couldn't find Dictionary named: Dictionary1"));
+ assertEquals("Couldn't find Dictionary named: Dictionary1", e.getMessage());
}
}
try {
dictionaryService.getDictionary("Dictionary1");
} catch (EntityNotFoundException e) {
- assertTrue(e.getMessage().equals("Couldn't find Dictionary named: Dictionary1"));
+ assertEquals("Couldn't find Dictionary named: Dictionary1", e.getMessage());
}
}
@Test
public final void testDecryption() throws Exception {
String decodedPass = PassDecoder.decode(encrypted, "classpath:clds/aaf/org.onap.clamp.keyfile");
- assertEquals(decodedPass, "China in the Spring");
+ assertEquals("China in the Spring", decodedPass);
assertEquals("Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U", PassDecoder
.decode("enc:JPV4p067JlSXt2Fet9bfuI8JpkS4ZGYVcgypcPs98gXjgjCjTze_d3JxqmlKaaakdiOjIcEC_MJh6-5pJTLgdc",
"classpath:clds/aaf/org.onap.clamp.keyfile"));
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
*/
@Test
public void compareEqualsTest() {
- assertThat(SemanticVersioning.compare("1.0.0", "1.0.0")).isEqualTo(0);
+ assertThat(SemanticVersioning.compare("1.0.0", "1.0.0")).isZero();
assertThat(SemanticVersioning.compare("1.0.0.0", "1.0.0")).isEqualTo(1);
- assertThat(SemanticVersioning.compare("1.2.3", "1.2.3")).isEqualTo(0);
+ assertThat(SemanticVersioning.compare("1.2.3", "1.2.3")).isZero();
assertThat(SemanticVersioning.compare("1.2.3", "1.2.3.0")).isEqualTo(-1);
}
*/
@Test
public void compareNullTest() {
- assertThat(SemanticVersioning.compare(null, null)).isEqualTo(0);
+ assertThat(SemanticVersioning.compare(null, null)).isZero();
assertThat(SemanticVersioning.compare(null, "1.0")).isEqualTo(-1);
assertThat(SemanticVersioning.compare("1.0", null)).isEqualTo(1);
}