| | |
| | | import org.junit.Test;
|
| | |
|
| | | import com.gitblit.Constants.AccessRestrictionType;
|
| | | import com.gitblit.Constants.AuthorizationControl;
|
| | | import com.gitblit.GitBlitException.UnauthorizedException;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.RpcServlet;
|
| | |
| | | model.description = "created by RpcUtils";
|
| | | model.owner = "garbage";
|
| | | model.accessRestriction = AccessRestrictionType.VIEW;
|
| | | model.authorizationControl = AuthorizationControl.AUTHENTICATED;
|
| | |
|
| | | // create
|
| | | assertTrue("Failed to create repository!",
|
| | |
| | | RepositoryModel retrievedRepository = findRepository(model.name);
|
| | | assertNotNull("Failed to find " + model.name, retrievedRepository);
|
| | | assertEquals(AccessRestrictionType.VIEW, retrievedRepository.accessRestriction);
|
| | | assertEquals(AuthorizationControl.AUTHENTICATED, retrievedRepository.authorizationControl);
|
| | |
|
| | | // rename and change access restriciton
|
| | | String originalName = model.name;
|
| | |
| | | // Create the A-Team
|
| | | TeamModel aTeam = new TeamModel("A-Team");
|
| | | aTeam.users.add("admin");
|
| | | aTeam.repositories.add("helloworld.git");
|
| | | aTeam.addRepositoryPermission("helloworld.git");
|
| | | assertTrue(RpcUtils.createTeam(aTeam, url, account, password.toCharArray()));
|
| | |
|
| | | aTeam = null;
|
| | |
| | | }
|
| | | assertNotNull(aTeam);
|
| | | assertTrue(aTeam.hasUser("admin"));
|
| | | assertTrue(aTeam.hasRepository("helloworld.git"));
|
| | | assertTrue(aTeam.hasRepositoryPermission("helloworld.git"));
|
| | |
|
| | | RepositoryModel helloworld = null;
|
| | | Map<String, RepositoryModel> repositories = RpcUtils.getRepositories(url, account,
|
| | |
| | | // restore setting
|
| | | newValue = !newValue;
|
| | | updated.put(Keys.web.showRepositorySizes, String.valueOf(newValue));
|
| | | success = RpcUtils.updateSettings(updated, url, account, password.toCharArray());
|
| | | assertTrue("Failed to update server settings", success);
|
| | | settings = RpcUtils.getSettings(url, account, password.toCharArray());
|
| | | showSizes = settings.get(Keys.web.showRepositorySizes).getBoolean(true);
|
| | | assertEquals(newValue, showSizes);
|
| | | }
|
| | |
|
| | | @Test
|