Hello, I really need help on this Group Settings issue. We've provided a unit test and responses, but if there is anything else we can provide then please let us know and we'll do it straight away.
Regards, David On Mar 28, 9:28 pm, David Hardwick <[email protected]> wrote: > Hello, > > We have Group Setting enabled for a Group Settings project that is > servicing multiple domains. Out of our four test domains, three are > working but for one domain it is not (of course, wouldn't you know it, the > domain it is not working for is our test domain we use for automated > testing!) > > However, we have additional concerns since this could happen for other > domains, and so far we only have a 75% success rate. > > Below is an example a unit test for bc.com and testc8l.com (NOTE, not the > real domains, the real domains were elided to protect the innocent!). The > request and response is included as comments within the unit tests. > > As described earlier, these two domains, having tokens of exactly the same > scope, respond entirely differently for no apparent reason. bc.com allows > group settings access and testc8l.com throws a 401. > > HELP! > > public class GroupSettingsTest { > private String goodAdminEmail = "[email protected]"; > private String goodToken = Constants.GOOD_TOKEN; > private String goodRefreshToken = Constants.GOOD_REFRESH_TOKEN; > private String goodDomain = "bc.com"; > private String goodGroupId = "[email protected]"; > private String badAdminEmail = "[email protected]"; > private String badToken = Constants.BAD_TOKEN; > private String badRefreshToken = Constants.BAD_REFRESH_TOKEN; > private String badDomain = "testc8l.com"; > private String badGroupId = "[email protected]"; > private LocalServiceTestHelper helper; > private OAuth2Service oAuth2Service; > private GroupsService groupsService; > @Before > public void setUp() throws Exception{ > helper = new LocalServiceTestHelper(new LocalURLFetchServiceTestConfig()); > helper.setUp(); > Injector inj = Guice.createInjector(new GuiceGoogleServicesModule(), new > GuiceModule(),new MockFPGuiceSessionModule()); > oAuth2Service = inj.getInstance(OAuth2Service.class); > groupsService = inj.getInstance(GroupsService.class); > // refresh both tokens. both tokens have the same scope and provisioning > api is enabled for both > goodToken = oAuth2Service.refreshAccessToken("localhost", goodToken, > goodRefreshToken); > badToken = oAuth2Service.refreshAccessToken("localhost", badToken, > badRefreshToken); > // capture http request and respsonse > Logger logger = Logger.getLogger("com.google.api.client"); > logger.setLevel(Level.FINER); > logger.addHandler(new Handler() { > > @Override > public void close() throws SecurityException { > > } > > @Override > public void flush() { > > } > > @Override > public void publish(LogRecord record) { > if (record.getLevel().intValue() < Level.INFO.intValue()) { > System.out.println(record.getMessage());} > } > > }); > } > @Test > public void testGoodDomainCanRetrieveSettings() throws Exception{ > GroupsSettingsEntry entry = > groupsService.getGroupSettingsEntry(GroupsSettingsUrl.forGetGroupSettingsEn > try(goodGroupId), > goodToken, goodAdminEmail); > Assert.assertNotNull(entry); > Assert.assertEquals(goodGroupId,entry.getEmail()); > /* > -------------- REQUEST -------------- > GET https://www.googleapis.com/groups/v1/[email protected]?alt=json > Accept-Encoding: gzip > Authorization: <Not Logged> > GData-Version: v1 > User-Agent: fp Google-HTTP-Java-Client/1.6.0-beta (gzip) > -------------- RESPONSE -------------- > 200 > Expires: Wed, 28 Mar 2012 14:31:58 GMT > Date: Wed, 28 Mar 2012 14:31:58 GMT > Cache-Control: private, max-age=0, must-revalidate, no-transform > ETag: "j4AmYRiK3XvwemHZQtB25t0i4Ak/YGWPqVp-Way1XMXRRKm5jpaiHk4" > Content-Type: application/json; charset=UTF-8 > Content-Encoding: gzip > X-Content-Type-Options: nosniff > X-Frame-Options: SAMEORIGIN > X-XSS-Protection: 1; mode=block > Content-Length: 454 > Server: GSE > Response size: 454 bytes > { > "kind": "groupsSettings#groups", > "email": "[email protected]", > "name": "fp", > "description": "fp support and development team", > "whoCanJoin": "CAN_REQUEST_TO_JOIN", > "whoCanViewMembership": "ALL_MEMBERS_CAN_VIEW", > "whoCanViewGroup": "ALL_MEMBERS_CAN_VIEW", > "whoCanInvite": "ALL_MANAGERS_CAN_INVITE", > "allowExternalMembers": "false", > "whoCanPostMessage": "ANYONE_CAN_POST", > "allowWebPosting": "true", > "maxMessageBytes": 5242880, > "isArchived": "true", > "archiveOnly": "false", > "messageModerationLevel": "MODERATE_NONE", > "replyTo": "REPLY_TO_IGNORE", > "customReplyTo": "", > "sendMessageDenyNotification": "false", > "defaultMessageDenyNotificationText": "", > "showInGroupDirectory": "false", > "allowGoogleCommunication": "false", > "membersCanPostAsTheGroup": "false", > "messageDisplayFont": "DEFAULT_FONT"} > > */ > } > @Test > public void testBadDomainCanNotRetrieveSettings() throws Exception{ > GroupsSettingsEntry entry = null; > boolean exceptionThrown = false; > try{ > entry = > groupsService.getGroupSettingsEntry(GroupsSettingsUrl.forGetGroupSettingsEn > try(badGroupId), > badToken, badAdminEmail); > }catch(Exception e){ > exceptionThrown = true;} > > Assert.assertTrue(exceptionThrown); > Assert.assertNull(entry); > /* > -------------- REQUEST -------------- > GET https://www.googleapis.com/groups/v1/groups/[email protected]?alt=json > Accept-Encoding: gzip > Authorization: <Not Logged> > GData-Version: v1 > User-Agent: fp Google-HTTP-Java-Client/1.6.0-beta (gzip) > > -------------- RESPONSE -------------- > 401 > WWW-Authenticate: AuthSub > realm="https://www.google.com/accounts/AuthSubRequest" > allowed-scopes="https://www.googleapis.com/auth/apps.groups.settings" > Content-Type: application/json; charset=UTF-8 > Content-Encoding: gzip > Date: Wed, 28 Mar 2012 14:36:08 GMT > Expires: Wed, 28 Mar 2012 14:36:08 GMT > Cache-Control: private, max-age=0 > X-Content-Type-Options: nosniff > X-Frame-Options: SAMEORIGIN > X-XSS-Protection: 1; mode=block > Content-Length: 184 > Server: GSE > { > "error": { > "errors": [ > { > "domain": "global", > "reason": "authError", > "message": "Domain cannot use Api, Groups service is not installed.", > "locationType": "header", > "location": "Authorization" > } > ], > "code": 401, > "message": "Domain cannot use Api, Groups service is not installed." > }} > > */ > } > @After > public void tearDown(){ > oAuth2Service = null; > groupsService = null; > helper.tearDown(); > > > > > > > > } > } -- You received this message because you are subscribed to the Google Groups "Google Apps Domain Information and Management APIs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-apps-mgmt-apis?hl=en.
