Search in sources :

Example 16 with GitBlitException

use of com.gitblit.GitBlitException in project gitblit by gitblit.

the class GroovyScriptTest method testBlockPush.

@Test
public void testBlockPush() throws Exception {
    MockGitblit gitblit = new MockGitblit();
    MockLogger logger = new MockLogger();
    MockClientLogger clientLogger = new MockClientLogger();
    List<ReceiveCommand> commands = new ArrayList<ReceiveCommand>();
    commands.add(new ReceiveCommand(ObjectId.fromString("c18877690322dfc6ae3e37bb7f7085a24e94e887"), ObjectId.fromString("3fa7c46d11b11d61f1cbadc6888be5d0eae21969"), "refs/heads/master"));
    RepositoryModel repository = new RepositoryModel("ex@mple.git", "", "admin", new Date());
    try {
        test("blockpush.groovy", gitblit, logger, clientLogger, commands, repository);
        assertTrue("blockpush should have failed!", false);
    } catch (GitBlitException e) {
        assertTrue(e.getMessage().contains("failed"));
    }
}
Also used : ReceiveCommand(org.eclipse.jgit.transport.ReceiveCommand) ArrayList(java.util.ArrayList) GitBlitException(com.gitblit.GitBlitException) RepositoryModel(com.gitblit.models.RepositoryModel) Date(java.util.Date) Test(org.junit.Test)

Aggregations

GitBlitException (com.gitblit.GitBlitException)16 RepositoryModel (com.gitblit.models.RepositoryModel)10 ArrayList (java.util.ArrayList)9 UserModel (com.gitblit.models.UserModel)6 Form (org.apache.wicket.markup.html.form.Form)5 TeamModel (com.gitblit.models.TeamModel)4 File (java.io.File)4 SimpleAttributeModifier (org.apache.wicket.behavior.SimpleAttributeModifier)4 Button (org.apache.wicket.markup.html.form.Button)4 CompoundPropertyModel (org.apache.wicket.model.CompoundPropertyModel)4 RegistrantAccessPermission (com.gitblit.models.RegistrantAccessPermission)3 StringChoiceRenderer (com.gitblit.wicket.StringChoiceRenderer)3 BooleanOption (com.gitblit.wicket.panels.BooleanOption)3 RegistrantPermissionsPanel (com.gitblit.wicket.panels.RegistrantPermissionsPanel)3 IOException (java.io.IOException)3 Repository (org.eclipse.jgit.lib.Repository)3 RepositoryLifeCycleListener (com.gitblit.extensions.RepositoryLifeCycleListener)2 IRepositoryManager (com.gitblit.manager.IRepositoryManager)2 UserChoice (com.gitblit.models.UserChoice)2 AccessPolicyPanel (com.gitblit.wicket.panels.AccessPolicyPanel)2