TenantObject extends JsonBackedValueObject { @JsonGetter(TenantConstants.FIELD_RESOURCE_LIMITS) public ResourceLimits getResourceLimits() { return this.resourceLimits; }  @JsonAnySetter TenantObject setProperty(final String name, final Object value); @JsonIgnore String getTenantId(); @JsonIgnore TenantObject setTenantId(final String tenantId); @JsonIgnore boolean isEnabled(); @JsonIgnore TenantObject setEnabled(final boolean flag); @JsonIgnore TenantObject setTrustAnchor(final PublicKey publicKey, final X500Principal subjectDn); @JsonIgnore TenantObject addTrustAnchor(final PublicKey publicKey, final X500Principal subjectDn,
            final Boolean autoProvisioningEnabled); @JsonIgnore TenantObject addTrustAnchor(final byte[] publicKey,
                                       final String publicKeyAlgorithm,
                                       final X500Principal subjectDn,
                                       final Boolean autoProvisioningEnabled); @JsonIgnore Set<TrustAnchor> getTrustAnchors(); @JsonIgnore boolean isAutoProvisioningEnabled(final String subjectDn); @JsonProperty(TenantConstants.FIELD_ADAPTERS) List<Adapter> getAdapters(); @JsonProperty(TenantConstants.FIELD_ADAPTERS) TenantObject setAdapters(final List<Adapter> adapters); @JsonIgnore Adapter getAdapter(final String type); TenantObject addAdapter(final Adapter adapter); @JsonIgnore boolean isAdapterEnabled(final String typeName); @JsonIgnore int getMaxTimeUntilDisconnect(final String typeName); static TenantObject from(final String tenantId, final Boolean enabled); static TenantObject from(final Boolean enabled); @JsonGetter(TenantConstants.FIELD_RESOURCE_LIMITS) ResourceLimits getResourceLimits(); @JsonIgnore TenantObject setResourceLimits(final JsonObject resourceLimits); @JsonSetter(TenantConstants.FIELD_RESOURCE_LIMITS) TenantObject setResourceLimits(final ResourceLimits resourceLimits); @JsonIgnore int getMinimumMessageSize(); TenantObject setMinimumMessageSize(final int payloadSize); @JsonIgnore JsonObject getDefaults(); @JsonIgnore TenantObject setDefaults(final JsonObject defaultProperties); @JsonProperty(value = TenantConstants.FIELD_TRACING) TenantTracingConfig getTracingConfig(); @JsonProperty(value = TenantConstants.FIELD_TRACING) TenantObject setTracingConfig(final TenantTracingConfig tracing);  }
@Test public void testGetResourceLimits() { final JsonObject limitsConfig = new JsonObject() .put("max-connections", 2) .put("data-volume", new JsonObject().put("max-bytes", 20_000_000) .put("effective-since", "2019-04-25T15:30:00+01:00") .put("period", new JsonObject() .put("mode", ResourceLimitsPeriod.PERIOD_MODE_DAYS) .put("no-of-days", 90))); final TenantObject tenantObject = TenantObject.from(Constants.DEFAULT_TENANT, true); tenantObject.setResourceLimits(limitsConfig); assertThat(tenantObject.getResourceLimits()).isNotNull(); assertThat(tenantObject.getResourceLimits().getMaxConnections()).isEqualTo(2); assertThat(tenantObject.getResourceLimits().getDataVolume().getMaxBytes()).isEqualTo(20_000_000L); assertThat(tenantObject.getResourceLimits().getDataVolume().getEffectiveSince()).isEqualTo(Instant.parse("2019-04-25T14:30:00Z")); assertThat(tenantObject.getResourceLimits().getDataVolume().getPeriod().getMode()).isEqualTo(ResourceLimitsPeriod.PERIOD_MODE_DAYS); assertThat(tenantObject.getResourceLimits().getDataVolume().getPeriod().getNoOfDays()).isEqualTo(90); }