@Test public void cloneShouldReturnAnEqualInstance() { setNoneDefaultValues(configuration); SmppConfiguration config = configuration.copy(); assertEquals(config.getDestAddr(), configuration.getDestAddr()); assertEquals(config.getDestAddrNpi(), configuration.getDestAddrNpi()); assertEquals(config.getDestAddrTon(), configuration.getDestAddrTon()); assertEquals(config.getEnquireLinkTimer(), configuration.getEnquireLinkTimer()); assertEquals(config.getHost(), configuration.getHost()); assertEquals(config.getPassword(), configuration.getPassword()); assertEquals(config.getPort(), configuration.getPort()); assertEquals(config.getPriorityFlag(), configuration.getPriorityFlag()); assertEquals(config.getProtocolId(), configuration.getProtocolId()); assertEquals(config.getRegisteredDelivery(), configuration.getRegisteredDelivery()); assertEquals(config.getReplaceIfPresentFlag(), configuration.getReplaceIfPresentFlag()); assertEquals(config.getServiceType(), configuration.getServiceType()); assertEquals(config.getSourceAddr(), configuration.getSourceAddr()); assertEquals(config.getSourceAddrNpi(), configuration.getSourceAddrNpi()); assertEquals(config.getSourceAddrTon(), configuration.getSourceAddrTon()); assertEquals(config.getSystemId(), configuration.getSystemId()); assertEquals(config.getSystemType(), configuration.getSystemType()); assertEquals(config.getTransactionTimer(), configuration.getTransactionTimer()); assertEquals(config.getEncoding(), configuration.getEncoding()); assertEquals(config.getNumberingPlanIndicator(), configuration.getNumberingPlanIndicator()); assertEquals(config.getTypeOfNumber(), configuration.getTypeOfNumber()); assertEquals(config.getUsingSSL(), configuration.getUsingSSL()); assertEquals(config.getInitialReconnectDelay(), configuration.getInitialReconnectDelay()); assertEquals(config.getReconnectDelay(), configuration.getReconnectDelay()); assertEquals(config.getHttpProxyHost(), configuration.getHttpProxyHost()); assertEquals(config.getHttpProxyPort(), configuration.getHttpProxyPort()); assertEquals(config.getHttpProxyUsername(), configuration.getHttpProxyUsername()); assertEquals(config.getHttpProxyPassword(), configuration.getHttpProxyPassword()); assertEquals(config.getSessionStateListener(), configuration.getSessionStateListener()); }
@Test public void getterShouldReturnTheSetValues() { setNoneDefaultValues(configuration); assertEquals("1919", configuration.getDestAddr()); assertEquals(0x08, configuration.getDestAddrNpi()); assertEquals(0x02, configuration.getDestAddrTon()); assertEquals(new Integer(5001), configuration.getEnquireLinkTimer()); assertEquals("127.0.0.1", configuration.getHost()); assertEquals("secret", configuration.getPassword()); assertEquals(new Integer(2776), configuration.getPort()); assertEquals(0x00, configuration.getPriorityFlag()); assertEquals(0x01, configuration.getProtocolId()); assertEquals(0x00, configuration.getRegisteredDelivery()); assertEquals(0x01, configuration.getReplaceIfPresentFlag()); assertEquals("XXX", configuration.getServiceType()); assertEquals("1818", configuration.getSourceAddr()); assertEquals(0x08, configuration.getSourceAddrNpi()); assertEquals(0x02, configuration.getSourceAddrTon()); assertEquals("client", configuration.getSystemId()); assertEquals("xx", configuration.getSystemType()); assertEquals(new Integer(10001), configuration.getTransactionTimer()); assertEquals("UTF-8", configuration.getEncoding()); assertEquals(0x08, configuration.getNumberingPlanIndicator()); assertEquals(0x02, configuration.getTypeOfNumber()); assertEquals(true, configuration.getUsingSSL()); assertEquals(5001, configuration.getInitialReconnectDelay()); assertEquals(5002, configuration.getReconnectDelay()); assertEquals("127.0.0.1", configuration.getHttpProxyHost()); assertEquals(new Integer(3129), configuration.getHttpProxyPort()); assertEquals("user", configuration.getHttpProxyUsername()); assertEquals("secret", configuration.getHttpProxyPassword()); assertNotNull(configuration.getSessionStateListener()); }
@Test public void getterShouldReturnTheDefaultValues() { assertEquals("1717", configuration.getDestAddr()); assertEquals(0x00, configuration.getDestAddrNpi()); assertEquals(0x00, configuration.getDestAddrTon()); assertEquals("", configuration.getAddressRange()); assertEquals(new Integer(5000), configuration.getEnquireLinkTimer()); assertEquals("localhost", configuration.getHost()); assertEquals("password", configuration.getPassword()); assertEquals(new Integer(2775), configuration.getPort()); assertEquals(0x01, configuration.getPriorityFlag()); assertEquals(0x00, configuration.getProtocolId()); assertEquals(0x01, configuration.getRegisteredDelivery()); assertEquals(0x00, configuration.getReplaceIfPresentFlag()); assertEquals("CMT", configuration.getServiceType()); assertEquals("1616", configuration.getSourceAddr()); assertEquals(0x00, configuration.getSourceAddrNpi()); assertEquals(0x00, configuration.getSourceAddrTon()); assertEquals("smppclient", configuration.getSystemId()); assertEquals("cp", configuration.getSystemType()); assertEquals(new Integer(10000), configuration.getTransactionTimer()); assertEquals("ISO-8859-1", configuration.getEncoding()); assertEquals(0x00, configuration.getNumberingPlanIndicator()); assertEquals(0x00, configuration.getTypeOfNumber()); assertEquals(false, configuration.getUsingSSL()); assertEquals(5000, configuration.getInitialReconnectDelay()); assertEquals(5000, configuration.getReconnectDelay()); assertEquals(null, configuration.getHttpProxyHost()); assertEquals(new Integer(3128), configuration.getHttpProxyPort()); assertEquals(null, configuration.getHttpProxyUsername()); assertEquals(null, configuration.getHttpProxyPassword()); assertEquals(null, configuration.getSessionStateListener()); }
@Test public void getterShouldReturnTheConfigureValuesFromURI() throws URISyntaxException { configuration.configureFromURI(new URI("smpp://[email protected]:2776")); assertEquals("127.0.0.1", configuration.getHost()); assertEquals(new Integer(2776), configuration.getPort()); assertEquals("client", configuration.getSystemId()); }