PduV2Factory implements PduFactory { public AggregationRequest createAggregatorConfigurationRequest(KSIRequestContext context, ServiceCredentials credentials) throws KSIException { return this.aggregatorPduV2Factory.createAggregatorConfigurationRequest(context, credentials); } PduV2Factory();  PduV2Factory(AggregatorPduV2Factory aggregatorPduV2Factory, ExtenderPduV2Factory extenderPduV2Factory);  PduV2Factory(AggregatorPduV2Factory aggregatorPduV2Factory);  PduV2Factory(ExtenderPduV2Factory extenderPduV2Factory); AggregationRequest createAggregationRequest(KSIRequestContext context, ServiceCredentials credentials, DataHash imprint, Long level); AggregationResponse readAggregationResponse(KSIRequestContext context, ServiceCredentials credentials, TLVElement input); AggregationRequest createAggregatorConfigurationRequest(KSIRequestContext context, ServiceCredentials credentials); AggregatorConfiguration readAggregatorConfigurationResponse(KSIRequestContext context, ServiceCredentials credentials, TLVElement input); ExtensionRequest createExtensionRequest(KSIRequestContext context, ServiceCredentials credentials, Date aggregationTime, Date publicationTime); ExtensionResponse readExtensionResponse(KSIRequestContext context, ServiceCredentials credentials, TLVElement input); ExtensionRequest createExtensionConfigurationRequest(KSIRequestContext context, ServiceCredentials credentials); ExtenderConfiguration readExtenderConfigurationResponse(ServiceCredentials credentials, TLVElement input);  }
@Test public void testCreateAggregationConfigurationRequest() throws Exception { AggregationRequest request = pduFactory.createAggregatorConfigurationRequest(requestContext, CREDENTIALS); Assert.assertNotNull(request); TLVElement tlv = TLVElement.create(request.toByteArray()); Assert.assertEquals(tlv.getType(), GlobalTlvTypes.ELEMENT_TYPE_AGGREGATION_REQUEST_PDU_V2); Assert.assertEquals(tlv.getChildElements(0x04).size(), 1); }
@Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = "KsiRequestContext can not be null") public void testCreateAggregationConfigurationRequestWithoutContext() throws Exception { pduFactory.createAggregatorConfigurationRequest(null, CREDENTIALS); }
@Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = "ServiceCredentials can not be null") public void testCreateAggregationConfigurationRequestWithoutCredentials() throws Exception { pduFactory.createAggregatorConfigurationRequest(requestContext, null); }