コード例 #1
0
  /**
   * Starts the server going for these tests.
   *
   * @throws Exception If problems occur setting up the server.
   */
  @BeforeClass
  public static void setupServer() throws Exception {
    ParallelStressTest.server = Server.newTestInstance();

    ParallelStressTest.adminEmail = server.getServerProperties().get(ADMIN_EMAIL_KEY);
    ParallelStressTest.adminPassword = server.getServerProperties().get(ADMIN_PASSWORD_KEY);

    ParallelStressTest.manager = (DbManager) server.getContext().getAttributes().get("DbManager");
    String adminUserUri = manager.getUser(adminEmail).toUri(server);
    System.out.print("Creating test data...");
    ParallelStressTest.START_TIMESTAMP = Tstamp.makeTimestamp("2010-01-08T00:00:00.000-10:00");
    ParallelStressTest.END_TIMESTAMP = Tstamp.makeTimestamp("2010-02-08T00:00:00.000-10:00");

    SubSources subSources = new SubSources();
    for (int i = 0; i < NUM_SOURCES; i++) {
      Source source = new Source(sourceNames[i], adminUserUri, true);
      source.addProperty(new Property(Source.SUPPORTS_ENERGY_COUNTERS, "true"));
      sources[i] = source;
      sourceURIs[i] = source.toUri(server);
      subSources.getHref().add(sourceURIs[i]);
      ParallelStressTest.manager.storeSource(source);
    }
    ParallelStressTest.virtualSource =
        new Source(source11Name, adminUserUri, true, true, "", "", "", null, subSources);
    ParallelStressTest.manager.storeSource(virtualSource);

    Date testStart = new Date();
    parallelLoad(TEST_CLIENTS, START_TIMESTAMP, END_TIMESTAMP, 15);
    Date testEnd = new Date();
    double msElapsed = testEnd.getTime() - testStart.getTime();
    System.out.format("Time to insert data: %.1f ms%n", msElapsed);
  }
コード例 #2
0
ファイル: SourceRef.java プロジェクト: Moruthane/wattdepot
 /**
  * Creates a SourceRef object from a Source object. The Server argument is required to build the
  * URI in the SourceRef pointing to the full Source resource.
  *
  * @param source The Source to build the SourceRef from.
  * @param server The Server where the Source is located.
  */
 public SourceRef(Source source, Server server) {
   this(source, server.getHostName() + Server.SOURCES_URI + "/" + source.getName());
 }
コード例 #3
0
ファイル: SourceRef.java プロジェクト: Moruthane/wattdepot
 /**
  * Sets the value of the href property based on the name and Server provided.
  *
  * @param name The name of the Source.
  * @param server The Server this object belongs to.
  */
 public void setHref(String name, Server server) {
   this.href = server.getHostName() + Server.SOURCES_URI + "/" + name;
 }