예제 #1
0
TEST(AWSProvider, AWSProviderTest)
{
  AWSProvider::serverInstanceTypes();
  AWSProvider awsProvider;

  //awsProvider.serverInstanceTypes();

  //awsProvider.internetAvailable();

  //awsProvider.serviceAvailable();

  //awsProvider.validateCredentials();

  //awsProvider.resourcesAvailableToStart();

 /* awsProvider.setServerInstanceType("t1.micro");
  awsProvider.requestStartServer();
  awsProvider.waitForServer();

  //awsProvider.serverRunning();

  awsProvider.setWorkerInstanceType("t1.micro");
  awsProvider.requestStartWorkers();
  awsProvider.waitForWorkers();
  
  if (awsProvider.warnings().size()) {
    cout << "WARNINGS:" << endl;
    for (const std::string& warning : awsProvider.warnings()) {
      cout << "  " << warning << cout;
    }
  }
  
  if (awsProvider.errors().size()) {
    cout << "ERRORS:" << endl;
    for (const std::string& error : awsProvider.errors()) {
      cout << "  " << error << cout;
    }
  }

  awsProvider.workersRunning();
*/
  boost::optional<AWSSession> awsSession = awsProvider.session().optionalCast<AWSSession>();
  awsSession->totalSessionUptime();

  awsSession->totalSessionInstances();
}
TEST_F(ProjectFixture,CloudSessionRecord_AWSDefault) {
  {
    ProjectDatabase database = getCleanDatabase("CloudSessionRecord_AWSDefault");

    AWSProvider provider;
    CloudSession session = provider.session();

    CloudSessionRecord record = CloudSessionRecord::factoryFromCloudSession(session,database);
    database.save();

    EXPECT_EQ(1u,CloudSessionRecord::getCloudSessionRecords(database).size());
  }
  {
    ProjectDatabase database = getExistingDatabase("CloudSessionRecord_AWSDefault");

    EXPECT_EQ(1u,CloudSessionRecord::getCloudSessionRecords(database).size());
    ASSERT_FALSE(CloudSessionRecord::getCloudSessionRecords(database).empty());

    CloudSessionRecord record = CloudSessionRecord::getCloudSessionRecords(database)[0];

    CloudSession session = record.cloudSession();
    EXPECT_TRUE(session.optionalCast<AWSSession>());
  }
}