Package org.apache.openejb.test.entity.cmr.onetomany

Examples of org.apache.openejb.test.entity.cmr.onetomany.ArtistLocal


        resetDB();
        beginTransaction();
        Set songs;
        SongLocal newSong;
        try {
            ArtistLocal artist = findArtist(new Integer(1));
            newSong = createSong(new Integer(33));
            songs = artist.getComposed();
        } finally {
            completeTransaction();
        }

        // CMR collections should still be readable
View Full Code Here


        resetDB();
        beginTransaction();
        Set songs;
        SongLocal newSong;
        try {
            ArtistLocal artist = findArtist(new Integer(1));
            newSong = createSong(new Integer(33));
            songs = artist.getComposed();
        } finally {
            completeTransaction();
        }

        beginTransaction();
View Full Code Here

    public void testIteratorConcurrentModification() throws Exception {
        resetDB();
        beginTransaction();
        try {
            ArtistLocal artist = findArtist(new Integer(1));
            SongLocal song = findSong(new Integer(11));
            Set songs = artist.getComposed();
            assertFalse(songs.isEmpty());
            assertEquals(2, songs.size());

            Iterator iterator = songs.iterator();
View Full Code Here

    public void testIteratorAndRemove() throws Exception {
        resetDB();
        beginTransaction();
        try {
            ArtistLocal artist = findArtist(new Integer(1));
            SongLocal song = findSong(new Integer(11));
            Set games = artist.getComposed();
            assertFalse(games.isEmpty());
            assertEquals(2, games.size());

            Iterator iterator = games.iterator();

            assertTrue(games.contains(song));
            artist.remove();
            assertFalse(games.contains(song));
            assertEquals(0, games.size());

            try {
                iterator.next();
View Full Code Here

            completeTransaction();
        }
    }

    private ArtistLocal createArtist(int songId) throws CreateException {
        ArtistLocal artist = artistLocalHome.create(songId);
        artist.setName("value" + songId);
        return artist;
    }
View Full Code Here

        } finally {
            close(statement);
            close(connection);
        }

        ArtistLocal artist1 = createArtist(1);
        createArtist(2);

        SongLocal song1 = createSong(11);
        SongLocal song2 = createSong(22);
View Full Code Here

    public void test00_AGetBExistingAB() throws Exception {
        resetDB();
        beginTransaction();
        try {
            ArtistLocal artist = findArtist(1);
            Set bSet = artist.getPerformed();
            assertEquals(2, bSet.size());
            for (Object value : bSet) {
                SongLocal song = (SongLocal) value;
                if (song.getId().equals(11)) {
                    assertEquals("value11", song.getName());
View Full Code Here

    public void test01_BGetAExistingAB() throws Exception {
        resetDB();
        beginTransaction();
        try {
            SongLocal song = findSong(11);
            ArtistLocal artist = song.getPerformer();
            assertNotNull(artist);
            assertEquals(new Integer(1), artist.getId());
            assertEquals("value1", artist.getName());

            song = findSong(22);
            artist = song.getPerformer();
            assertNotNull(artist);
            assertEquals(new Integer(1), artist.getId());
            assertEquals("value1", artist.getName());
        } finally {
            completeTransaction();
        }
    }
View Full Code Here

    public void test02_ASetBDropExisting() throws Exception {
        resetDB();
        beginTransaction();
        try {
            ArtistLocal artist = findArtist(1);
            artist.setPerformed(new HashSet<SongLocal>());
        } finally {
            completeTransaction();
        }
        assertUnlinked(1);
    }
View Full Code Here

    public void test04_ASetBNewAB() throws Exception {
        resetDB();
        beginTransaction();
        try {
            ArtistLocal artist = findArtist(2);
            SongLocal song = findSong(22);
            Set<SongLocal> songSets = new HashSet<SongLocal>();
            songSets.add(song);
            artist.setPerformed(songSets);
        } finally {
            completeTransaction();
        }

        assertLinked(2, 22);
View Full Code Here

TOP

Related Classes of org.apache.openejb.test.entity.cmr.onetomany.ArtistLocal

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.