Ejemplo n.º 1
0
  public void doJob() {
    try {

      // cache the actual connected account
      User actual = User.findByName(userName);
      User clone = (User) actual.clone();

      // reset database
      Fixtures.deleteDatabase();
      Fixtures.loadModels("initial-data.yml");

      // persist the cached account
      clone.save();

      // update channel lists
      List<Channel> channels = Channel.findAll();
      for (Channel channel : channels) {

        // remove the actual and next game
        channel.game = null;
        channel.next = null;
        channel.save();

        // create an event stream
        if (ChannelList.instance.getStream(channel.number) == null) {
          ChannelList.instance.addStream(channel);
        }
      }
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
Ejemplo n.º 2
0
 @Test
 public void testAll() {
   models.Channel channel = new models.Channel();
   channel.title = "All Things v9";
   channel.link = "http://anthonyeden.com/rss.xml";
   channel.description = "Words from Anthony Eden, Founder of DNSimple";
   channel.save();
   Result result =
       callAction(controllers.routes.ref.Channels.all(), new FakeRequest(GET, "/channels"));
   assertThat(status(result)).isEqualTo(OK);
   assertThat(contentType(result)).isEqualTo("application/json");
   assertThat(charset(result)).isEqualTo("utf-8");
   assertThat(contentAsString(result)).contains("Anthony");
 }