@Override public ProjectInternal bindAllModelRules() { try { getModelRegistry().bindAllReferences(); } catch (Exception e) { throw new ProjectConfigurationException(String.format("A problem occurred configuring %s.", this), e); } return this; }
private static void discoverTasks(ProjectInternal project) { try { project.getTasks().discoverTasks(); } catch (Throwable e) { throw new ProjectConfigurationException(String.format("A problem occurred configuring %s.", project), e); } }
private static TaskInternal getExistingTask(ProjectInternal project, String taskName) { try { return (TaskInternal) project.getTasks().getByName(taskName); } catch (Throwable e) { throw new ProjectConfigurationException(String.format("A problem occurred configuring %s.", project), e); } }
@VisibleForTesting void validateServerVersion(String serverVersion) throws ProjectConfigurationException { if (!SERVER_VERSIONS.contains(serverVersion)) { throw new ProjectConfigurationException( "Invalid serverVersion '" + serverVersion + "' use one of " + SERVER_VERSIONS, null); } }
/** Task entrypoint : run the devappserver (blocking). */ @TaskAction public void runAction() throws AppEngineException, ProjectConfigurationException { CloudSdk sdk = cloudSdkBuilderFactory.newBuilder(getLogger()).build(); serverHelper.getAppServer(sdk, runConfig).run(runConfig); }
@Test public void testGetAppServer_badValue() { when(run.getServerVersion()).thenReturn("nonsense"); exception.expect(ProjectConfigurationException.class); exception.expectMessage( "Invalid serverVersion 'nonsense' use one of " + DevAppServerHelper.SERVER_VERSIONS); helper.getAppServer(sdk, run); }
@Test public void testGetStopConfiguration_badValue() { when(run.getServerVersion()).thenReturn("nonsense"); exception.expect(ProjectConfigurationException.class); exception.expectMessage( "Invalid serverVersion 'nonsense' use one of " + DevAppServerHelper.SERVER_VERSIONS); helper.getStopConfiguration(run); }
@Test public void testValidator_badValue() { Validator validatorUnderTest = new Validator(); exception.expect(ProjectConfigurationException.class); exception.expectMessage( "Invalid serverVersion 'nonsense' use one of " + DevAppServerHelper.SERVER_VERSIONS); validatorUnderTest.validateServerVersion("nonsense"); }
private void addConfigurationFailure(ProjectInternal project, ProjectStateInternal state, Exception e) { ProjectConfigurationException failure = new ProjectConfigurationException(String.format("A problem occurred configuring %s.", project.getDisplayName()), e); state.executed(failure); }
public void setServerVersion(String serverVersion) throws ProjectConfigurationException { this.serverVersion = serverVersion; }
private void addConfigurationFailure(ProjectInternal project, ProjectStateInternal state, Exception e) { ProjectConfigurationException failure = new ProjectConfigurationException(String.format("A problem occurred configuring %s.", project), e); state.executed(failure); }