Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package gov.bsp.lcmis.internal.test;
- import static org.junit.Assert.*;
- import java.sql.Connection;
- import java.sql.SQLException;
- import java.text.DateFormat;
- import java.text.SimpleDateFormat;
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.List;
- import javax.naming.NamingException;
- import javax.sql.DataSource;
- import org.junit.BeforeClass;
- import org.junit.Test;
- import org.junit.runner.RunWith;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.BeansException;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.context.ApplicationContext;
- import org.springframework.context.ApplicationContextAware;
- import org.springframework.jdbc.datasource.AbstractDataSource;
- import org.springframework.jdbc.datasource.DriverManagerDataSource;
- import org.springframework.mock.jndi.SimpleNamingContextBuilder;
- import org.springframework.test.context.ActiveProfiles;
- import org.springframework.test.context.ContextConfiguration;
- import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
- import org.springframework.test.context.web.WebAppConfiguration;
- import gov.bsp.lcmis.internal.controller.ForeclosureController;
- import gov.bsp.lcmis.internal.lmm.domain.BidMemoComponent;
- import gov.bsp.lcmis.internal.lmm.domain.BidMemoComponentPmcImpl;
- import gov.bsp.lcmis.internal.lmm.domain.BidMemoPageObject;
- import gov.bsp.lcmis.internal.lmm.domain.BidPrice;
- import gov.bsp.lcmis.internal.lmm.manager.BidMemoManager;
- @RunWith(SpringJUnit4ClassRunner.class)
- @WebAppConfiguration
- @ContextConfiguration(value="file:src/main/webapp/WEB-INF/dispatcher-servlet.xml")
- @ActiveProfiles("test")
- public class JTest {
- @Autowired
- BidMemoManager manager;
- private static final Logger log = LoggerFactory.getLogger(JTest.class);
- private static String url = "jdbc:db2://localhost:50000/bspdb2";
- private static String username = "db2admin";
- private static String password = "password123";
- @BeforeClass
- public static void setupClass() {
- //create the datasource
- DriverManagerDataSource datasource = new DriverManagerDataSource(url, username, password);
- datasource.setDriverClassName("com.ibm.db2.jcc.DB2Driver");
- //bind to a jndi string
- SimpleNamingContextBuilder builder = new SimpleNamingContextBuilder();
- builder.bind("lcmisbsp", datasource);
- try {
- builder.activate();
- } catch (IllegalStateException | NamingException e) {
- log.error("Error setting up test class, ", e);
- }
- }
- @Test
- public void test() {
- BidPrice bidPrice = new BidPrice();
- bidPrice = manager.retrieveBidData(new BidMemoPageObject());
- log.debug(bidPrice.toString());
- // BidMemoPageObject b = new BidMemoPageObject();
- // manager.retrieveBidData(b);
- assertTrue(bidPrice != null);
- }
- // @Test
- // public void test() {
- // boolean testBool = false;
- // List<String> strings = null;
- //
- // if(strings == null || strings.size() <= 1){
- // testBool = true;
- // }
- //
- //
- // assertEquals(true,testBool);
- // }
- //
- // @Test
- // public void yow(){
- // Date dateToBeConverted =new Date();
- //
- // String dateConverted = null;
- //
- //// try {
- // DateFormat df = new SimpleDateFormat("dd MMMM yyyy");
- // dateConverted = df.format(dateToBeConverted);
- //// } catch (Exception e) {
- //// log.debug("adfadsf "+dateConverted);
- //// e.printStackTrace();
- //// }
- //
- //
- //
- // }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement