text: /*! grafana - v2.5.0 - 2015-10-28
   * Copyright (c) 2015 Torkel Ödegaard; Licensed Apache-2.0 */
  
  define(["require","exports","app/plugins/datasource/influxdb_08/influx_series","test/lib/common"],function(a,b,c,d){d.describe("when generating timeseries from influxdb response",function(){d.describe("given two series",function(){var a=new c({seriesList:[{columns:["time","mean","sequence_number"],name:"prod.server1.cpu",points:[[1402596e3,10,1],[1402596001,12,2]]},{columns:["time","mean","sequence_number"],name:"prod.server2.cpu",points:[[1402596e3,15,1],[1402596001,16,2]]}]}),b=a.getTimeSeries();d.it("should generate two time series",function(){d.expect(b.length).to.be(2),d.expect(b[0].target).to.be("prod.server1.cpu.mean"),d.expect(b[0].datapoints[0][0]).to.be(10),d.expect(b[0].datapoints[0][1]).to.be(1402596e3),d.expect(b[0].datapoints[1][0]).to.be(12),d.expect(b[0].datapoints[1][1]).to.be(1402596001),d.expect(b[1].target).to.be("prod.server2.cpu.mean"),d.expect(b[1].datapoints[0][0]).to.be(15),d.expect(b[1].datapoints[0][1]).to.be(1402596e3),d.expect(b[1].datapoints[1][0]).to.be(16),d.expect(b[1].datapoints[1][1]).to.be(1402596001)})}),d.describe("given an alias format",function(){var a=new c({seriesList:[{columns:["time","mean","sequence_number"],name:"prod.server1.cpu",points:[[1402596e3,10,1],[1402596001,12,2]]}],alias:"$s.testing"}),b=a.getTimeSeries();d.it("should generate correct series name",function(){d.expect(b[0].target).to.be("prod.server1.cpu.testing")})}),d.describe("given an alias format with segment numbers",function(){var a=new c({seriesList:[{columns:["time","mean","sequence_number"],name:"prod.server1.cpu",points:[[1402596e3,10,1],[1402596001,12,2]]}],alias:"$1.mean"}),b=a.getTimeSeries();d.it("should generate correct series name",function(){d.expect(b[0].target).to.be("server1.mean")})}),d.describe("given an alias format and many segments",function(){var a=new c({seriesList:[{columns:["time","mean","sequence_number"],name:"a0.a1.a2.a3.a4.a5.a6.a7.a8.a9.a10.a11.a12",points:[[1402596e3,10,1],[1402596001,12,2]]}],alias:"$5.$11.mean"}),b=a.getTimeSeries();d.it("should generate correct series name",function(){d.expect(b[0].target).to.be("a5.a11.mean")})}),d.describe("given an alias format with group by field",function(){var a=new c({seriesList:[{columns:["time","mean","host"],name:"prod.cpu",points:[[1402596e3,10,"A"]]}],groupByField:"host",alias:"$g.$1"}),b=a.getTimeSeries();d.it("should generate correct series name",function(){d.expect(b[0].target).to.be("A.cpu")})}),d.describe("given group by column",function(){var a=new c({seriesList:[{columns:["time","mean","host"],name:"prod.cpu",points:[[1402596e3,10,"A"],[1402596001,11,"A"],[1402596e3,5,"B"],[1402596001,6,"B"]]}],groupByField:"host"}),b=a.getTimeSeries();d.it("should generate two time series",function(){d.expect(b.length).to.be(2),d.expect(b[0].target).to.be("prod.cpu.A"),d.expect(b[0].datapoints[0][0]).to.be(10),d.expect(b[0].datapoints[0][1]).to.be(1402596e3),d.expect(b[0].datapoints[1][0]).to.be(11),d.expect(b[0].datapoints[1][1]).to.be(1402596001),d.expect(b[1].target).to.be("prod.cpu.B"),d.expect(b[1].datapoints[0][0]).to.be(5),d.expect(b[1].datapoints[0][1]).to.be(1402596e3),d.expect(b[1].datapoints[1][0]).to.be(6),d.expect(b[1].datapoints[1][1]).to.be(1402596001)})})}),d.describe("when creating annotations from influxdb response",function(){d.describe("given column mapping for all columns",function(){var a=new c({seriesList:[{columns:["time","text","sequence_number","title","tags"],name:"events1",points:[[1402596e6,"some text",1,"Hello","B"],[1402596001e3,"asd",2,"Hello2","B"]]}],annotation:{query:"select",titleColumn:"title",tagsColumn:"tags",textColumn:"text"}}),b=a.getAnnotations();d.it(" should generate 2 annnotations ",function(){d.expect(b.length).to.be(2),d.expect(b[0].annotation.query).to.be("select"),d.expect(b[0].title).to.be("Hello"),d.expect(b[0].time).to.be(1402596e6),d.expect(b[0].tags).to.be("B"),d.expect(b[0].text).to.be("some text")})}),d.describe("given no column mapping",function(){var a=new c({seriesList:[{columns:["time","text","sequence_number"],name:"events1",points:[[1402596e6,"some text",1]]}],annotation:{query:"select"}}),b=a.getAnnotations();d.it("should generate 1 annnotation",function(){d.expect(b.length).to.be(1),d.expect(b[0].title).to.be("some text"),d.expect(b[0].time).to.be(1402596e6),d.expect(b[0].tags).to.be(void 0),d.expect(b[0].text).to.be(void 0)})})})});