repository.BeanTest.java Source code

Java tutorial

Introduction

Here is the source code for repository.BeanTest.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package repository;

import com.tonata.photostudio2.app.conf.ConnectionConfig;
import javax.sql.DataSource;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.orm.jpa.JpaVendorAdapter;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.testng.Assert;
import static org.testng.Assert.*;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

/**
 *
 * @author Tonata
 */
public class BeanTest {
    private ConnectionConfig c = new ConnectionConfig();

    public BeanTest() {
    }

    @Test
    public void test1() {

        LocalContainerEntityManagerFactoryBean lm = c.entityManagerFactory(c.dataSource(), c.jpaVendorAdapter());

        ApplicationContext ct = new AnnotationConfigApplicationContext(c.build().getClass());
        Assert.assertNotNull(ct);

        System.out.println();
    }

    @BeforeClass
    public static void setUpClass() throws Exception {
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }

    @BeforeMethod
    public void setUpMethod() throws Exception {
    }

    @AfterMethod
    public void tearDownMethod() throws Exception {
    }

}