Package com.saasovation.agilepm.domain.model.team

Examples of com.saasovation.agilepm.domain.model.team.Team


    public LevelDBTeamRepositoryTest() {
        super();
    }

    public void testSave() throws Exception {
        Team team = new Team(new TenantId("12345"), "team1");

        LevelDBUnitOfWork.start(this.database);
        teamRepository.save(team);
        LevelDBUnitOfWork.current().commit();

        Team savedTeam = teamRepository.teamNamed(team.tenantId(), team.name());

        assertNotNull(savedTeam);
        assertEquals(team.tenantId(), savedTeam.tenantId());
        assertEquals(team.name(), savedTeam.name());

        Collection<Team> savedTeams =
                this.teamRepository.allTeamsOfTenant(team.tenantId());

        assertFalse(savedTeams.isEmpty());
View Full Code Here


        assertFalse(savedTeams.isEmpty());
        assertEquals(1, savedTeams.size());
    }

    public void testRemove() {
        Team team1 = new Team(new TenantId("12345"), "team1");

        Team team2 = new Team(new TenantId("12345"), "team2");

        LevelDBUnitOfWork.start(this.database);
        teamRepository.save(team1);
        teamRepository.save(team2);
        LevelDBUnitOfWork.current().commit();

        LevelDBUnitOfWork.start(this.database);
        teamRepository.remove(team1);
        LevelDBUnitOfWork.current().commit();

        TenantId tenantId = team2.tenantId();

        Collection<Team> savedTeams = teamRepository.allTeamsOfTenant(tenantId);
        assertFalse(savedTeams.isEmpty());
        assertEquals(1, savedTeams.size());
        assertEquals(team2.name(), savedTeams.iterator().next().name());

        LevelDBUnitOfWork.start(this.database);
        teamRepository.remove(team2);
        LevelDBUnitOfWork.current().commit();
View Full Code Here

        savedTeams = teamRepository.allTeamsOfTenant(tenantId);
        assertTrue(savedTeams.isEmpty());
    }

    public void testSaveAllRemoveAll() throws Exception {
        Team team1 = new Team(new TenantId("12345"), "team1");

        Team team2 = new Team(new TenantId("12345"), "team2");

        Team team3 = new Team(new TenantId("12345"), "team3");

        LevelDBUnitOfWork.start(this.database);
        teamRepository.saveAll(Arrays.asList(new Team[] { team1, team2, team3 }));
        LevelDBUnitOfWork.current().commit();
View Full Code Here

    }

    public void testConcurrentTransactions() throws Exception {
        final List<Integer> orderOfCommits = new ArrayList<Integer>();

        Team team1 = new Team(new TenantId("12345"), "team1");

        LevelDBUnitOfWork.start(database);
        teamRepository.save(team1);

        new Thread() {
           @Override
           public void run() {
               Team team2 = new Team(new TenantId("12345"), "team2");

               LevelDBUnitOfWork.start(database);
               teamRepository.save(team2);
               LevelDBUnitOfWork.current().commit();
               orderOfCommits.add(2);
View Full Code Here

        LevelDBUnitOfWork uow = LevelDBUnitOfWork.readOnly(this.database());

        List<Object> keys = uow.readKeys(teamsOfTenant);

        for (Object teamId : keys) {
            Team team = uow.readObject(teamId.toString().getBytes(), Team.class);

            if (team != null) {
                teams.add(team);
            }
        }
View Full Code Here

    @Override
    public Team teamNamed(TenantId aTenantId, String aName) {
        LevelDBKey primaryKey = new LevelDBKey(PRIMARY, aTenantId.id(), aName);

        Team team =
                LevelDBUnitOfWork.readOnly(this.database())
                    .readObject(primaryKey.key().getBytes(), Team.class);

        return team;
    }
View Full Code Here

TOP

Related Classes of com.saasovation.agilepm.domain.model.team.Team

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.