1 4 package com.tc.config.schema.repository; 5 6 import com.tc.config.schema.validate.ConfigurationValidator; 7 8 import java.util.HashMap ; 9 import java.util.Iterator ; 10 import java.util.Map ; 11 12 15 public class MockApplicationsRepository implements ApplicationsRepository { 16 17 private int numRepositoryFors; 18 private String lastApplicationName; 19 20 private int numApplicationNames; 21 22 private Map returnedRepositories; 23 24 public MockApplicationsRepository() { 25 this.returnedRepositories = new HashMap (); 26 27 reset(); 28 } 29 30 public void reset() { 31 this.numRepositoryFors = 0; 32 this.lastApplicationName = null; 33 34 this.numApplicationNames = 0; 35 } 36 37 public void addRepositoryValidator(ConfigurationValidator validator) { 38 } 40 41 public MutableBeanRepository repositoryFor(String applicationName) { 42 ++this.numRepositoryFors; 43 this.lastApplicationName = applicationName; 44 return (MutableBeanRepository) this.returnedRepositories.get(applicationName); 45 } 46 47 public Iterator applicationNames() { 48 ++this.numApplicationNames; 49 return this.returnedRepositories.keySet().iterator(); 50 } 51 52 public String getLastApplicationName() { 53 return lastApplicationName; 54 } 55 56 public int getNumApplicationNames() { 57 return numApplicationNames; 58 } 59 60 public int getNumRepositoryFors() { 61 return numRepositoryFors; 62 } 63 64 public void setReturnedRepositories(Map returnedRepositories) { 65 this.returnedRepositories = returnedRepositories; 66 } 67 68 } 69 | Popular Tags |