diff options
Diffstat (limited to 'common-app-api/src')
2 files changed, 31 insertions, 550 deletions
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/config/DmaapConsumerConfiguration.java b/common-app-api/src/main/java/org/openecomp/sdc/be/config/DmaapConsumerConfiguration.java index 1ba539b942..2493d53dd0 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/be/config/DmaapConsumerConfiguration.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/be/config/DmaapConsumerConfiguration.java @@ -3,7 +3,7 @@ package org.openecomp.sdc.be.config; * Contains DMAAP Client configuration parameters */ public class DmaapConsumerConfiguration { - + private boolean active; private String hosts; private String consumerGroup; private String consumerId; @@ -216,7 +216,11 @@ public class DmaapConsumerConfiguration { public void setCredential(Credential credential) { this.credential = credential; } - + + public boolean isActive() { return active; } + + public void setActive(boolean isActive) { this.active = isActive; } + /** * Contains Dmaap Client credential parameters: username and password */ @@ -246,7 +250,7 @@ public class DmaapConsumerConfiguration { @Override public String toString() { - return "DmaapConsumerConfiguration [hosts=" + hosts + ", consumerGroup=" + consumerGroup + ", consumerId=" + return "DmaapConsumerConfiguration [active=" + active + ", hosts=" + hosts + ", consumerGroup=" + consumerGroup + ", consumerId=" + consumerId + ", timeoutMs=" + timeoutMs + ", limit=" + limit + ", pollingInterval=" + pollingInterval + ", topic=" + topic + ", latitude=" + latitude + ", longitude=" + longitude + ", version=" + version + ", serviceName=" + serviceName + ", environment=" + environment + ", partner=" + partner diff --git a/common-app-api/src/test/java/org/openecomp/sdc/be/config/DmaapConsumerConfigurationTest.java b/common-app-api/src/test/java/org/openecomp/sdc/be/config/DmaapConsumerConfigurationTest.java index a4087b34c5..8c19a0a48f 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/be/config/DmaapConsumerConfigurationTest.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/be/config/DmaapConsumerConfigurationTest.java @@ -1,561 +1,38 @@ package org.openecomp.sdc.be.config; +import com.google.code.beanmatchers.BeanMatchers; import org.junit.Test; -import org.openecomp.sdc.be.config.DmaapConsumerConfiguration.Credential; +import static org.hamcrest.MatcherAssert.assertThat; public class DmaapConsumerConfigurationTest { - private DmaapConsumerConfiguration createTestSubject() { - return new DmaapConsumerConfiguration(); - } - - - @Test - public void testGetHosts() throws Exception { - DmaapConsumerConfiguration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getHosts(); - } - - - @Test - public void testSetHosts() throws Exception { - DmaapConsumerConfiguration testSubject; - String hosts = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setHosts(hosts); - } - - - @Test - public void testGetConsumerGroup() throws Exception { - DmaapConsumerConfiguration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getConsumerGroup(); - } - - - @Test - public void testSetConsumerGroup() throws Exception { - DmaapConsumerConfiguration testSubject; - String consumerGroup = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setConsumerGroup(consumerGroup); - } - - - @Test - public void testGetConsumerId() throws Exception { - DmaapConsumerConfiguration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getConsumerId(); - } - - - @Test - public void testSetConsumerId() throws Exception { - DmaapConsumerConfiguration testSubject; - String consumerId = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setConsumerId(consumerId); - } - - - @Test - public void testGetTimeoutMs() throws Exception { - DmaapConsumerConfiguration testSubject; - Integer result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getTimeoutMs(); - } - - - @Test - public void testSetTimeoutMs() throws Exception { - DmaapConsumerConfiguration testSubject; - Integer timeoutMs = 0; - - // default test - testSubject = createTestSubject(); - testSubject.setTimeoutMs(timeoutMs); - } - - - @Test - public void testGetLimit() throws Exception { - DmaapConsumerConfiguration testSubject; - Integer result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getLimit(); - } - - - @Test - public void testSetLimit() throws Exception { - DmaapConsumerConfiguration testSubject; - Integer limit = 0; - - // default test - testSubject = createTestSubject(); - testSubject.setLimit(limit); - } - - - @Test - public void testGetPollingInterval() throws Exception { - DmaapConsumerConfiguration testSubject; - Integer result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getPollingInterval(); - } - - - @Test - public void testSetPollingInterval() throws Exception { - DmaapConsumerConfiguration testSubject; - Integer pollingInterval = 0; - - // default test - testSubject = createTestSubject(); - testSubject.setPollingInterval(pollingInterval); - } - - - @Test - public void testGetTopic() throws Exception { - DmaapConsumerConfiguration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getTopic(); - } - - - @Test - public void testSetTopic() throws Exception { - DmaapConsumerConfiguration testSubject; - String topic = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setTopic(topic); - } - - - @Test - public void testGetLatitude() throws Exception { - DmaapConsumerConfiguration testSubject; - Double result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getLatitude(); - } - - - @Test - public void testSetLatitude() throws Exception { - DmaapConsumerConfiguration testSubject; - Double latitude = null; - - // default test - testSubject = createTestSubject(); - testSubject.setLatitude(latitude); - } - - - @Test - public void testGetLongitude() throws Exception { - DmaapConsumerConfiguration testSubject; - Double result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getLongitude(); - } - - - @Test - public void testSetLongitude() throws Exception { - DmaapConsumerConfiguration testSubject; - Double longitude = null; - - // default test - testSubject = createTestSubject(); - testSubject.setLongitude(longitude); - } - - - @Test - public void testGetVersion() throws Exception { - DmaapConsumerConfiguration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getVersion(); - } - - - @Test - public void testSetVersion() throws Exception { - DmaapConsumerConfiguration testSubject; - String version = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setVersion(version); - } - - - @Test - public void testGetServiceName() throws Exception { - DmaapConsumerConfiguration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getServiceName(); - } - - - @Test - public void testSetServiceName() throws Exception { - DmaapConsumerConfiguration testSubject; - String serviceName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setServiceName(serviceName); - } - - - @Test - public void testGetEnvironment() throws Exception { - DmaapConsumerConfiguration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getEnvironment(); - } - - - @Test - public void testSetEnvironment() throws Exception { - DmaapConsumerConfiguration testSubject; - String environment = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setEnvironment(environment); - } - - @Test - public void testGetPartner() throws Exception { - DmaapConsumerConfiguration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getPartner(); + public void shouldHaveValidGettersAndSetters() { + assertThat(DmaapConsumerConfiguration.class, BeanMatchers.hasValidGettersAndSetters()); } - - @Test - public void testSetPartner() throws Exception { - DmaapConsumerConfiguration testSubject; - String partner = ""; + @Test + public void shouldHaveValidCtor() { + assertThat(DmaapConsumerConfiguration.class, BeanMatchers.hasValidBeanConstructor()); + } - // default test - testSubject = createTestSubject(); - testSubject.setPartner(partner); - } + @Test + public void shouldHaveValidToString() { + assertThat(DmaapConsumerConfiguration.class, BeanMatchers.hasValidBeanToString()); + } - - @Test - public void testGetRouteOffer() throws Exception { - DmaapConsumerConfiguration testSubject; - String result; + @Test + public void shouldHaveValidGettersAndSettersNested() { + assertThat(DmaapConsumerConfiguration.Credential.class, BeanMatchers.hasValidGettersAndSetters()); + } - // default test - testSubject = createTestSubject(); - result = testSubject.getRouteOffer(); - } + @Test + public void shouldHaveValidCtorNested() { + assertThat(DmaapConsumerConfiguration.Credential.class, BeanMatchers.hasValidBeanConstructor()); + } - - @Test - public void testSetRouteOffer() throws Exception { - DmaapConsumerConfiguration testSubject; - String routeOffer = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setRouteOffer(routeOffer); - } - - - @Test - public void testGetProtocol() throws Exception { - DmaapConsumerConfiguration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getProtocol(); - } - - - @Test - public void testSetProtocol() throws Exception { - DmaapConsumerConfiguration testSubject; - String protocol = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setProtocol(protocol); - } - - - @Test - public void testGetContenttype() throws Exception { - DmaapConsumerConfiguration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getContenttype(); - } - - - @Test - public void testSetContenttype() throws Exception { - DmaapConsumerConfiguration testSubject; - String contenttype = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setContenttype(contenttype); - } - - - @Test - public void testIsDme2TraceOn() throws Exception { - DmaapConsumerConfiguration testSubject; - Boolean result; - - // default test - testSubject = createTestSubject(); - result = testSubject.isDme2TraceOn(); - } - - - @Test - public void testGetDme2TraceOn() throws Exception { - DmaapConsumerConfiguration testSubject; - Boolean result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDme2TraceOn(); - } - - - @Test - public void testSetDme2TraceOn() throws Exception { - DmaapConsumerConfiguration testSubject; - Boolean dme2TraceOn = null; - - // default test - testSubject = createTestSubject(); - testSubject.setDme2TraceOn(dme2TraceOn); - } - - - @Test - public void testGetAftEnvironment() throws Exception { - DmaapConsumerConfiguration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getAftEnvironment(); - } - - - @Test - public void testSetAftEnvironment() throws Exception { - DmaapConsumerConfiguration testSubject; - String aftEnvironment = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setAftEnvironment(aftEnvironment); - } - - - @Test - public void testGetAftDme2ConnectionTimeoutMs() throws Exception { - DmaapConsumerConfiguration testSubject; - Integer result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getAftDme2ConnectionTimeoutMs(); - } - - - @Test - public void testSetAftDme2ConnectionTimeoutMs() throws Exception { - DmaapConsumerConfiguration testSubject; - Integer aftDme2ConnectionTimeoutMs = 0; - - // default test - testSubject = createTestSubject(); - testSubject.setAftDme2ConnectionTimeoutMs(aftDme2ConnectionTimeoutMs); - } - - - @Test - public void testGetAftDme2RoundtripTimeoutMs() throws Exception { - DmaapConsumerConfiguration testSubject; - Integer result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getAftDme2RoundtripTimeoutMs(); - } - - - @Test - public void testSetAftDme2RoundtripTimeoutMs() throws Exception { - DmaapConsumerConfiguration testSubject; - Integer aftDme2RoundtripTimeoutMs = 0; - - // default test - testSubject = createTestSubject(); - testSubject.setAftDme2RoundtripTimeoutMs(aftDme2RoundtripTimeoutMs); - } - - - @Test - public void testGetAftDme2ReadTimeoutMs() throws Exception { - DmaapConsumerConfiguration testSubject; - Integer result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getAftDme2ReadTimeoutMs(); - } - - - @Test - public void testSetAftDme2ReadTimeoutMs() throws Exception { - DmaapConsumerConfiguration testSubject; - Integer aftDme2ReadTimeoutMs = 0; - - // default test - testSubject = createTestSubject(); - testSubject.setAftDme2ReadTimeoutMs(aftDme2ReadTimeoutMs); - } - - - @Test - public void testGetDme2preferredRouterFilePath() throws Exception { - DmaapConsumerConfiguration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDme2preferredRouterFilePath(); - } - - - @Test - public void testSetDme2preferredRouterFilePath() throws Exception { - DmaapConsumerConfiguration testSubject; - String dme2preferredRouterFilePath = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setDme2preferredRouterFilePath(dme2preferredRouterFilePath); - } - - - @Test - public void testGetCredential() throws Exception { - DmaapConsumerConfiguration testSubject; - Credential result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCredential(); - } - - - @Test - public void testSetCredential() throws Exception { - DmaapConsumerConfiguration testSubject; - Credential credential = null; - - // default test - testSubject = createTestSubject(); - testSubject.setCredential(credential); - } - - - @Test - public void testToString() throws Exception { - DmaapConsumerConfiguration testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.toString(); - } - - - @Test - public void testGetTimeLimitForNotificationHandleMs() throws Exception { - DmaapConsumerConfiguration testSubject; - Integer result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getTimeLimitForNotificationHandleMs(); - } - - - @Test - public void testSetTimeLimitForNotificationHandleMs() throws Exception { - DmaapConsumerConfiguration testSubject; - Integer timeLimitForNotificationHandleMs = 0; - - // default test - testSubject = createTestSubject(); - testSubject.setTimeLimitForNotificationHandleMs(timeLimitForNotificationHandleMs); - } + @Test + public void shouldHaveValidToStringNested() { + assertThat(DmaapConsumerConfiguration.Credential.class, BeanMatchers.hasValidBeanToString()); + } }
\ No newline at end of file |