public SettingsGroupDescriptor GetPreviousSettingsGroup(SettingsGroupDescriptor group) { List <SettingsGroupDescriptor> groups = null; var request = new ListSettingsGroupsRequest(); //TODO/NOTE: I had changed the service interface so the server would return the previous group, but in order to //not have to release enterprise for Summer, I just did this. Platform.GetService((IApplicationConfigurationReadService service) => groups = service.ListSettingsGroups(request).Groups); if (groups == null || groups.Count == 0) { return(null); } var sameGroup = CollectionUtils.Select(groups, other => other.AssemblyQualifiedTypeName == group.AssemblyQualifiedTypeName); var lessEqualGroups = CollectionUtils.Select(sameGroup, other => other.Version <= group.Version); if (lessEqualGroups.Count < 2) { return(null); } //Sort ascending. lessEqualGroups.Sort((other1, other2) => other1.Version.CompareTo(other2.Version)); //The current version is last, the previous is second last. return(lessEqualGroups[lessEqualGroups.Count - 2]); }
public ListSettingsGroupsResponse ListSettingsGroups(ListSettingsGroupsRequest request) { var broker = PersistenceContext.GetBroker <IConfigurationSettingsGroupBroker>(); return(new ListSettingsGroupsResponse( CollectionUtils.Map(broker.FindAll(), (ConfigurationSettingsGroup g) => g.GetDescriptor()))); }
public void TestCacheListSettingsGroups() { var cache = new TestCacheClient(); cache.ClearCache(); var service = new TestConfigurationService(); object request = new ListSettingsGroupsRequest(); object response = new ListSettingsGroupsResponse(new List <SettingsGroupDescriptor>()); var invocation = new TestInvocation { Target = service, Method = typeof(IApplicationConfigurationReadService).GetMethod("ListSettingsGroups", BindingFlags.FlattenHierarchy | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public), TargetType = typeof(IApplicationConfigurationReadService), Request = request, Response = response }; var directive = new ResponseCachingDirective(true, TimeSpan.FromMinutes(1), ResponseCachingSite.Server); var advice = new ConcreteResponseCachingAdvice(directive); advice.Intercept(invocation); var cacheEntry = cache.Get("ListSettingsGroups", new CacheGetOptions("")); Assert.IsNotNull(cacheEntry); request = new ImportSettingsGroupRequest( new SettingsGroupDescriptor("Test", new Version(1, 0), "Test", "Test", true), new List <SettingsPropertyDescriptor>(new[] { new SettingsPropertyDescriptor("Test", "Test", "Test", SettingScope.User, "Test") })); response = new ImportSettingsGroupResponse(); invocation = new TestInvocation { Target = service, Method = typeof(IConfigurationService).GetMethod("ImportSettingsGroup", BindingFlags.FlattenHierarchy | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public), TargetType = typeof(IConfigurationService), Request = request, Response = response }; advice = new ConcreteResponseCachingAdvice(null); advice.Intercept(invocation); cacheEntry = cache.Get("ListSettingsGroups", new CacheGetOptions("")); Assert.IsNull(cacheEntry); }
public ListSettingsGroupsResponse ListSettingsGroups(ListSettingsGroupsRequest request) { throw new NotImplementedException(); }