<commit_before>import org.powertac.common.Broker
import org.powertac.common.Competition
import org.powertac.common.Product
import org.powertac.common.Timeslot
import org.powertac.common.enumerations.ProductType
import org.powertac.common.Role
import org.powertac.common.BrokerRole

class BootStrap {

  def springSecurityService

  def init = { servletContext ->
    // Create admin role
    def adminRole = Role.findByAuthority('ROLE_ADMIN') ?: new Role(authority: 'ROLE_ADMIN').save(failOnError: true)
    // Create default broker
    def adminUser = Broker.findByUsername('defaultBroker') ?: new Broker(
        username: 'defaultBroker',
        password: <PASSWORD>('password'),
        enabled: true).save(failOnError: true)

    // Add default broker to admin role
    if (!adminUser.authorities.contains(adminRole)) {
      BrokerRole.create adminUser, adminRole
    }

//    def competition = new Competition(name: 'testCompetition').save()
//    new Broker(userName: 'testUser', apiKey: 'testApiKey-which-needs-to-be-longer-than-32-characters').save()
//    //new Product(productType: ProductType.Future).save()
//    new Timeslot(serialNumber: 0).save()

  }
  def destroy = {
  }
}
<commit_msg>Create default competition on startup with broker<commit_after>import org.powertac.common.Broker
import org.powertac.common.Competition
import org.powertac.common.Product
import org.powertac.common.Timeslot
import org.powertac.common.enumerations.ProductType
import org.powertac.common.Role
import org.powertac.common.BrokerRole

class BootStrap {

  def springSecurityService

  def init = { servletContext ->
    // Create admin role
    def adminRole = Role.findByAuthority('ROLE_ADMIN') ?: new Role(authority: 'ROLE_ADMIN').save(failOnError: true)
    // Create default broker
    def adminUser = Broker.findByUsername('defaultBroker') ?: new Broker(
        username: 'defaultBroker',
        password: <PASSWORD>('password'),
        enabled: true).save(failOnError: true)

    // Add default broker to admin role
    if (!adminUser.authorities.contains(adminRole)) {
      BrokerRole.create adminUser, adminRole
    }

    // Create default competition
    def competition = new Competition(name: "defaultCompetition", current: true).save()
    competition.addToBrokers(adminUser);

  }
  def destroy = {
  }
}

{'fraction_non_alphanumeric': 0.11230636833046471, 'fraction_numerical': 0.0012908777969018934, 'mean_word_length': 3.9892703862660945, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '341749', 'n_tokens_mistral': 722, 'n_tokens_neox': 704, 'n_words': 151}