@@ -61,6 +61,7 @@ using datastax::internal::core::ClusterMetadataResolver;
6161using datastax::internal::core::ClusterSettings;
6262using datastax::internal::core::Config;
6363using datastax::internal::core::HttpClient;
64+ using datastax::internal::enterprise::DsePlainTextAuthProvider;
6465using datastax::internal::json::StringBuffer;
6566using datastax::internal::json::Writer;
6667
@@ -121,6 +122,10 @@ class CloudSecureConnectionConfigTest : public HttpTest {
121122 int port = 1443 ) {
122123 Writer<StringBuffer> writer (buffer);
123124 writer.StartObject ();
125+ writer.Key (" username" );
126+ writer.String (" DataStax" );
127+ writer.Key (" password" );
128+ writer.String (" Constellation" );
124129 writer.Key (" host" );
125130 writer.String (host.c_str ());
126131 writer.Key (" port" );
@@ -166,6 +171,8 @@ TEST_F(CloudSecureConnectionConfigTest, CredsV1) {
166171 create_zip_file (buffer.GetString ());
167172
168173 EXPECT_TRUE (cloud_config.load (creds_zip_file (), &config));
174+ EXPECT_EQ (" DataStax" , cloud_config.username ());
175+ EXPECT_EQ (" Constellation" , cloud_config.password ());
169176 EXPECT_EQ (" cloud.datastax.com" , cloud_config.host ());
170177 EXPECT_EQ (1443 , cloud_config.port ());
171178 EXPECT_EQ (" database_as_a_service" , cloud_config.keyspace ());
@@ -174,6 +181,7 @@ TEST_F(CloudSecureConnectionConfigTest, CredsV1) {
174181 EXPECT_EQ (key (), cloud_config.key ());
175182
176183 EXPECT_TRUE (config.ssl_context ());
184+ EXPECT_TRUE (dynamic_cast <DsePlainTextAuthProvider*>(config.auth_provider ().get ()) != NULL );
177185}
178186
179187TEST_F (CloudSecureConnectionConfigTest, CredsV1WithoutCreds) {
@@ -193,6 +201,8 @@ TEST_F(CloudSecureConnectionConfigTest, CredsV1WithoutCreds) {
193201 create_zip_file (buffer.GetString ());
194202
195203 EXPECT_TRUE (cloud_config.load (creds_zip_file (), &config));
204+ EXPECT_EQ (" " , cloud_config.username ());
205+ EXPECT_EQ (" " , cloud_config.password ());
196206 EXPECT_EQ (" bigdata.datastax.com" , cloud_config.host ());
197207 EXPECT_EQ (2443 , cloud_config.port ());
198208 EXPECT_EQ (" datastax" , cloud_config.keyspace ());
@@ -201,6 +211,8 @@ TEST_F(CloudSecureConnectionConfigTest, CredsV1WithoutCreds) {
201211 EXPECT_EQ (key (), cloud_config.key ());
202212
203213 EXPECT_TRUE (config.ssl_context ());
214+ EXPECT_TRUE (dynamic_cast <DsePlainTextAuthProvider*>(config.auth_provider ().get ()) ==
215+ NULL ); // Not configured
204216}
205217
206218TEST_F (CloudSecureConnectionConfigTest, InvalidCredsV1ConfigMissingHost) {
@@ -209,6 +221,10 @@ TEST_F(CloudSecureConnectionConfigTest, InvalidCredsV1ConfigMissingHost) {
209221 StringBuffer buffer;
210222 Writer<StringBuffer> writer (buffer);
211223 writer.StartObject ();
224+ writer.Key (" username" );
225+ writer.String (" DataStax" );
226+ writer.Key (" password" );
227+ writer.String (" Constellation" );
212228 writer.Key (" port" );
213229 writer.Int (1443 );
214230 writer.Key (" keyspace" );
@@ -225,6 +241,10 @@ TEST_F(CloudSecureConnectionConfigTest, InvalidCredsV1ConfigMissingPort) {
225241 StringBuffer buffer;
226242 Writer<StringBuffer> writer (buffer);
227243 writer.StartObject ();
244+ writer.Key (" username" );
245+ writer.String (" DataStax" );
246+ writer.Key (" password" );
247+ writer.String (" Constellation" );
228248 writer.Key (" host" );
229249 writer.String (" cloud.datastax.com" );
230250 writer.Key (" keyspace" );
@@ -241,6 +261,10 @@ TEST_F(CloudSecureConnectionConfigTest, InvalidCredsV1ConfigMissingKeyspace) {
241261 StringBuffer buffer;
242262 Writer<StringBuffer> writer (buffer);
243263 writer.StartObject ();
264+ writer.Key (" username" );
265+ writer.String (" DataStax" );
266+ writer.Key (" password" );
267+ writer.String (" Constellation" );
244268 writer.Key (" host" );
245269 writer.String (" cloud.datastax.com" );
246270 writer.Key (" port" );
0 commit comments