Exemplo n.º 1
0
 public void setUpCharacters() {
   transportExecutor.exec(
       "create table characters (id int primary key, name string, female boolean, details object)");
   transportExecutor.ensureGreen();
   transportExecutor.execBulk(
       "insert into characters (id, name, female) values (?, ?, ?)",
       new Object[][] {
         new Object[] {1, "Arthur", false},
         new Object[] {2, "Ford", false},
         new Object[] {3, "Trillian", true},
         new Object[] {4, "Arthur", true}
       });
   transportExecutor.refresh("characters");
 }
Exemplo n.º 2
0
 public void setUpPartitionedTableWithName() {
   transportExecutor.exec(
       "create table parted (id int, name string, date timestamp) partitioned by (date)");
   transportExecutor.ensureGreen();
   transportExecutor.execBulk(
       "insert into parted (id, name, date) values (?, ?, ?)",
       new Object[][] {
         {1, "Trillian", null},
         {2, null, 0L},
         {3, "Ford", 1396388720242L}
       });
   transportExecutor.ensureGreen();
   transportExecutor.refresh("parted");
 }
Exemplo n.º 3
0
  public void setUpLocations() throws Exception {
    transportExecutor.exec(
        "create table locations ("
            + " id string primary key,"
            + " name string,"
            + " date timestamp,"
            + " kind string,"
            + " position integer,"
            + " description string,"
            + " race object,"
            + " index name_description_ft using fulltext(name, description) with (analyzer='english')"
            + ") clustered by(id) into 2 shards with(number_of_replicas=0)");

    String insertStmt =
        "insert into locations "
            + "(id, name, date, kind, position, description, race) "
            + "values (?, ?, ?, ?, ?, ?, ?)";
    Object[][] rows =
        new Object[][] {
          new Object[] {
            "1",
            "North West Ripple",
            "1979-10-12",
            "Galaxy",
            1,
            "Relative to life on NowWhat, living on an affluent "
                + "world in the North West ripple of the Galaxy is said to be easier "
                + "by a factor of about seventeen million.",
            null
          },
          new Object[] {
            "2",
            "Outer Eastern Rim",
            "1979-10-12",
            "Galaxy",
            2,
            "The Outer Eastern Rim "
                + "of the Galaxy where the Guide has supplanted the Encyclopedia Galactica "
                + "among its more relaxed civilisations.",
            null
          },
          new Object[] {
            "3",
            "Galactic Sector QQ7 Active J Gamma",
            "2013-05-01",
            "Galaxy",
            4,
            "Galactic Sector QQ7 Active J Gamma contains the Sun Zarss, "
                + "the planet Preliumtarn of the famed Sevorbeupstry and "
                + "Quentulus Quazgar Mountains.",
            null
          },
          new Object[] {
            "4",
            "Aldebaran",
            "2013-07-16",
            "Star System",
            1,
            "Max Quordlepleen claims that the only thing left after the end "
                + "of the Universe will be the sweets trolley and a fine selection "
                + "of Aldebaran liqueurs.",
            null
          },
          new Object[] {
            "5",
            "Algol",
            "2013-07-16",
            "Star System",
            2,
            "Algol is the home of the Algolian Suntiger, "
                + "the tooth of which is one of the ingredients of the "
                + "Pan Galactic Gargle Blaster.",
            null
          },
          new Object[] {
            "6",
            "Alpha Centauri",
            "1979-10-12",
            "Star System",
            3,
            "4.1 light-years northwest of earth",
            null
          },
          new Object[] {
            "7",
            "Altair",
            "2013-07-16",
            "Star System",
            4,
            "The Altairian dollar is one of three freely convertible currencies in the galaxy, "
                + "though by the time of the novels it had apparently recently collapsed.",
            null
          },
          new Object[] {
            "8",
            "Allosimanius Syneca",
            "2013-07-16",
            "Planet",
            1,
            "Allosimanius Syneca is a planet noted for ice, snow, "
                + "mind-hurtling beauty and stunning cold.",
            null
          },
          new Object[] {
            "9",
            "Argabuthon",
            "2013-07-16",
            "Planet",
            2,
            "It is also the home of Prak, a man placed into solitary confinement "
                + "after an overdose of truth drug caused him to tell the Truth in its absolute "
                + "and final form, causing anyone to hear it to go insane.",
            null,
          },
          new Object[] {
            "10",
            "Arkintoofle Minor",
            "1979-10-12",
            "Planet",
            3,
            "Motivated by the fact that the only thing in the Universe that "
                + "travels faster than light is bad news, the Hingefreel people native "
                + "to Arkintoofle Minor constructed a starship driven by bad news.",
            null
          },
          new Object[] {
            "11",
            "Bartledan",
            "2013-07-16",
            "Planet",
            4,
            "An Earthlike planet on which Arthur Dent lived for a short time, "
                + "Bartledan is inhabited by Bartledanians, a race that appears human but only physically.",
            new HashMap<String, Object>() {
              {
                put("name", "Bartledannians");
                put("description", "Similar to humans, but do not breathe");
                put("interests", "netball");
              }
            }
          },
          new Object[] {
            "12", "", "2013-07-16", "Planet", 5, "This Planet doesn't really exist", null
          },
          new Object[] {
            "13", "End of the Galaxy", "2013-07-16", "Galaxy", 6, "The end of the Galaxy.%", null
          }
        };
    transportExecutor.execBulk(insertStmt, rows);
  }