Showing posts with label services. Show all posts
Showing posts with label services. Show all posts

Things You Need To Know About Business Phone Systems Chicago Services

Saturday, March 29, 2014

By Jeannie Chapman


Whether you have a small or larger businesses, maintaining an effective communication channel is very important. However, this is not possible if you do not have the right system in place. After all, the competition in the investment world continues to stiffen. This means that only those investors who know the right steps to make will manage to stay on top. For this reason, you will need to make sure that you have the right business phone systems Chicago services.

The main challenge when selecting these services is that you are faced with so many varieties. They come in various sizes, types and models. Therefore, if this is the first time, it is common to get confused on the right one. However, this is probably because you do not have the right information. However, knowing a thing or two about them can prove to be very helpful.

One of the main things that you need to know is if the system has VoIP readiness. This system makes use of both data and voice features. Most people ignore this feature mainly because they are still using the standard phone services. However, since you expect your businesses to grow in the future, it will be easy if you look for this feature. Thus, you will not need to buy a new one when that time comes.

With the current advancements in technology, you will need to make sure that they system you buy is easy to use. This is because these systems are becoming more complicated and are integrating more features. This makes it easy for everyone in the workplace to use it without straining so much. However, if you are comfortable with a complex system, then you are free to make this choice.

For smaller companies, it is obvious that you expect your investment to grow. This is the reason you will need to invest in a system that allows for expansion. This means that you need to know if you can add more lines to your system should the need arise in the future. The main benefit about this is that you system will not act as limitation and prevent your company to expand in the future.

Always remember that it is good to look for a personalized system. This is because every company is unique and will need to be offered customized services. This is what simplifies work since the system is tailor made to suit your unique needs. However, many people do not know this and end up with systems that do not work well for them.

The ultimate goal of any communication line is to make work easy. In case you have any issues with the system, you will need to know if there will be someone to assist you. This means that you will require a system that has online support. In the same way, remember to invest in maintenance.

Business phone systems Chicago services can help your company in many ways. As you have seen, there are a few things that you must look into for quality services. At least you now know how to go about it.




About the Author:



Read More..

Spring Java configuration to override and mock services using Mockito

Wednesday, March 5, 2014

In one of the previous posts entitled  Spring Java based configuration using @Configuration and @Bean we discussed how to use Java based configuration in Spring. We also looked at Mockito based examples and BDD using jBehave in this site.


Step 1: Lets say we have a AccountService class that we want to subject under test. While testing, we want to supply mocks for  BankAccountService and CashTransactionService. But use the real CalcEngine.


package com.myapp.services;

import static com.jpmorgan.wss.aes.calculation.strongersuper.engine.CalcEngineDroolsHelper.isNull;
//..

import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;

import javax.annotation.Resource;

import org.joda.time.DateTime;
import org.joda.time.LocalDate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;


@Component("accountService")
public class AccountService
{


@Resource(name = "cashTransactionService")
private CashTransactionService cashTransactionService;


@Resource(name = "bankAccountService")
private BankAccountService bankAccountService;


@Resource(name = "calcEngine")
private CalcEngine calcEngine;


@Transactional(readOnly = true)
public List<balances> calcTransaction(int accountId)
throws IOException
{
//..............uses cashTransactionService, bankAccountService, and calcEngine
}

//...other methods

}


Step 2: The jBehave step class with Spring DI.

package com.myapp.bdd.steps;

import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.drools.runtime.StatelessKnowledgeSession;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.jbehave.core.annotations.Given;
import org.jbehave.core.annotations.Then;
import org.jbehave.core.annotations.When;
import org.jbehave.core.model.ExamplesTable;
import org.joda.time.DateTime;
import org.mockito.Mockito;
import org.springframework.stereotype.Component;

@Component
public class CashTransactionRulesStep
{

@Resource(name = "accountService")
private AccountService accountService;

@Resource(name = "cashTransactionService")
private CashTransactionService cashTransactionService;

@Resource(name = "bankAccountService")
private BankAccountService bankAccountService;

BankAccount bankAccount = new BankAccount();
List<CashTransaction> cashTransactionsList = Collections.EMPTY_LIST;
List<Transaction> result = null;

@Given("a bankAccountCd = $bankAccountCd and bankAccountNm = $bankAccountNm")
public void bankAccountDetails(String bankAccountCd, String bankAccountNm)
{
bankAccount.setAccountCd(bankAccountCd);
bankAccount.setAccountNm1(bankAccountNm);
}

@When("calcTransaction method is fired with portfoliocd = $portfolioCode")
public void calcTransaction(String portfolioCode)
{

try
{

Mockito.when(
cashTransactionService.findByAccountDt(Mockito.anyInt(), (Date) Mockito.anyObject(),
(Date) Mockito.anyObject())).thenReturn(cashTransactionsList);

Mockito.when(
bankAccountService.getBankAccount(Mockito.anyInt())).thenReturn(bankAccount);

result = transactionService.calcTransaction(1);

}
catch (Exception e)
{
throw new RuntimeException(e);
}

}

//......
}

Step 3: Now the Spring config class that overrides DI in AccountService with fully and partially mocked injection. The resource names need to be same to override, and nor defined under  @ComponentScan but defined with @Bean.

package com.myapp.bdd.stories;

import org.mockito.Mockito;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.context.annotation.Import;

@Configuration("AccountingStoryConfig")
@ComponentScan(
basePackages =
{
"com.myapp.bdd",
"com.myapp.accounting",


},
useDefaultFilters = false,
includeFilters =
{
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = ValidatorChain.class),
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = TransactionValidator.class)
})
@Import(
{
StoryConfig.class //import other cobfigs
})
public class AccountingStoryConfig
{

@Bean(name = "accountService")
public TransactionService getAccountService()
{
return Mockito.spy(new AccountServiceImpl()); //partially mock
}

@Bean(name = "cashTransactionService")
public CashTransactionService getCashTransactionService()
{
return Mockito.mock(CashTransactionServiceImpl.class); //fully mock
}

@Bean(name = "bankAccountService")
public BankAccountService getBankAccountService()
{
return Mockito.mock(BankAccountService.class); //fully mock
}

}


Step 4: Finally, for completion sake, the jBehave story class that can run as jUnit test.

package com.myapp.bdd.stories;

import java.util.List;

import org.jbehave.core.io.CodeLocations;
import org.jbehave.core.io.StoryFinder;
import org.springframework.batch.core.configuration.support.ClassPathXmlApplicationContextFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class AccountStory extends AllStories
{

public AccountStory()
{
super();
}

protected ApplicationContext context()
{
if (context == null)
{
try
{
ClassPathXmlApplicationContextFactory factory = new ClassPathXmlApplicationContextFactory(null);
factory.setApplicationContext(new AnnotationConfigApplicationContext(AccountStoryConfig.class));

context = factory.createApplicationContext();
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
return context;
}

@Override
protected List<string> storyPaths()
{
return new StoryFinder().findPaths(
CodeLocations.codeLocationFromClass(getClass()), "**/account.story", "");
}

}



Read More..