// Path: logging/src/main/java/org/kitesdk/examples/logging/CreateDataset.java
// public class CreateDataset extends Configured implements Tool {
// 
//   @Override
//   public int run(String[] args) throws Exception {
// 
//     // Create a dataset of events with the Avro schema
//     DatasetDescriptor descriptor = new DatasetDescriptor.Builder()
//         .schemaUri("resource:event.avsc")
//         .build();
//     Datasets.create("dataset:hive:/tmp/data/default/events", descriptor);
// 
//     return 0;
//   }
// 
//   public static void main(String... args) throws Exception {
//     int rc = ToolRunner.run(new CreateDataset(), args);
//     System.exit(rc);
//   }
// }
// 
// Path: logging/src/main/java/org/kitesdk/examples/logging/DeleteDataset.java
// public class DeleteDataset extends Configured implements Tool {
// 
//   @Override
//   public int run(String[] args) throws Exception {
// 
//     // Drop the events dataset
//     boolean success = Datasets.delete("dataset:hive:/tmp/data/default/events");
// 
//     return success ? 0 : 1;
//   }
// 
//   public static void main(String... args) throws Exception {
//     int rc = ToolRunner.run(new DeleteDataset(), args);
//     System.exit(rc);
//   }
// }
// 
// Path: logging/src/main/java/org/kitesdk/examples/logging/ReadDataset.java
// public class ReadDataset extends Configured implements Tool {
// 
//   @Override
//   public int run(String[] args) throws Exception {
// 
//     // Load the events dataset
//     Dataset<GenericRecord> events = Datasets.load("dataset:hive:/tmp/data/default/events");
// 
//     // Get a reader for the dataset and read all the events
//     DatasetReader<GenericRecord> reader = events.newReader();
//     try {
//       for (GenericRecord event : reader) {
//         System.out.println(event);
//       }
//     } finally {
//       reader.close();
//     }
// 
//     return 0;
//   }
// 
//   public static void main(String... args) throws Exception {
//     int rc = ToolRunner.run(new ReadDataset(), args);
//     System.exit(rc);
//   }
// }


import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.io.PrintStream;
import org.apache.catalina.core.AprLifecycleListener;
import org.apache.catalina.core.StandardServer;
import org.apache.catalina.startup.Tomcat;
import org.apache.flume.clients.log4jappender.Log4jAppender;
import org.apache.hadoop.util.Tool;
import org.apache.http.client.fluent.Request;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.hamcrest.Matcher;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.kitesdk.examples.logging.CreateDataset;
import org.kitesdk.examples.logging.DeleteDataset;
import org.kitesdk.examples.logging.ReadDataset;
import org.kitesdk.minicluster.FlumeService;
import org.kitesdk.minicluster.HdfsService;
import org.kitesdk.minicluster.HiveService;
import org.kitesdk.minicluster.MiniCluster;
import static org.hamcrest.CoreMatchers.any;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.matchers.JUnitMatchers.containsString;
/**
 * Copyright 2013 Cloudera Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kitesdk.examples.logging.webapp;



public class ITLoggingWebapp {

  @Rule
  public static TemporaryFolder folder = new TemporaryFolder();

  private static MiniCluster cluster;

  private Tomcat tomcat;

  @BeforeClass
  public static void startCluster() throws Exception {
    cluster = new MiniCluster.Builder().workDir("target/kite-minicluster").clean(true)
        .addService(HdfsService.class)
        .addService(HiveService.class)
        .addService(FlumeService.class).flumeAgentName("tier1")
        .flumeConfiguration("resource:flume.properties")
        .build();
    cluster.start();
    Thread.sleep(5000L);
    configureLog4j();
  }

  @Before
  public void setUp() throws Exception {
    try {
      // delete dataset in case it already exists
// Path: logging/src/main/java/org/kitesdk/examples/logging/CreateDataset.java
// public class CreateDataset extends Configured implements Tool {
// 
//   @Override
//   public int run(String[] args) throws Exception {
// 
//     // Create a dataset of events with the Avro schema
//     DatasetDescriptor descriptor = new DatasetDescriptor.Builder()
//         .schemaUri("resource:event.avsc")
//         .build();
//     Datasets.create("dataset:hive:/tmp/data/default/events", descriptor);
// 
//     return 0;
//   }
// 
//   public static void main(String... args) throws Exception {
//     int rc = ToolRunner.run(new CreateDataset(), args);
//     System.exit(rc);
//   }
// }
// 
// Path: logging/src/main/java/org/kitesdk/examples/logging/DeleteDataset.java
// public class DeleteDataset extends Configured implements Tool {
// 
//   @Override
//   public int run(String[] args) throws Exception {
// 
//     // Drop the events dataset
//     boolean success = Datasets.delete("dataset:hive:/tmp/data/default/events");
// 
//     return success ? 0 : 1;
//   }
// 
//   public static void main(String... args) throws Exception {
//     int rc = ToolRunner.run(new DeleteDataset(), args);
//     System.exit(rc);
//   }
// }
// 
// Path: logging/src/main/java/org/kitesdk/examples/logging/ReadDataset.java
// public class ReadDataset extends Configured implements Tool {
// 
//   @Override
//   public int run(String[] args) throws Exception {
// 
//     // Load the events dataset
//     Dataset<GenericRecord> events = Datasets.load("dataset:hive:/tmp/data/default/events");
// 
//     // Get a reader for the dataset and read all the events
//     DatasetReader<GenericRecord> reader = events.newReader();
//     try {
//       for (GenericRecord event : reader) {
//         System.out.println(event);
//       }
//     } finally {
//       reader.close();
//     }
// 
//     return 0;
//   }
// 
//   public static void main(String... args) throws Exception {
//     int rc = ToolRunner.run(new ReadDataset(), args);
//     System.exit(rc);
//   }
// }


// Path: logging-webapp/src/test/java/org/kitesdk/examples/logging/webapp/ITLoggingWebapp.java
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.io.PrintStream;
import org.apache.catalina.core.AprLifecycleListener;
import org.apache.catalina.core.StandardServer;
import org.apache.catalina.startup.Tomcat;
import org.apache.flume.clients.log4jappender.Log4jAppender;
import org.apache.hadoop.util.Tool;
import org.apache.http.client.fluent.Request;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.hamcrest.Matcher;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.kitesdk.examples.logging.CreateDataset;
import org.kitesdk.examples.logging.DeleteDataset;
import org.kitesdk.examples.logging.ReadDataset;
import org.kitesdk.minicluster.FlumeService;
import org.kitesdk.minicluster.HdfsService;
import org.kitesdk.minicluster.HiveService;
import org.kitesdk.minicluster.MiniCluster;
import static org.hamcrest.CoreMatchers.any;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.matchers.JUnitMatchers.containsString;

/**
 * Copyright 2013 Cloudera Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kitesdk.examples.logging.webapp;



public class ITLoggingWebapp {

  @Rule
  public static TemporaryFolder folder = new TemporaryFolder();

  private static MiniCluster cluster;

  private Tomcat tomcat;

  @BeforeClass
  public static void startCluster() throws Exception {
    cluster = new MiniCluster.Builder().workDir("target/kite-minicluster").clean(true)
        .addService(HdfsService.class)
        .addService(HiveService.class)
        .addService(FlumeService.class).flumeAgentName("tier1")
        .flumeConfiguration("resource:flume.properties")
        .build();
    cluster.start();
    Thread.sleep(5000L);
    configureLog4j();
  }

  @Before
  public void setUp() throws Exception {
    try {
      // delete dataset in case it already exists
      run(any(Integer.class), any(String.class), new DeleteDataset());