Package org.ops4j.pax.exam.sample6.service

Examples of org.ops4j.pax.exam.sample6.service.LibraryClient


    @TransactionAttribute
    public void fillLibrary() {
        if (getNumBooks() != 0) {
            return;
        }
        Author mann = createAuthor("Thomas", "Mann");
        Author steinbeck = createAuthor("John", "Steinbeck");

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


        return books;
    }

    @TransactionAttribute
    public Author createAuthor(String firstName, String lastName) {
        Author author = new Author();
        author.setFirstName(firstName);
        author.setLastName(lastName);
        em.persist(author);
        return author;
    }
View Full Code Here

    public void fillLibrary() {
        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

    @TransactionAttribute(TransactionAttributeType.SUPPORTS)
    public void fillLibrary() {
        if (getNumBooks() != 0) {
            return;
        }
        Author mann = createAuthor("Thomas", "Mann");
        Author steinbeck = createAuthor("John", "Steinbeck");

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

        return books;
    }

    @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
    public Author createAuthor(String firstName, String lastName) {
        Author author = new Author();
        author.setFirstName(firstName);
        author.setLastName(lastName);
        em.persist(author);
        return author;
    }
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

    public void byTitle() {
        service.fillLibrary();
        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

        return author;
    }

    @TransactionAttribute
    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

        return author;
    }

    @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
    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

TOP

Related Classes of org.ops4j.pax.exam.sample6.service.LibraryClient

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.