private ServerEnvironment generateSimpleEnvironment() { if (environment == null) { environment = new ServerEnvironment(); environment.setId(TESTCASE_ENVIRONMENT_ID); environment.setRepositoryId(TESTCASE_REPOSITORY_ID); } return environment; }
public String createNewServerEnvironmentXML(ServerEnvironment serverEnvironment) throws IllegalArgumentException, IllegalStateException, IOException { serializer = Xml.newSerializer(); writer = new StringWriter(); serializer.setOutput(writer); serializer.startDocument("UTF-8", null); serializer.startTag("", "server-environment"); addName(serverEnvironment.getName()); addIsAutomatic(serverEnvironment.isAutomatic()); serializer.endTag("", "server-environment"); serializer.endDocument(); return writer.toString(); }
private PermissionsData generateWriteablePermissionsForRepository( Repository repository, ServerEnvironment environment) { PermissionsData permissionData = new PermissionsData(); permissionData.setUser(generateUser()); ArrayList<Permission> permissions = new ArrayList<Permission>(); Permission permission = new Permission(); permission.setRepositoryId(repository.getId()); permission.setServerEnvironmentId(environment.getId()); permissions.add(permission); permissionData.setPermissions(permissions); return permissionData; }