this.props.getHourMetrics().setRetentionIntervalInDays(this.retentionPolicyDays); this.props.getMinuteMetrics().setRetentionIntervalInDays(this.retentionPolicyDays); MetricsProperties metrics = this.props.getHourMetrics(); if (Constants.AnalyticsConstants.VERSION_ELEMENT.equals(currentNode)) { metrics.setVersion(value); metrics.setMetricsLevel(metrics.getMetricsLevel() != MetricsLevel.SERVICE_AND_API ? MetricsLevel.SERVICE : MetricsLevel.SERVICE_AND_API); if (Boolean.parseBoolean(value) && metrics.getMetricsLevel() != MetricsLevel.DISABLED) { metrics.setMetricsLevel(MetricsLevel.SERVICE_AND_API); MetricsProperties metrics = this.props.getMinuteMetrics(); if (Constants.AnalyticsConstants.VERSION_ELEMENT.equals(currentNode)) { metrics.setVersion(value); metrics.setMetricsLevel(metrics.getMetricsLevel() != MetricsLevel.SERVICE_AND_API ? MetricsLevel.SERVICE : MetricsLevel.SERVICE_AND_API); if (Boolean.parseBoolean(value) && metrics.getMetricsLevel() != MetricsLevel.DISABLED) { metrics.setMetricsLevel(MetricsLevel.SERVICE_AND_API);
Utility.assertNotNull("metrics.Configuration", metrics.getMetricsLevel()); xmlw.writeCharacters(metrics.getVersion()); xmlw.writeEndElement(); xmlw.writeCharacters(metrics.getMetricsLevel() != MetricsLevel.DISABLED ? Constants.TRUE : Constants.FALSE); xmlw.writeEndElement(); if (metrics.getMetricsLevel() != MetricsLevel.DISABLED) { xmlw.writeCharacters(metrics.getMetricsLevel() == MetricsLevel.SERVICE_AND_API ? Constants.TRUE : Constants.FALSE); xmlw.writeEndElement(); writeRetentionPolicy(xmlw, metrics.getRetentionIntervalInDays());
/** * Initializes a new instances of the ServiceProperties class. */ public ServiceProperties() { this.setLogging(new LoggingProperties()); this.setHourMetrics(new MetricsProperties()); this.setMinuteMetrics(new MetricsProperties()); this.setCors(new CorsProperties()); }
private void testAnalyticsDisable(ServiceClient client, ServiceProperties props) throws StorageException, InterruptedException { props.getLogging().setLogOperationTypes(EnumSet.noneOf(LoggingOperations.class)); props.getLogging().setRetentionIntervalInDays(null); props.getLogging().setVersion("1.0"); props.getHourMetrics().setMetricsLevel(MetricsLevel.DISABLED); props.getHourMetrics().setRetentionIntervalInDays(null); props.getHourMetrics().setVersion("1.0"); props.getMinuteMetrics().setMetricsLevel(MetricsLevel.DISABLED); props.getMinuteMetrics().setRetentionIntervalInDays(null); props.getMinuteMetrics().setVersion("1.0"); props.getCors().getCorsRules().clear(); callUploadServiceProps(client, props, null); assertServicePropertiesAreEqual(props, callDownloadServiceProperties(client)); }
private void testAnalyticsRetentionPolicies(ServiceClient client, ServiceProperties props) throws StorageException, InterruptedException { props.getHourMetrics().setMetricsLevel(MetricsLevel.DISABLED); props.getHourMetrics().setRetentionIntervalInDays(null); props.getMinuteMetrics().setMetricsLevel(MetricsLevel.DISABLED); props.getMinuteMetrics().setRetentionIntervalInDays(null); callUploadServiceProps(client, props, null); props.getHourMetrics().setRetentionIntervalInDays(1); props.getHourMetrics().setMetricsLevel(MetricsLevel.SERVICE); props.getMinuteMetrics().setRetentionIntervalInDays(1); props.getMinuteMetrics().setMetricsLevel(MetricsLevel.SERVICE); callUploadServiceProps(client, props, null); props.getHourMetrics().setRetentionIntervalInDays(2); props.getHourMetrics().setMetricsLevel(MetricsLevel.SERVICE_AND_API); props.getMinuteMetrics().setRetentionIntervalInDays(2); props.getMinuteMetrics().setMetricsLevel(MetricsLevel.SERVICE_AND_API); callUploadServiceProps(client, props, null);
hours.setMetricsLevel(MetricsLevel.DISABLED); hours.setRetentionIntervalInDays(null); hours.setVersion("1.0"); callUploadServiceProps(client, props, fileProps); hours.setMetricsLevel(MetricsLevel.SERVICE); callUploadServiceProps(client, props, fileProps); hours.setMetricsLevel(MetricsLevel.SERVICE_AND_API); callUploadServiceProps(client, props, fileProps);
minutes.setMetricsLevel(MetricsLevel.DISABLED); minutes.setRetentionIntervalInDays(null); minutes.setVersion("1.0"); callUploadServiceProps(client, props, fileProps); minutes.setMetricsLevel(MetricsLevel.SERVICE); callUploadServiceProps(client, props, fileProps); minutes.setMetricsLevel(MetricsLevel.SERVICE_AND_API); callUploadServiceProps(client, props, fileProps);
this.props.getHourMetrics().setRetentionIntervalInDays(this.retentionPolicyDays); this.props.getMinuteMetrics().setRetentionIntervalInDays(this.retentionPolicyDays); MetricsProperties metrics = this.props.getHourMetrics(); if (Constants.AnalyticsConstants.VERSION_ELEMENT.equals(currentNode)) { metrics.setVersion(value); metrics.setMetricsLevel(metrics.getMetricsLevel() != MetricsLevel.SERVICE_AND_API ? MetricsLevel.SERVICE : MetricsLevel.SERVICE_AND_API); if (Boolean.parseBoolean(value) && metrics.getMetricsLevel() != MetricsLevel.DISABLED) { metrics.setMetricsLevel(MetricsLevel.SERVICE_AND_API); MetricsProperties metrics = this.props.getMinuteMetrics(); if (Constants.AnalyticsConstants.VERSION_ELEMENT.equals(currentNode)) { metrics.setVersion(value); metrics.setMetricsLevel(metrics.getMetricsLevel() != MetricsLevel.SERVICE_AND_API ? MetricsLevel.SERVICE : MetricsLevel.SERVICE_AND_API); if (Boolean.parseBoolean(value) && metrics.getMetricsLevel() != MetricsLevel.DISABLED) { metrics.setMetricsLevel(MetricsLevel.SERVICE_AND_API);
Utility.assertNotNull("metrics.Configuration", metrics.getMetricsLevel()); Utility.serializeElement(xmlw, Constants.AnalyticsConstants.VERSION_ELEMENT, metrics.getVersion()); metrics.getMetricsLevel() != MetricsLevel.DISABLED ? Constants.TRUE : Constants.FALSE); if (metrics.getMetricsLevel() != MetricsLevel.DISABLED) { metrics.getMetricsLevel() == MetricsLevel.SERVICE_AND_API ? Constants.TRUE : Constants.FALSE); writeRetentionPolicy(xmlw, metrics.getRetentionIntervalInDays());
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { this.elementStack.push(localName); if (Constants.AnalyticsConstants.CORS_RULE_ELEMENT.equals(localName)) { this.rule = new CorsRule(); } else if (Constants.AnalyticsConstants.LOGGING_ELEMENT.equals(localName)) { this.props.setLogging(new LoggingProperties()); } else if (Constants.AnalyticsConstants.HOUR_METRICS_ELEMENT.equals(localName)) { this.props.setHourMetrics(new MetricsProperties()); } else if (Constants.AnalyticsConstants.MINUTE_METRICS_ELEMENT.equals(localName)) { this.props.setMinuteMetrics(new MetricsProperties()); } else if (Constants.AnalyticsConstants.CORS_ELEMENT.equals(localName)) { this.props.setCors(new CorsProperties()); } }
props.getHourMetrics().setMetricsLevel(MetricsLevel.SERVICE); props.getHourMetrics().setRetentionIntervalInDays(6); props.getHourMetrics().setVersion("1.0"); props.getMinuteMetrics().setMetricsLevel(MetricsLevel.SERVICE); props.getMinuteMetrics().setRetentionIntervalInDays(6); props.getMinuteMetrics().setVersion("1.0");
assertTrue(propsA.getHourMetrics().getMetricsLevel().equals(propsB.getHourMetrics().getMetricsLevel())); assertEquals(propsA.getHourMetrics().getRetentionIntervalInDays(), propsB.getHourMetrics() .getRetentionIntervalInDays()); assertEquals(propsA.getHourMetrics().getVersion(), propsB.getHourMetrics().getVersion()); assertTrue(propsA.getMinuteMetrics().getMetricsLevel().equals(propsB.getMinuteMetrics().getMetricsLevel())); assertEquals(propsA.getMinuteMetrics().getRetentionIntervalInDays(), propsB.getMinuteMetrics() .getRetentionIntervalInDays()); assertEquals(propsA.getMinuteMetrics().getVersion(), propsB.getMinuteMetrics().getVersion());
/** * Initializes a new instances of the ServiceProperties class. */ public ServiceProperties() { this.setLogging(new LoggingProperties()); this.setHourMetrics(new MetricsProperties()); this.setMinuteMetrics(new MetricsProperties()); this.setCors(new CorsProperties()); // DeleteRetentionPolicy and StaticWebsiteProperties are not included by default because they are not accepted by services other than blob. }
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { this.elementStack.push(localName); if (Constants.AnalyticsConstants.CORS_RULE_ELEMENT.equals(localName)) { this.rule = new CorsRule(); } else if (Constants.AnalyticsConstants.LOGGING_ELEMENT.equals(localName)) { this.props.setLogging(new LoggingProperties()); } else if (Constants.AnalyticsConstants.HOUR_METRICS_ELEMENT.equals(localName)) { this.props.setHourMetrics(new MetricsProperties()); } else if (Constants.AnalyticsConstants.MINUTE_METRICS_ELEMENT.equals(localName)) { this.props.setMinuteMetrics(new MetricsProperties()); } else if (Constants.AnalyticsConstants.CORS_ELEMENT.equals(localName)) { this.props.setCors(new CorsProperties()); } else if (Constants.AnalyticsConstants.DELETE_RETENTION_POLICY_ELEMENT.equals(localName)) { this.props.setDeleteRetentionPolicy(new DeleteRetentionPolicy()); } else if (Constants.AnalyticsConstants.STATIC_WEBSITE_ELEMENT.equals(localName)) { this.props.setStaticWebsiteProperties(new StaticWebsiteProperties()); } }