diff options
Diffstat (limited to 'sdc-distribution-client/src/test/java/org/onap/sdc/impl')
6 files changed, 0 insertions, 465 deletions
diff --git a/sdc-distribution-client/src/test/java/org/onap/sdc/impl/DistributionClientFactory.java b/sdc-distribution-client/src/test/java/org/onap/sdc/impl/DistributionClientFactory.java deleted file mode 100644 index 6262f06..0000000 --- a/sdc-distribution-client/src/test/java/org/onap/sdc/impl/DistributionClientFactory.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdc-distribution-client - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Modifications copyright (C) 2019 Nokia. 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 - * - * 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.sdc.impl; - -import org.onap.sdc.api.IDistributionClient; - -public class DistributionClientFactory { - - private DistributionClientFactory() { - } - - public static IDistributionClient createDistributionClient() { - return new DistributionClientImpl(); - } - -} diff --git a/sdc-distribution-client/src/test/java/org/onap/sdc/impl/DistributionStatusMessageImplTest.java b/sdc-distribution-client/src/test/java/org/onap/sdc/impl/DistributionStatusMessageImplTest.java deleted file mode 100644 index bf78a2a..0000000 --- a/sdc-distribution-client/src/test/java/org/onap/sdc/impl/DistributionStatusMessageImplTest.java +++ /dev/null @@ -1,138 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2019 Nokia. 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 - * - * 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.sdc.impl; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.onap.sdc.api.consumer.IComponentDoneStatusMessage; -import org.onap.sdc.api.consumer.IDistributionStatusMessage; -import org.onap.sdc.api.consumer.IFinalDistrStatusMessage; -import org.onap.sdc.utils.DistributionStatusEnum; - -public class DistributionStatusMessageImplTest { - - private static final String ARTIFACT = "ARTIFACT"; - private static final String DISTRIBUTION_ID = "DISTRIBUTION_ID"; - private static final String CONSUMER_ID = "CONSUMER_ID"; - private static final String COMPONENT_NAME = "COMPONENT_NAME"; - - @Test - public void shouldProperlySetPropertiesFromIDistributionStatusMessage() { - IDistributionStatusMessage copyFrom = new IDistributionStatusMessage() { - @Override - public String getArtifactURL() { - return ARTIFACT; - } - - @Override - public String getDistributionID() { - return DISTRIBUTION_ID; - } - - @Override - public String getConsumerID() { - return CONSUMER_ID; - } - - @Override - public long getTimestamp() { - return 0; - } - - @Override - public DistributionStatusEnum getStatus() { - return DistributionStatusEnum.ALREADY_DEPLOYED; - } - }; - - DistributionStatusMessageImpl result = new DistributionStatusMessageImpl(copyFrom); - assertEquals(result.getArtifactURL(), copyFrom.getArtifactURL()); - assertEquals(result.getConsumerID(), copyFrom.getConsumerID()); - assertEquals(result.getDistributionID(), copyFrom.getDistributionID()); - assertEquals(result.getStatus(), copyFrom.getStatus()); - assertEquals(result.getTimestamp(), copyFrom.getTimestamp()); - } - - @Test - public void shouldProperlySetPropertiesFromIComponentDoneStatusMessage() { - IComponentDoneStatusMessage copyFrom = new IComponentDoneStatusMessage() { - @Override - public String getComponentName() { - return COMPONENT_NAME; - } - - @Override - public String getDistributionID() { - return DISTRIBUTION_ID; - } - - @Override - public String getConsumerID() { - return CONSUMER_ID; - } - - @Override - public long getTimestamp() { - return 0; - } - - @Override - public DistributionStatusEnum getStatus() { - return DistributionStatusEnum.ALREADY_DEPLOYED; - } - }; - - DistributionStatusMessageImpl result = new DistributionStatusMessageImpl(copyFrom); - assertEquals(result.getArtifactURL(), copyFrom.getArtifactURL()); - assertEquals(result.getConsumerID(), copyFrom.getConsumerID()); - assertEquals(result.getDistributionID(), copyFrom.getDistributionID()); - assertEquals(result.getStatus(), copyFrom.getStatus()); - assertEquals(result.getTimestamp(), copyFrom.getTimestamp()); - } - - @Test - public void shouldProperlySetPropertiesFromIFinalDistrStatusMessage() { - IFinalDistrStatusMessage copyFrom = new IFinalDistrStatusMessage() { - - @Override - public String getDistributionID() { - return DISTRIBUTION_ID; - } - - @Override - public long getTimestamp() { - return 0; - } - - @Override - public DistributionStatusEnum getStatus() { - return DistributionStatusEnum.ALREADY_DEPLOYED; - } - }; - - DistributionStatusMessageImpl result = new DistributionStatusMessageImpl(copyFrom); - assertEquals(result.getConsumerID(), copyFrom.getConsumerID()); - assertEquals(result.getDistributionID(), copyFrom.getDistributionID()); - assertEquals(result.getStatus(), copyFrom.getStatus()); - assertEquals(result.getTimestamp(), copyFrom.getTimestamp()); - } - -}
\ No newline at end of file diff --git a/sdc-distribution-client/src/test/java/org/onap/sdc/impl/StatusDataImplTest.java b/sdc-distribution-client/src/test/java/org/onap/sdc/impl/StatusDataImplTest.java deleted file mode 100644 index 82416fa..0000000 --- a/sdc-distribution-client/src/test/java/org/onap/sdc/impl/StatusDataImplTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2019 Nokia. 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 - * - * 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.sdc.impl; - -import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanToStringExcluding; -import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding; -import static org.junit.Assert.assertThat; - -import org.junit.Test; - -public class StatusDataImplTest { - - private static final String COMPONENT_NAME = "componentName"; - private static final String ERROR_REASON = "errorReason"; - - @Test - public void shouldHaveValidGettersAndSetters() { - assertThat(StatusDataImpl.class, hasValidGettersAndSettersExcluding(COMPONENT_NAME, ERROR_REASON)); - } - - @Test - public void shouldHaveValidToString() { - assertThat(StatusDataImpl.class, hasValidBeanToStringExcluding(COMPONENT_NAME, ERROR_REASON)); - } -}
\ No newline at end of file diff --git a/sdc-distribution-client/src/test/java/org/onap/sdc/impl/mock/DistributionClientDownloadResultStubImpl.java b/sdc-distribution-client/src/test/java/org/onap/sdc/impl/mock/DistributionClientDownloadResultStubImpl.java deleted file mode 100644 index 5ffb655..0000000 --- a/sdc-distribution-client/src/test/java/org/onap/sdc/impl/mock/DistributionClientDownloadResultStubImpl.java +++ /dev/null @@ -1,81 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdc-distribution-client - * ================================================================================ - * Copyright (C) 2017 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 - * - * 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.sdc.impl.mock; - -import org.onap.sdc.api.results.IDistributionClientDownloadResult; - -/** - * Mock Implementation - */ -public class DistributionClientDownloadResultStubImpl extends DistributionClientResultStubImpl implements IDistributionClientDownloadResult { - - @Override - public byte[] getArtifactPayload() { - String mockPayload = - "heat_template_version: 2013-05-23\r\n" - + "\r\n" - + "description: >\r\n" - + " HOT template that creates one COR network (direct).\r\n" - + "\r\n" - + "parameters:\r\n" - + " cor_direct_net_name:\r\n" - + " type: string\r\n" - + " description: Name of COR direct network\r\n" - + " cor_direct_net_cidr:\r\n" - + " type: string\r\n" - + " description: Direct network address (CIDR notation)\r\n" - + " cor_direct_net_gateway:\r\n" - + " type: string\r\n" - + " description: Direct network gateway address\r\n" - + " cor_direct_net_RT:\r\n" - + " type: string\r\n" - + " description: Direct network route-target (RT)\r\n" - + "\r\n" - + "resources:\r\n" - + " cor_direct_net:\r\n" - + " type: OS::Contrail::VirtualNetwork\r\n" - + " properties:\r\n" - + " name: { get_param: cor_direct_net_name }\r\n" - + " route_targets: [ get_param: cor_direct_net_RT ]\r\n" - + "\r\n" - + " cor_direct_ip_subnet:\r\n" - + " type: OS::Neutron::Subnet\r\n" - + " properties:\r\n" - + " network_id: { get_resource: cor_direct_net }\r\n" - + " cidr: {get_param: cor_direct_net_cidr}\r\n" - + " gateway_ip: { get_param: cor_direct_net_gateway }\r\n"; - - return mockPayload.getBytes(); - } - - @Override - public String getArtifactName() { - // TODO Auto-generated method stub - return "MackArtifactName"; - } - - @Override - public String getArtifactFilename() { - // TODO Auto-generated method stub - return "MackArtifactName"; - } - -} diff --git a/sdc-distribution-client/src/test/java/org/onap/sdc/impl/mock/DistributionClientResultStubImpl.java b/sdc-distribution-client/src/test/java/org/onap/sdc/impl/mock/DistributionClientResultStubImpl.java deleted file mode 100644 index d176608..0000000 --- a/sdc-distribution-client/src/test/java/org/onap/sdc/impl/mock/DistributionClientResultStubImpl.java +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdc-distribution-client - * ================================================================================ - * Copyright (C) 2017 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 - * - * 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.sdc.impl.mock; - -import org.onap.sdc.api.results.IDistributionClientResult; -import org.onap.sdc.utils.DistributionActionResultEnum; - -/** - * Mock Implementation - */ -public class DistributionClientResultStubImpl implements IDistributionClientResult { - @Override - public DistributionActionResultEnum getDistributionActionResult() { - return DistributionActionResultEnum.SUCCESS; - } - - @Override - public String getDistributionMessageResult() { - return "Stub Result, method not implemented!"; - } - -} diff --git a/sdc-distribution-client/src/test/java/org/onap/sdc/impl/mock/DistributionClientStubImpl.java b/sdc-distribution-client/src/test/java/org/onap/sdc/impl/mock/DistributionClientStubImpl.java deleted file mode 100644 index 40e1869..0000000 --- a/sdc-distribution-client/src/test/java/org/onap/sdc/impl/mock/DistributionClientStubImpl.java +++ /dev/null @@ -1,129 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdc-distribution-client - * ================================================================================ - * Copyright (C) 2017 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 - * - * 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.sdc.impl.mock; - -import java.util.List; - -import org.onap.sdc.api.IDistributionClient; -import org.onap.sdc.api.consumer.IComponentDoneStatusMessage; -import org.onap.sdc.api.consumer.IConfiguration; -import org.onap.sdc.api.consumer.IDistributionStatusMessage; -import org.onap.sdc.api.consumer.IFinalDistrStatusMessage; -import org.onap.sdc.api.consumer.INotificationCallback; -import org.onap.sdc.api.consumer.IStatusCallback; -import org.onap.sdc.api.notification.IArtifactInfo; -import org.onap.sdc.api.notification.IVfModuleMetadata; -import org.onap.sdc.api.results.IDistributionClientDownloadResult; -import org.onap.sdc.api.results.IDistributionClientResult; - -/** - * Mock Implementation - */ -public class DistributionClientStubImpl implements IDistributionClient { - - - public IDistributionClientResult updateConfiguration(IConfiguration newConf) { - return new DistributionClientResultStubImpl(); - } - - public IDistributionClientResult start() { - return new DistributionClientResultStubImpl(); - } - - public IDistributionClientResult stop() { - return new DistributionClientResultStubImpl(); - } - - public IDistributionClientResult sendDownloadStatus(IDistributionStatusMessage statusMessage) { - return new DistributionClientResultStubImpl(); - } - - public IDistributionClientResult sendDeploymentStatus(IDistributionStatusMessage statusMessage) { - return new DistributionClientResultStubImpl(); - } - - @Override - public IDistributionClientDownloadResult download(IArtifactInfo artifactInfo) { - return new DistributionClientDownloadResultStubImpl(); - } - - @Override - public IDistributionClientResult init(IConfiguration conf, INotificationCallback callback) { - return new DistributionClientResultStubImpl(); - } - - @Override - public IDistributionClientResult init(IConfiguration conf, INotificationCallback notificationCallback, - IStatusCallback statusCallback) { - return new DistributionClientResultStubImpl(); - } - - @Override - public IConfiguration getConfiguration() { - // TODO Auto-generated method stub - return null; - } - - @Override - public IDistributionClientResult sendDownloadStatus( - IDistributionStatusMessage statusMessage, String errorReason) { - // TODO Auto-generated method stub - return null; - } - - @Override - public IDistributionClientResult sendDeploymentStatus( - IDistributionStatusMessage statusMessage, String errorReason) { - // TODO Auto-generated method stub - return null; - } - - @Override - public IDistributionClientResult sendComponentDoneStatus(IComponentDoneStatusMessage statusMessage) { - return null; - } - - @Override - public IDistributionClientResult sendFinalDistrStatus(IFinalDistrStatusMessage statusMessage) { - return null; - } - - @Override - public List<IVfModuleMetadata> decodeVfModuleArtifact(byte[] artifactPayload) { - // TODO Auto-generated method stub - return null; - } - - @Override - public IDistributionClientResult sendComponentDoneStatus(IComponentDoneStatusMessage statusMessage, - String errorReason) { - // TODO Auto-generated method stub - return null; - } - - @Override - public IDistributionClientResult sendFinalDistrStatus(IFinalDistrStatusMessage statusMessage, String errorReason) { - // TODO Auto-generated method stub - return null; - } - - -} |