This repository has been archived by the owner on Apr 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ajay Kannan
committed
Jan 6, 2016
1 parent
e5a4917
commit 581866c
Showing
10 changed files
with
336 additions
and
413 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...test-app/src/main/java/com/google/gcloud/tests/commandline/GcloudJavaCommandLineTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright 2015 Google Inc. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.google.gcloud.tests.commandline; | ||
|
||
import static com.google.gcloud.tests.ServiceTests.SUPPORTED_SERVICES; | ||
import static com.google.gcloud.tests.ServiceTests.runAction; | ||
|
||
import com.google.gcloud.AuthCredentials; | ||
|
||
import java.io.FileInputStream; | ||
import java.io.IOException; | ||
import java.io.PrintWriter; | ||
import java.util.Arrays; | ||
|
||
public class GcloudJavaCommandLineTest { | ||
public static void main(String[] args) throws IOException { | ||
PrintWriter pw = new PrintWriter(System.out, true); | ||
String projectId = null; | ||
AuthCredentials credentials = null; | ||
if (args.length == 0) { | ||
pw.println("Must specify a service to test as the first command line argument. Options are: " | ||
+ SUPPORTED_SERVICES.toString()); | ||
} else { | ||
for (String arg : Arrays.copyOfRange(args, 1, args.length)) { | ||
String[] argInfo = arg.split("="); | ||
switch (argInfo[0]) { | ||
case "project-id": | ||
projectId = argInfo.length > 1 ? argInfo[1] : null; | ||
break; | ||
case "credentials-file": | ||
credentials = AuthCredentials.createForJson( | ||
new FileInputStream("my-service-account-credentials.json")); | ||
break; | ||
default: | ||
pw.println("Unrecognized optional argument " + arg + ". Acceptable optional " | ||
+ "arguments are 'project-id=[your-project-id]' and " | ||
+ "'credentials-file=[true|false]'"); | ||
} | ||
} | ||
runAction(args[0], pw, projectId, credentials); | ||
} | ||
} | ||
} |
Oops, something went wrong.