/v3.2/nimbits-sdk/test/UserTest.java

http://nimbits-server.googlecode.com/ · Java · 81 lines · 43 code · 18 blank · 20 comment · 1 complexity · f89f0ab7bbbfabc5574021965f7da2df MD5 · raw file

  1. /*
  2. * Copyright (c) 2010 Tonic Solutions LLC.
  3. *
  4. * http://www.nimbits.com
  5. *
  6. *
  7. * Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
  8. *
  9. * http://www.gnu.org/licenses/gpl.html
  10. *
  11. * 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.
  12. */
  13. import com.nimbits.client.model.Const;
  14. import com.nimbits.client.model.category.CategoryName;
  15. import com.nimbits.client.model.common.CommonFactoryLocator;
  16. import com.nimbits.client.model.point.PointName;
  17. import com.nimbits.client.model.user.User;
  18. import org.junit.Assert;
  19. import org.junit.Ignore;
  20. import org.junit.Test;
  21. import java.io.IOException;
  22. import java.util.List;
  23. /**
  24. * Created by bsautner
  25. * User: benjamin
  26. * Date: 6/24/11
  27. * Time: 2:44 PM
  28. */
  29. public class UserTest {
  30. @Test
  31. public void testGetAllUsersQA() {
  32. List<User> users = Common.authOnQA().getUsers();
  33. Assert.assertNotNull(users);
  34. Assert.assertTrue(users.size() > 1);
  35. System.out.println(users.size());
  36. }
  37. @Test
  38. public void testGetAllUsersProd() {
  39. List<User> users = Common.specificVersion().getUsers();
  40. Assert.assertNotNull(users);
  41. Assert.assertTrue(users.size() > 1);
  42. }
  43. @Test
  44. @Ignore
  45. public void countUsersTest() throws IOException {
  46. List<User> users = Common.specificVersion().getUsers();
  47. Assert.assertNotNull(users);
  48. Assert.assertTrue(users.size() > 1);
  49. System.out.println(users.size());
  50. System.out.println(Common.meOnProd().isLoggedIn());
  51. PointName pointName = (PointName) CommonFactoryLocator.getInstance().createPointName("usercount");
  52. Common.meOnProd().deletePoint(pointName);
  53. CategoryName cat = CommonFactoryLocator.getInstance().createCategoryName(Const.CONST_HIDDEN_CATEGORY);
  54. Common.meOnProd().addPoint(cat, pointName);
  55. double i = 0.0;
  56. for (User u : users) {
  57. i++;
  58. System.out.println(u.getEmail() + " " + u.getDateCreated());
  59. // double prev = Double.valueOf(Common.meOnProd().currentValue("usercount"));
  60. // Common.meOnProd().recordValue(pointName, i, u.getDateCreated());
  61. }
  62. }
  63. }