Some issues fixed for ios app upload and logs added, readme modified with new usernames

application-manager-new
susinda 8 years ago
parent 816657a117
commit ba7a9c2f45

@ -5,3 +5,6 @@
3. Then execute the copy-files.sh script 3. Then execute the copy-files.sh script
4. Start the WSO2 IoTS server 4. Start the WSO2 IoTS server
5. Once server is started execute the mobile-qsg.sh script 5. Once server is started execute the mobile-qsg.sh script
6. Then login to the https://<your-server>:9443/devicemgt/ and use the username,password as alex alex@IoTS, Note that for this sample we have configured above user from the script. If you want to run this script again you have to login as admin and remove the user alex, chris and role iotMobileUser from the IoT Server.

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

@ -3,3 +3,4 @@
echo "Starting wso2iots-3.0.0 QSG setup ..." echo "Starting wso2iots-3.0.0 QSG setup ..."
java -jar "mobile-qsg.jar" java -jar "mobile-qsg.jar"
echo "wso2iots-3.0.0 QSG setup completed."

@ -165,7 +165,7 @@ public class AppOperations {
application.put("provider", "admin"); application.put("provider", "admin");
application.put("displayName", name); application.put("displayName", name);
application.put("category", "Business"); application.put("category", "Business");
application.put("iconFile", mblApp.getIcon()); application.put("thumbnailUrl", mblApp.getIcon());
application.put("version", mblApp.getVersion()); application.put("version", mblApp.getVersion());
application.put("banner", mblApp.getBanner()); application.put("banner", mblApp.getBanner());
application.put("platform", mblApp.getPlatform()); application.put("platform", mblApp.getPlatform());

@ -30,12 +30,12 @@ import java.util.*;
*/ */
public class QSGExecutor { public class QSGExecutor {
private static String iotAdminUser= "milan"; private static String iotAdminUser= "chris";
private static String iotAdminPassword = "milan@IoTS"; private static String iotAdminPassword = "chris@IoTS";
private static String iotAdminEmail = "milan@mobx.com"; private static String iotAdminEmail = "chris@mobx.com";
private static String iotMobileUser = "ryan"; private static String iotMobileUser = "alex";
private static String iotMobileUserPassword = "ryan@IoTS"; private static String iotMobileUserPassword = "alex@IoTS";
private static String roleName = "iotMobileUser"; private static String roleName = "iotMobileUser";
public static void main(String[] args) { public static void main(String[] args) {
@ -53,7 +53,7 @@ public class QSGExecutor {
} while (!QSGUtils.isValidEmailAddress(email)); } while (!QSGUtils.isValidEmailAddress(email));
} }
*/ */
String email = "ryan@example.com"; String email = "alex@example.com";
//Setup the OAuth token //Setup the OAuth token
String token = QSGUtils.getOAuthToken(); String token = QSGUtils.getOAuthToken();
@ -64,6 +64,7 @@ public class QSGExecutor {
HTTPInvoker.oAuthToken = token; HTTPInvoker.oAuthToken = token;
//Creates the admin user //Creates the admin user
System.out.println("Creating users ");
status = UserOperations.createUser(iotAdminUser, iotAdminEmail, true); status = UserOperations.createUser(iotAdminUser, iotAdminEmail, true);
if (!status) { if (!status) {
System.out.println("Unable to create the admin user. Please check the config.properties file."); System.out.println("Unable to create the admin user. Please check the config.properties file.");
@ -91,11 +92,14 @@ public class QSGExecutor {
} }
//Creates the emm-user role //Creates the emm-user role
System.out.println("Creating iotMobileUser role");
status = UserOperations.createRole(roleName, new String[] {iotMobileUser}); status = UserOperations.createRole(roleName, new String[] {iotMobileUser});
if (!status) { if (!status) {
System.out.println("Unable to create the emm user role. Terminating the IoTs QSG now."); System.out.println("Unable to create the emm user role. Terminating the IoTs QSG now.");
System.exit(0); System.exit(0);
} }
System.out.println("Adding sample policies ");
//Add the android policy //Add the android policy
status = PolicyOperations.createPasscodePolicy("android-passcode-policy1", Constants.DeviceType.ANDROID); status = PolicyOperations.createPasscodePolicy("android-passcode-policy1", Constants.DeviceType.ANDROID);
if (!status) { if (!status) {
@ -114,6 +118,8 @@ public class QSGExecutor {
System.out.println("Unable to create the ios passcode policy. Terminating the IoTS QSG now."); System.out.println("Unable to create the ios passcode policy. Terminating the IoTS QSG now.");
System.exit(0); System.exit(0);
} }
System.out.println("Upload the android application ");
//Upload the android application //Upload the android application
MobileApplication application = AppOperations.uploadApplication(Constants.DeviceType.ANDROID, "catalog.apk", MobileApplication application = AppOperations.uploadApplication(Constants.DeviceType.ANDROID, "catalog.apk",
"application/vnd.android.package-archive"); "application/vnd.android.package-archive");
@ -128,6 +134,8 @@ public class QSGExecutor {
"Unable to upload the assets for sample android application. Terminating the IoTS QSG now."); "Unable to upload the assets for sample android application. Terminating the IoTS QSG now.");
System.exit(0); System.exit(0);
} }
System.out.println("Create the android application ");
//Create application entry in publisher //Create application entry in publisher
status = AppOperations.addApplication("Catalog", application, true); status = AppOperations.addApplication("Catalog", application, true);
if (!status) { if (!status) {
@ -135,6 +143,7 @@ public class QSGExecutor {
System.exit(0); System.exit(0);
} }
System.out.println("Upload the iOS application ");
//Upload the ios application //Upload the ios application
MobileApplication iOSApplication = AppOperations.uploadApplication(Constants.DeviceType.IOS, "PNDemo.ipa","application/octet-stream"); MobileApplication iOSApplication = AppOperations.uploadApplication(Constants.DeviceType.IOS, "PNDemo.ipa","application/octet-stream");
iOSApplication.setVersion("1.0.0"); iOSApplication.setVersion("1.0.0");
@ -145,11 +154,15 @@ public class QSGExecutor {
"Unable to upload the assets for sample iOS application. Terminating the IoTS QSG now."); "Unable to upload the assets for sample iOS application. Terminating the IoTS QSG now.");
System.exit(0); System.exit(0);
} }
System.out.println("Create the iOS application ");
//Create application entry in publisher //Create application entry in publisher
status = AppOperations.addApplication("WSO2Con", iOSApplication, true); status = AppOperations.addApplication("WSO2Con", iOSApplication, true);
if (!status) { if (!status) {
System.out.println("Unable to create the iOS mobile application. Terminating the IoTS QSG now."); System.out.println("Unable to create the iOS mobile application. Terminating the IoTS QSG now.");
System.exit(0); System.exit(0);
} }
System.out.println("Exit");
} }
} }

@ -42,11 +42,11 @@ public class UserOperations {
JSONArray roles = new JSONArray(); JSONArray roles = new JSONArray();
if (isAdmin) { if (isAdmin) {
roles.add("admin"); roles.add("admin");
userData.put("firstname", "Milan"); userData.put("firstname", "Chris");
userData.put("lastname", "Admin"); userData.put("lastname", "Admin");
} else { } else {
userData.put("password", "kimemmtrial"); userData.put("password", "kimemmtrial");
userData.put("firstname", "Ryan"); userData.put("firstname", "Alex");
userData.put("lastname", "User"); userData.put("lastname", "User");
} }
userData.put("roles", roles); userData.put("roles", roles);
@ -84,6 +84,7 @@ public class UserOperations {
"/permission/admin/device-mgt/configurations/view," + "/permission/admin/device-mgt/configurations/view," +
"/permission/admin/device-mgt/api," + "/permission/admin/device-mgt/api," +
"/permission/admin/device-mgt/devices/enroll," + "/permission/admin/device-mgt/devices/enroll," +
"/permission/admin/device-mgt/devices/any-device," +
"/permission/admin/device-mgt/devices/enroll/android," + "/permission/admin/device-mgt/devices/enroll/android," +
"/permission/admin/device-mgt/devices/enroll/ios," + "/permission/admin/device-mgt/devices/enroll/ios," +
"/permission/admin/device-mgt/devices/owning-device/view," + "/permission/admin/device-mgt/devices/owning-device/view," +

@ -111,7 +111,7 @@ public class QSGUtils {
urlParameters.add(new BasicNameValuePair("grant_type", "password")); urlParameters.add(new BasicNameValuePair("grant_type", "password"));
urlParameters.add(new BasicNameValuePair("scope", urlParameters.add(new BasicNameValuePair("scope",
"user:view user:manage user:admin:reset-password role:view role:manage policy:view policy:manage " + "user:view user:manage user:admin:reset-password role:view role:manage policy:view policy:manage " +
"application:manage appm:create appm:publish appm:update appm:read")); "application:manage appm:administration appm:create appm:publish appm:update appm:read"));
//Set the headers //Set the headers
headers.put(Constants.Header.CONTENT_TYPE, Constants.ContentType.APPLICATION_URL_ENCODED); headers.put(Constants.Header.CONTENT_TYPE, Constants.ContentType.APPLICATION_URL_ENCODED);
headers.put(Constants.Header.AUTH, authHeader); headers.put(Constants.Header.AUTH, authHeader);

Loading…
Cancel
Save