Package org.ops4j.pax.exam.sample1.model

Examples of org.ops4j.pax.exam.sample1.model.Book


        log.info("filling library");
        if (libraryService.getNumBooks() != 0) {
            return;
        }

        Author mann = libraryService.createAuthor("Thomas", "Mann");
        Author steinbeck = libraryService.createAuthor("John", "Steinbeck");

        libraryService.createBook("Buddenbrooks", mann);
        libraryService.createBook("East of Eden", steinbeck);
    }
View Full Code Here


    @Before
    public void setUp() {
        if (getNumBooks() != 0)
            return;

        Author mann = new Author();
        mann.setFirstName("Thomas");
        mann.setLastName("Mann");

        Author steinbeck = new Author();
        steinbeck.setFirstName("John");
        steinbeck.setLastName("Steinbeck");

        Book buddenbrooks = new Book();
        buddenbrooks.setTitle("Buddenbrooks");
        buddenbrooks.setAuthor(mann);
        mann.getBooks().add(buddenbrooks);

        Book eden = new Book();
        eden.setTitle("East of Eden");
        eden.setAuthor(steinbeck);
        steinbeck.getBooks().add(eden);

        em.getTransaction().begin();
        em.persist(mann);
        em.persist(steinbeck);
        em.persist(buddenbrooks);
View Full Code Here

    @Test
    public void byTitle() {
        List<Book> books = service.findBooksByTitle("East of Eden");
        assertEquals(1, books.size());

        Book book = books.get(0);
        assertEquals("Steinbeck", book.getAuthor().getLastName());
    }
View Full Code Here

    @Test
    public void byAuthor() {
        List<Book> books = service.findBooksByAuthor("Mann");
        assertEquals(1, books.size());

        Book book = books.get(0);
        assertEquals("Buddenbrooks", book.getTitle());
    }
View Full Code Here

    @Test
    public void byTitle() {
        List<Book> books = bookRepo.findByTitle("East of Eden");
        assertEquals(1, books.size());

        Book book = books.get(0);
        assertEquals("Steinbeck", book.getAuthor().getLastName());
    }
View Full Code Here

    @Test
    public void byAuthor() {
        List<Book> books = service.findBooksByAuthor("Mann");
        assertEquals(1, books.size());

        Book book = books.get(0);
        assertEquals("Buddenbrooks", book.getTitle());
    }
View Full Code Here

    @Test
    public void byTitle() {
        List<Book> books = service.findBooksByTitle("East of Eden");
        assertEquals(1, books.size());

        Book book = books.get(0);
        assertEquals("Steinbeck", book.getAuthor().getLastName());
    }
View Full Code Here

    @Test
    public void byAuthor() {
        List<Book> books = service.findBooksByAuthor("Mann");
        assertEquals(1, books.size());

        Book book = books.get(0);
        assertEquals("Buddenbrooks", book.getTitle());
    }
View Full Code Here

        em.persist(author);
        return author;
    }

    public Book createBook(String title, Author author) {
        Book book = new Book();
        book.setTitle(title);
        book.setAuthor(author);
        author.getBooks().add(book);
        em.persist(book);
        return book;
    }
View Full Code Here

    public void byTitle() {
        System.out.println("********** byTitle");
        List<Book> books = service.findBooksByTitle("East of Eden");
        assertEquals(1, books.size());

        Book book = books.get(0);
        assertEquals("Steinbeck", book.getAuthor().getLastName());
    }
View Full Code Here

TOP

Related Classes of org.ops4j.pax.exam.sample1.model.Book

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.