Details
- 
    Type:Bug 
- 
    Status: Closed
- 
    Priority:Major 
- 
    Resolution: Fixed
- 
    Affects Version/s: Mercury
- 
    Fix Version/s: Mercury
- 
    Component/s: Other / Misc.
- 
    Labels:None
- 
    Environment:Builds Bid Manager : aml-sapi-2.9.0-20151005.042050-172.war (build # 1107) 
 Core : smb-ear-2.9.0-SNAPSHOT-b385-t20150925-113220-CI.ear (build #385)
 SAPI : aml-sapi-2.9.0-20150924.191138-161 (build #1098)
 Reseller : aml-ui-reseller-gwt-2.9.0-20150813.221022-7.war (#259)
 Techops : ops-scripts-2.8.0-20151001.141027-72-bin.zip(Build#752)
 Data Tool: : aml-data-tool-2.8.1-20150923.204729-31.jar
 AML Distribution Service: Build90Builds Bid Manager : aml-sapi-2.9.0-20151005.042050-172.war (build # 1107) Core : smb-ear-2.9.0-SNAPSHOT-b385-t20150925-113220-CI.ear (build #385) SAPI : aml-sapi-2.9.0-20150924.191138-161 (build #1098) Reseller : aml-ui-reseller-gwt-2.9.0-20150813.221022-7.war (#259) Techops : ops-scripts-2.8.0-20151001.141027-72-bin.zip(Build#752) Data Tool: : aml-data-tool-2.8.1-20150923.204729-31.jar AML Distribution Service: Build90
- 
        Sprint:Sprint 10
Description
The refresh token returned by OAuth Service is the same for multiple threads ( realms)
Steps:
1. Setup 2 different realms to two different submcc
2. Deploy the order from both the realms 
Actual Result:
Order gets failed for one of the realm - Error out.
Snippet of listener log - (Detailed log attached) and see other screenshots.
Snippet of Listener log
015-10-01 15:34:26,762 [P1T1] INFO  c.t.s.o.core.OAuthServiceComponent - [oauth] Creating new OAuthServiceComponent
2015-10-01 15:34:26,762 [P2T1] INFO  c.t.s.o.core.OAuthServiceComponent - [oauth] Creating new OAuthServiceComponent
2015-10-01 15:34:26.955 (3) [P2T1]: Retrieving credentials for search engine user id : 0 || client id : 143943699348-p752ag8fq5kf31mctbgev2dauvcaoupf.apps.googleusercontent.com , client secret :PJIJBVuFuicGaQQ6pCg9qaFU , refresh token : 1/4Ic0TM_o3L1GnHo87uIsD1Ui4gOk6cvIY9gBlf1FmOZIgOrJDtdun6zK6XiATCKT
2015-10-01 15:34:26.955 (3) [P1T1]: Retrieving credentials for search engine user id : 0 || client id : 161524678525-ucub5qmd40m9r05ilgnud7sp2jqjt9me.apps.googleusercontent.com , client secret :m0a4ndnM6VHRCNozsdAaKLCz , refresh token : 1/fQ0yVVcqmWVu4ZwxZ6tqaLhzCKYnlsnBKZUY1Ija6qM
2015-10-01 15:34:26,963 [P1T1] INFO  c.t.s.o.core.OAuthServiceComponent - [oauth] Getting new access token
2015-10-01 15:34:26,963 [P2T1] INFO  c.t.s.o.core.OAuthServiceComponent - [oauth] Getting new access token
2015-10-01 15:34:28,626 [P1T1] INFO  c.t.s.o.core.OAuthServiceComponent - [oauth] Return OAuth credential. Access token = ya29._wHDRyanA9tvll3Dr1s5GINKAgzcZNCxXQQpsSA9fRBq9RGT0nTxBXrQHxk4nDul40bqzQ
2015-10-01 15:34:28.627 (3) [P1T1]: [oauth] Returning access token from OAuth service: ya29._wHDRyanA9tvll3Dr1s5GINKAgzcZNCxXQQpsSA9fRBq9RGT0nTxBXrQHxk4nDul40bqzQ
2015-10-01 15:34:28,627 [P2T1] INFO  c.t.s.o.core.OAuthServiceComponent - [oauth] Return OAuth credential. Access token = ya29._wHDRyanA9tvll3Dr1s5GINKAgzcZNCxXQQpsSA9fRBq9RGT0nTxBXrQHxk4nDul40bqzQ
2015-10-01 15:34:28.627 (3) [P2T1]: [oauth] Returning access token from OAuth service: ya29._wHDRyanA9tvll3Dr1s5GINKAgzcZNCxXQQpsSA9fRBq9RGT0nTxBXrQHxk4nDul40bqzQ
2015-10-01 15:34:28.628 (3) [P1T1]: Retrieving credentials for search engine user id : 0 || client id : 161524678525-ucub5qmd40m9r05ilgnud7sp2jqjt9me.apps.googleusercontent.com , client secret :m0a4ndnM6VHRCNozsdAaKLCz , refresh token : 1/fQ0yVVcqmWVu4ZwxZ6tqaLhzCKYnlsnBKZUY1Ija6qM
2015-10-01 15:34:28.628 (3) [P2T1]: Retrieving credentials for search engine user id : 0 || client id : 143943699348-p752ag8fq5kf31mctbgev2dauvcaoupf.apps.googleusercontent.com , client secret :PJIJBVuFuicGaQQ6pCg9qaFU , refresh token : 1/4Ic0TM_o3L1GnHo87uIsD1Ui4gOk6cvIY9gBlf1FmOZIgOrJDtdun6zK6XiATCKT
2015-10-01 15:34:28,628 [P1T1] INFO  c.t.s.o.core.OAuthServiceComponent - [oauth] Return OAuth credential. Access token = ya29._wHDRyanA9tvll3Dr1s5GINKAgzcZNCxXQQpsSA9fRBq9RGT0nTxBXrQHxk4nDul40bqzQ
2015-10-01 15:34:28,628 [P2T1] INFO  c.t.s.o.core.OAuthServiceComponent - [oauth] Return OAuth credential. Access token = ya29._wHDRyanA9tvll3Dr1s5GINKAgzcZNCxXQQpsSA9fRBq9RGT0nTxBXrQHxk4nDul40bqzQ
2015-10-01 15:34:28.628 (3) [P1T1]: [oauth] Returning access token from OAuth service: ya29._wHDRyanA9tvll3Dr1s5GINKAgzcZNCxXQQpsSA9fRBq9RGT0nTxBXrQHxk4nDul40bqzQ
2015-10-01 15:34:28.628 (3) [P2T1]: [oauth] Returning access token from OAuth service: ya29._wHDRyanA9tvll3Dr1s5GINKAgzcZNCxXQQpsSA9fRBq9RGT0nTxBXrQHxk4nDul40bqzQ
2015-10-01 15:34:29.608 (3) [P2T1]: Returning 7650377477
2015-10-01 15:34:29.610 (3) [P1T1]: Returning 5891657304
2015-10-01 15:34:29.617 (3) [P2T1]: GoogleAccountChangeRequest (accountID 892): Sending 1 add requests
2015-10-01 15:34:29.617 (3) [P1T1]: GoogleAccountChangeRequest (accountID 893): Sending 1 add requests
2015-10-01 15:34:29.618 (3) [P2T1]: DatabasePool with a limit of 10 created
2015-10-01 15:34:29.633 (3) [P2T1]: JDBC Driver Version: 5.1 (com.mysql.jdbc.Driver)
2015-10-01 15:34:29.647 (3) [P1T1]: JDBC Driver Version: 5.1 (com.mysql.jdbc.Driver)
2015-10-01 15:34:29.647 (3) [P2T1]: Creating account in 7650377477
2015-10-01 15:34:30,164 [P2T1] INFO  c.g.a.a.a.l.c.A.requestInfoLogger - Request made: Service: "ManagedCustomerServiceInterfacePort" Method: "mutate" URL: "https://adwords.google.com/api/adwords/mcm/v201506/ManagedCustomerService"
2015-10-01 15:34:30,223 [P2T1] WARN  c.g.a.a.a.l.c.A.soapXmlLogger - SOAP Request:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Header>
        <ns1:RequestHeader xmlns:ns1="https://adwords.google.com/api/adwords/mcm/v201506" soapenv:mustUnderstand="0">
            <ns2:clientCustomerId xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201506">7650377477</ns2:clientCustomerId>
            <ns3:developerToken xmlns:ns3="https://adwords.google.com/api/adwords/cm/v201506">ojCnjZaM6RD1h0yt_DOJZg</ns3:developerToken>
            <ns4:userAgent xmlns:ns4="https://adwords.google.com/api/adwords/cm/v201506">AdMaxLocal AdWords Software TSA QA (AwApi-Java, AdWords-Axis/2.4.0, Common-Java/2.4.0, Axis/1.4, Java/1.6.0_27, maven)</ns4:userAgent>
            <ns5:validateOnly xmlns:ns5="https://adwords.google.com/api/adwords/cm/v201506">false</ns5:validateOnly>
            <ns6:partialFailure xmlns:ns6="https://adwords.google.com/api/adwords/cm/v201506">false</ns6:partialFailure>
        </ns1:RequestHeader>
    </soapenv:Header>
    <soapenv:Body>
        <mutate xmlns="https://adwords.google.com/api/adwords/mcm/v201506">
            <operations>
                <ns7:operator xmlns:ns7="https://adwords.google.com/api/adwords/cm/v201506">ADD</ns7:operator>
                <operand>
                    <name>051f5cdc-69ad-42cf-a667-88db61e76aa0_1</name>
                    <currencyCode>USD</currencyCode>
                    <dateTimeZone>America/New_York</dateTimeZone>
                </operand>
            </operations>
        </mutate>
    </soapenv:Body>
</soapenv:Envelope>
2015-10-01 15:34:30,223 [P2T1] WARN  c.g.a.a.a.l.c.A.soapXmlLogger - SOAP Response:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
        <ns2:ResponseHeader xmlns:ns2="https://adwords.google.com/api/adwords/mcm/v201506" xmlns="https://adwords.google.com/api/adwords/cm/v201506">
            <requestId>0005210cc87541090abfcc90f607458a</requestId>
            <serviceName>ManagedCustomerService</serviceName>
            <methodName>mutate</methodName>
            <operations>0</operations>
            <responseTime>101</responseTime>
        </ns2:ResponseHeader>
    </soap:Header>
    <soap:Body>
        <soap:Fault>
            <faultcode>soap:Server</faultcode>
            <faultstring>[AuthorizationError.USER_PERMISSION_DENIED @ ; trigger:'<null>']</faultstring>
            <detail>
                <ns2:ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v201506" xmlns:ns2="https://adwords.google.com/api/adwords/mcm/v201506">
                    <message>[AuthorizationError.USER_PERMISSION_DENIED @ ; trigger:'<null>']</message>
                    <ApplicationException.Type>ApiException</ApplicationException.Type>
                    <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="AuthorizationError">
                        <fieldPath/>
                        <trigger><null></trigger>
                        <errorString>AuthorizationError.USER_PERMISSION_DENIED</errorString>
                        <ApiError.Type>AuthorizationError</ApiError.Type>
                        <reason>USER_PERMISSION_DENIED</reason>
                    </errors>
                </ns2:ApiExceptionFault>
            </detail>
        </soap:Fault>
    </soap:Body>
</soap:Envelope>
2015-10-01 15:34:30.224 (2) [P2T1]: 1 Errors found
2015-10-01 15:34:30.224 (2) [P2T1]:  - com.thesearchagency.searchengines.google.GoogleAdWordsAPIReseller$ResellerApiError: AuthorizationError.USER_PERMISSION_DENIED: Error Type=RESELLER field=, trigger=<null>
2015-10-01 15:34:30.226 (2) [P2T1]: com.thesearchagency.searchengines.google.GoogleAdWordsAPIReseller$ResellerApiError: ApiError: fieldpath=, trigger=<null> apierrortype=RESELLER, reason=AuthorizationError.USER_PERMISSION_DENIED
2015-10-01 15:34:30.226 (3) [P2T1]: Not retrying Google error. message1=[AuthorizationError.USER_PERMISSION_DENIED @ ; trigger:'<null>']
2015-10-01 15:34:30.226 (3) [P2T1]: Caught other/unrecoverable API Exception: "com.google.api.ads.adwords.axis.v201506.cm.ApiException"
2015-10-01 15:34:30.237 (3) [P1T1]: Creating account in 5891657304
2015-10-01 15:34:31,050 [P1T1] INFO  c.g.a.a.a.l.c.A.requestInfoLogger - Request made: Service: "ManagedCustomerServiceInterfacePort" Method: "mutate" URL: "https://adwords.google.com/api/adwords/mcm/v201506/ManagedCustomerService"
2015-10-01 15:34:31,058 [P1T1] INFO  c.g.a.a.a.l.c.A.soapXmlLogger - SOAP Request:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Header>
        <ns1:RequestHeader xmlns:ns1="https://adwords.google.com/api/adwords/mcm/v201506" soapenv:mustUnderstand="0">
            <ns2:clientCustomerId xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201506">5891657304</ns2:clientCustomerId>
            <ns3:developerToken xmlns:ns3="https://adwords.google.com/api/adwords/cm/v201506">ojCnjZaM6RD1h0yt_DOJZg</ns3:developerToken>
            <ns4:userAgent xmlns:ns4="https://adwords.google.com/api/adwords/cm/v201506">AdMaxLocal AdWords Software TSA QA (AwApi-Java, AdWords-Axis/2.4.0, Common-Java/2.4.0, Axis/1.4, Java/1.6.0_27, maven)</ns4:userAgent>
            <ns5:validateOnly xmlns:ns5="https://adwords.google.com/api/adwords/cm/v201506">false</ns5:validateOnly>
            <ns6:partialFailure xmlns:ns6="https://adwords.google.com/api/adwords/cm/v201506">false</ns6:partialFailure>
        </ns1:RequestHeader>
    </soapenv:Header>
    <soapenv:Body>
        <mutate xmlns="https://adwords.google.com/api/adwords/mcm/v201506">
            <operations>
                <ns7:operator xmlns:ns7="https://adwords.google.com/api/adwords/cm/v201506">ADD</ns7:operator>
                <operand>
                    <name>9c0ae459-ea60-477a-9103-7bc2cd08ebc7_1</name>
                    <currencyCode>USD</currencyCode>
                    <dateTimeZone>America/New_York</dateTimeZone>
                </operand>
            </operations>
        </mutate>
    </soapenv:Body>
</soapenv:Envelope>
2015-10-01 15:34:31,058 [P1T1] INFO  c.g.a.a.a.l.c.A.soapXmlLogger - SOAP Response:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
        <ns2:ResponseHeader xmlns:ns2="https://adwords.google.com/api/adwords/mcm/v201506" xmlns="https://adwords.google.com/api/adwords/cm/v201506">
            <requestId>0005210cc87a2ec00abf08cd35045321</requestId>
            <serviceName>ManagedCustomerService</serviceName>
            <methodName>mutate</methodName>
            <operations>0</operations>
            <responseTime>670</responseTime>
        </ns2:ResponseHeader>
    </soap:Header>
    <soap:Body>
        <ns2:mutateResponse xmlns="https://adwords.google.com/api/adwords/cm/v201506" xmlns:ns2="https://adwords.google.com/api/adwords/mcm/v201506">
            <ns2:rval>
                <ns2:value>
                    <ns2:name>9c0ae459-ea60-477a-9103-7bc2cd08ebc7_1</ns2:name>
                    <ns2:customerId>2139791040</ns2:customerId>
                    <ns2:canManageClients>false</ns2:canManageClients>
                    <ns2:currencyCode>USD</ns2:currencyCode>
                    <ns2:dateTimeZone>America/New_York</ns2:dateTimeZone>
                </ns2:value>
            </ns2:rval>
        </ns2:mutateResponse>
    </soap:Body>
</soap:Envelope>
Expected:
The order for multiple realm having different submcc should get deployed successfully.

