Wed, 31 Dec 2014 07:22:50 +0100
Correct previous dual key logic pending first delivery installment.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | package org.mozilla.gecko.background.testhelpers; |
michael@0 | 5 | |
michael@0 | 6 | import org.mozilla.gecko.sync.Utils; |
michael@0 | 7 | import org.mozilla.gecko.sync.delegates.ClientsDataDelegate; |
michael@0 | 8 | |
michael@0 | 9 | public class MockClientsDataDelegate implements ClientsDataDelegate { |
michael@0 | 10 | private String accountGUID; |
michael@0 | 11 | private String clientName; |
michael@0 | 12 | private int clientsCount; |
michael@0 | 13 | |
michael@0 | 14 | @Override |
michael@0 | 15 | public synchronized String getAccountGUID() { |
michael@0 | 16 | if (accountGUID == null) { |
michael@0 | 17 | accountGUID = Utils.generateGuid(); |
michael@0 | 18 | } |
michael@0 | 19 | return accountGUID; |
michael@0 | 20 | } |
michael@0 | 21 | |
michael@0 | 22 | @Override |
michael@0 | 23 | public synchronized String getClientName() { |
michael@0 | 24 | if (clientName == null) { |
michael@0 | 25 | clientName = "Default Name"; |
michael@0 | 26 | } |
michael@0 | 27 | return clientName; |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | @Override |
michael@0 | 31 | public synchronized void setClientsCount(int clientsCount) { |
michael@0 | 32 | this.clientsCount = clientsCount; |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | @Override |
michael@0 | 36 | public synchronized int getClientsCount() { |
michael@0 | 37 | return clientsCount; |
michael@0 | 38 | } |
michael@0 | 39 | |
michael@0 | 40 | @Override |
michael@0 | 41 | public boolean isLocalGUID(String guid) { |
michael@0 | 42 | return getAccountGUID().equals(guid); |
michael@0 | 43 | } |
michael@0 | 44 | } |