src_fm_fc_ms_ff stringlengths 43 86.8k | target stringlengths 20 276k |
|---|---|
WxCpTagServiceImpl implements WxCpTagService { @Override public String create(String tagName) throws WxErrorException { String url = "https: JsonObject o = new JsonObject(); o.addProperty("tagname", tagName); String responseContent = this.mainService.post(url, o.toString()); JsonElement tmpJsonElement = new JsonParser(... | @Test public void testCreate() throws Exception { this.tagId = this.wxService.getTagService().create("测试标签" + System.currentTimeMillis()); System.out.println(this.tagId); } |
WxMpTemplateMsgServiceImpl implements WxMpTemplateMsgService { @Override public WxMpTemplateIndustry getIndustry() throws WxErrorException { String url = API_URL_PREFIX + "/get_industry"; String responseContent = this.wxMpService.get(url, null); return WxMpTemplateIndustry.fromJson(responseContent); } WxMpTemplateMsgSe... | @Test public void testGetIndustry() throws Exception { final WxMpTemplateIndustry industry = this.wxService.getTemplateMsgService().getIndustry(); Assert.assertNotNull(industry); System.out.println(industry); } |
WxMpTemplateMsgServiceImpl implements WxMpTemplateMsgService { @Override public boolean setIndustry(WxMpTemplateIndustry wxMpIndustry) throws WxErrorException { if (null == wxMpIndustry.getPrimaryIndustry() || null == wxMpIndustry.getPrimaryIndustry().getId() || null == wxMpIndustry.getSecondIndustry() || null == wxMpI... | @Test public void testSetIndustry() throws Exception { WxMpTemplateIndustry industry = new WxMpTemplateIndustry(new WxMpTemplateIndustry.Industry("1"), new WxMpTemplateIndustry.Industry("04")); boolean result = this.wxService.getTemplateMsgService().setIndustry(industry); Assert.assertTrue(result); } |
WxMpTemplateMsgServiceImpl implements WxMpTemplateMsgService { @Override public String addTemplate(String shortTemplateId) throws WxErrorException { String url = API_URL_PREFIX + "/api_add_template"; JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("template_id_short", shortTemplateId); String responseC... | @Test public void testAddTemplate() throws Exception { String result = this.wxService.getTemplateMsgService().addTemplate("TM00015"); Assert.assertNotNull(result); System.err.println(result); } |
WxMpTemplateMsgServiceImpl implements WxMpTemplateMsgService { @Override public List<WxMpTemplate> getAllPrivateTemplate() throws WxErrorException { String url = API_URL_PREFIX + "/get_all_private_template"; return WxMpTemplate.fromJson(this.wxMpService.get(url, null)); } WxMpTemplateMsgServiceImpl(WxMpService wxMpServ... | @Test public void testGetAllPrivateTemplate() throws Exception { List<WxMpTemplate> result = this.wxService.getTemplateMsgService().getAllPrivateTemplate(); Assert.assertNotNull(result); System.err.println(result); } |
WxMpTemplateMsgServiceImpl implements WxMpTemplateMsgService { @Override public boolean delPrivateTemplate(String templateId) throws WxErrorException { String url = API_URL_PREFIX + "/del_private_template"; JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("template_id", templateId); String responseConte... | @Test public void testDelPrivateTemplate() throws Exception { String templateId = "RPcTe7-4BkU5A2J3imC6W0b4JbjEERcJg0whOMKJKIc"; boolean result = this.wxService.getTemplateMsgService().delPrivateTemplate(templateId); Assert.assertTrue(result); } |
WxCpTagServiceImpl implements WxCpTagService { @Override public void update(String tagId, String tagName) throws WxErrorException { String url = "https: JsonObject o = new JsonObject(); o.addProperty("tagid", tagId); o.addProperty("tagname", tagName); this.mainService.post(url, o.toString()); } WxCpTagServiceImpl(WxCpS... | @Test(dependsOnMethods = "testCreate") public void testUpdate() throws Exception { this.wxService.getTagService().update(this.tagId, "测试标签-改名" + System.currentTimeMillis()); } |
WxMpKefuServiceImpl implements WxMpKefuService { @Override public WxMpKfMsgList kfMsgList(Date startTime, Date endTime, Long msgId, Integer number) throws WxErrorException { if (number > 10000) { throw new WxErrorException(WxError.newBuilder().setErrorMsg("非法参数请求,每次最多查询10000条记录!").build()); } if (startTime.after(endTim... | @Test public void testKfMsgList() throws WxErrorException { Date startTime = DateTime.now().minusDays(1).toDate(); Date endTime = DateTime.now().minusDays(0).toDate(); WxMpKfMsgList result = this.wxService.getKefuService().kfMsgList(startTime, endTime, 1L, 50); Assert.assertNotNull(result); System.err.println(result); ... |
WxMpDataCubeServiceImpl implements WxMpDataCubeService { @Override public List<WxDataCubeUserSummary> getUserSummary(Date beginDate, Date endDate) throws WxErrorException { String responseContent = this.wxMpService.post(GET_USER_SUMMARY, buildParams(beginDate, endDate)); return WxDataCubeUserSummary.fromJson(responseCo... | @Test(dataProvider = "sevenDays") public void testGetUserSummary(Date beginDate, Date endDate) throws WxErrorException { List<WxDataCubeUserSummary> summaries = this.wxService.getDataCubeService() .getUserSummary(beginDate, endDate); Assert.assertNotNull(summaries); System.out.println(summaries); } |
WxMpDataCubeServiceImpl implements WxMpDataCubeService { @Override public List<WxDataCubeUserCumulate> getUserCumulate(Date beginDate, Date endDate) throws WxErrorException { String responseContent = this.wxMpService.post(GET_USER_CUMULATE, buildParams(beginDate, endDate)); return WxDataCubeUserCumulate.fromJson(respon... | @Test(dataProvider = "sevenDays") public void testGetUserCumulate(Date beginDate, Date endDate) throws WxErrorException { List<WxDataCubeUserCumulate> result = this.wxService.getDataCubeService() .getUserCumulate(beginDate, endDate); Assert.assertNotNull(result); System.out.println(result); } |
WxMpDataCubeServiceImpl implements WxMpDataCubeService { @Override public List<WxDataCubeArticleResult> getArticleSummary(Date beginDate, Date endDate) throws WxErrorException { return this.getArticleResults(GET_ARTICLE_SUMMARY, beginDate, endDate); } WxMpDataCubeServiceImpl(WxMpService wxMpService); @Override List<WxD... | @Test(dataProvider = "oneDay") public void testGetArticleSummary(Date date) throws WxErrorException { List<WxDataCubeArticleResult> results = this.wxService.getDataCubeService() .getArticleSummary(date, date); Assert.assertNotNull(results); System.out.println(results); } |
WxCpTagServiceImpl implements WxCpTagService { @Override public List<WxCpTag> listAll() throws WxErrorException { String url = "https: String responseContent = this.mainService.get(url, null); JsonElement tmpJsonElement = new JsonParser().parse(responseContent); return WxCpGsonBuilder.INSTANCE.create() .fromJson( tmpJs... | @Test(dependsOnMethods = {"testUpdate", "testCreate"}) public void testListAll() throws Exception { List<WxCpTag> tags = this.wxService.getTagService().listAll(); assertNotEquals(tags.size(), 0); } |
VerticaBulkLoader extends BaseStep implements StepInterface { @VisibleForTesting VerticaConnection getVerticaConnection() throws SQLException { Connection conn = data.db.getConnection(); if ( conn != null ) { if ( conn instanceof VerticaConnection ) { return (VerticaConnection) conn; } else { Connection underlyingConn ... | @Test public void testGetConnection() throws Exception { Connection connection1 = mock( VerticaConnection.class ); DelegatingConnection connection2 = mock( DelegatingConnection.class ); when( connection2.getInnermostDelegate() ).thenReturn( connection1 ); DelegatingConnection connection3 = mock( DelegatingConnection.cl... |
VerticaBulkLoaderMeta extends BaseStepMeta implements StepMetaInterface, ProvidesModelerMeta { public String getXML() { StringBuilder retval = new StringBuilder(); retval.append( " " + XMLHandler.addTagValue( "connection", databaseMeta == null ? "" : databaseMeta.getName() ) ); retval.append( " " + XMLHandler.addTagVal... | @Test public void testGetXml() throws Exception { VerticaBulkLoaderMeta vbl = new VerticaBulkLoaderMeta(); vbl.setDefault(); vbl.setFieldDatabase( new String[] { "fieldDB1", "fieldDB2", "fieldDB3", "fieldDB4", "fieldDB5" } ); vbl.setFieldStream( new String[] { "fieldStr1", "fieldStr2", "fieldStr3" } ); try { vbl.getXML... |
StreamEncoder { public ByteBuffer getBuffer() { return this.buffer; } StreamEncoder( List<ColumnSpec> columns, PipedInputStream inputStream ); void close(); void writeHeader(); void writeRow( RowMetaInterface rowMeta, Object[] row ); ByteBuffer getBuffer(); static final int NUM_ROWS_TO_BUFFER; } | @Test public void testStreamEncoderConstructor_NoException_ByteBufferIsPositiveInt() throws Exception { int maxTypeLenght = 500; ColumnSpec cs = new ColumnSpec( ColumnSpec.VariableWidthType.VARCHAR, maxTypeLenght ); columns.add( cs ); try { StreamEncoder stEncoder = new StreamEncoder( columns, inputStream ); long expec... |
StreamEncoder { int countMainByteBufferSize() { long bufferSize = (long) getRowMaxSize() * NUM_ROWS_TO_BUFFER; return (int) ( bufferSize > 0 && bufferSize < MAXIMUM_BUFFER_SIZE ? bufferSize : MAXIMUM_BUFFER_SIZE ); } StreamEncoder( List<ColumnSpec> columns, PipedInputStream inputStream ); void close(); void writeHeader... | @Test public void testCountedBufferSizeIsInt_WhenToBufferAllRowMaxSizeRequiresMoreThenInt() throws Exception { try { assertEquals( MAXIMUM_BUFFER_SIZE, getSpyStreamEncoder().countMainByteBufferSize() ); } catch ( Exception e ) { fail( "There is no exception expected But was: " + e ); } } |
GreeterService extends GreeterGrpc.GreeterImplBase { @Override public void sayHello(HelloRequest request, StreamObserver<HelloReply> responseObserver) { log.info("get request - {}", request.getName()); HelloReply helloReply = HelloReply .newBuilder() .setMessage(String.format("hello %s", request.getName())) .build(); l... | @Test public void sayHello() { String name = faker.superhero().name(); HelloRequest request = HelloRequest.newBuilder().setName(name).build(); HelloReply helloReply = stub.sayHello(request); assertThat(helloReply.getMessage()).isEqualTo("hello " + name); } |
TransportClientProvider implements Provider<TransportClient> { public TransportClient get() { final String hostCsv = configuration.getString(CONFIG_ES_CLUSTER_HOST); final List<String> hosts = Splitter.on(",").splitToList(hostCsv); Preconditions.checkState(!hosts.isEmpty()); final TransportClient transportClient = new ... | @Test public void get() throws Exception { TransportClient transportClient = transportClientProvider.get(); assertThat(transportClient).isNotNull(); } |
ProductReadService extends ProductReadServiceGrpc.ProductReadServiceImplBase { @Override public void searchProducts(SearchProductsRequest request, StreamObserver<SearchProductsResponse> responseObserver) { try { responseObserver.onNext(productDao.searchProducts(request)); responseObserver.onCompleted(); counter.labels(... | @Test public void searchProducts() throws Exception { SearchProductsResponse searchProductsResponse = SearchProductsResponse.newBuilder() .addProducts( Product.newBuilder() .setProductId(faker.number().randomNumber()) .setProductName(faker.name().fullName()) .setCategory(faker.numerify("category-###")) .setProductStatu... |
ProductReadService extends ProductReadServiceGrpc.ProductReadServiceImplBase { @Override public void downloadProducts(DownloadProductsRequest request, StreamObserver<Product> responseObserver) { PublishSubject<Product> productPublishSubject = PublishSubject.create(); productPublishSubject .doOnNext(product -> { respons... | @Test public void downloadProducts() throws Exception { doAnswer(invocation -> { PublishSubject<Product> publishSubject = (PublishSubject<Product>) invocation.getArguments()[1]; publishSubject.onNext(Product.getDefaultInstance()); publishSubject.onComplete(); return null; }).when(productDao).downloadProducts(any(), any... |
ProductReadService extends ProductReadServiceGrpc.ProductReadServiceImplBase { @Override public StreamObserver<Product> calculateProductScore(StreamObserver<CalculateProductScoreResponse> responseObserver) { PublishSubject<CalculateProductScoreResponse> downloadStream = PublishSubject.create(); downloadStream .doOnNext... | @Test public void calculateProductScore() throws Exception { doAnswer(invocation -> { PublishSubject<CalculateProductScoreResponse> downloadStream = (PublishSubject<CalculateProductScoreResponse>) invocation.getArguments()[1]; downloadStream.onNext(CalculateProductScoreResponse.getDefaultInstance()); return null; }).wh... |
ProductReadService extends ProductReadServiceGrpc.ProductReadServiceImplBase { @Override public void downloadProductImage(DownloadProductImageRequest request, StreamObserver<DataChunk> responseObserver) { try { BufferedInputStream imageStream = new BufferedInputStream( productImageSeeker.seekProductImage(request.getPro... | @Test public void downloadProductImage() throws Exception { when(productImageSeeker.seekProductImage(anyLong())) .thenReturn(Resources.getResource("Large_Scaled_Forest_Lizard.jpg").openStream()); AtomicBoolean completed = new AtomicBoolean(false); AtomicBoolean error = new AtomicBoolean(false); File imageFile = File.cr... |
ProductUpdateService extends ProductUpdateServiceGrpc.ProductUpdateServiceImplBase { @Override public StreamObserver<Product> uploadProduct(StreamObserver<UploadProductResponse> responseObserver) { PublishSubject<Product> publishSubject = PublishSubject.create(); publishSubject .doOnNext(product -> { log.info("saving p... | @Test public void uploadProduct() throws Exception { Set<UploadProductResponse> responseHolder = Sets.newHashSet(); Set<Throwable> exceptionHolder = Sets.newHashSet(); AtomicBoolean completed = new AtomicBoolean(false); StreamObserver<Product> uploadStream = stub.uploadProduct(new StreamObserver<UploadProductResponse>(... |
RxStreamObserver implements StreamObserver<T> { @Override public void onError(Throwable t) { observer.onError(t); } RxStreamObserver(Observer<T> observer); @Override void onNext(T value); @Override void onError(Throwable t); @Override void onCompleted(); } | @Test public void clientStreaming_error_break_flow() throws Exception { PublishSubject<Integer> publishSubject = PublishSubject.create(); Set<Integer> resultsHolder = Sets.newConcurrentHashSet(); Set<Throwable> exceptionsHolder = Sets.newConcurrentHashSet(); AtomicBoolean complete = new AtomicBoolean(false); Disposable... |
EchoService extends EchoServiceGrpc.EchoServiceImplBase { @Override public void echo(EchoRequest request, StreamObserver<EchoResponse> responseObserver) { responseObserver.onNext(EchoResponse.newBuilder().setPong(request.getPing()).build()); responseObserver.onCompleted(); } @Override void echo(EchoRequest request, St... | @Test public void echo() throws Exception { EchoRequest echoRequest = EchoRequest.newBuilder().setPing(faker.hacker().verb()).build(); EchoResponse echoResponse = stub.echo(echoRequest); assertThat(echoResponse.getPong()).isEqualTo(echoRequest.getPing()); } |
ProductDao { public boolean initIndexIfNotExists() throws IOException { final IndicesExistsResponse existsResponse = esClient.admin().indices().prepareExists(INDEX).get(); if (existsResponse.isExists()) { return false; } final String settings = Resources.toString( getClass().getResource("/elasticsearch/product_settings... | @Test public void initIndexIfNotExists() throws Exception { final IndicesExistsResponse existsResponse = esClient.admin().indices().prepareExists(INDEX).get(); assertThat(existsResponse.isExists()).isTrue(); } |
Metric { abstract Class service(); static Builder builder(); } | @Test public void service() throws Exception { assertThat(metric.service()).isAssignableFrom(MetricTest.class); } |
ProductDao { public void upsertProduct(Product product) throws InvalidProtocolBufferException { log.debug("save product into ES"); final UpdateRequestBuilder updateRequestBuilder = esClient .prepareUpdate(INDEX, TYPE, String.valueOf(product.getProductId())) .setDoc( jsonPrinter .includingDefaultValueFields() .omittingI... | @Test public void upsertProduct() throws Exception { Product product = Product.newBuilder() .setProductId(faker.number().randomNumber()) .setProductName(faker.company().name()) .setProductPrice(faker.number().randomDouble(2, 10, 100)) .setProductStatus(ProductStatus.InStock) .build(); productDao.upsertProduct(product);... |
ProductDao { public SearchProductsResponse searchProducts(SearchProductsRequest request) throws InvalidProtocolBufferException { QueryBuilder queryBuilder = QueryBuilders.boolQuery() .must(QueryBuilders.matchQuery("productName", request.getKeyWord())); SearchResponse response = esClient.prepareSearch(INDEX) .setTypes(T... | @Test public void searchProducts() throws Exception { Product product1 = Product.newBuilder() .setProductId(faker.number().randomNumber()) .setProductName("apple guice") .setProductPrice(faker.number().randomDouble(2, 10, 100)) .setProductStatus(ProductStatus.InStock) .build(); Product product2 = Product.newBuilder() .... |
ProductDao { public void downloadProducts(DownloadProductsRequest request, PublishSubject<Product> productPublishSubject) { QueryBuilder queryBuilder = QueryBuilders.termQuery("category", request.getCategory()); SearchResponse scrollResponse = esClient .prepareSearch(INDEX) .setScroll(DEFAULT_SCROLL_TIME_VALUE) .setTyp... | @Test public void downloadProducts() throws Exception { String category = faker.numerify("category-##"); List<Product> sampleProducts = IntStream.range(1, 5).mapToObj(index -> { Product product = createProduct(category); try { productDao.upsertProduct(product); } catch (InvalidProtocolBufferException e) { log.error(" e... |
ProductDao { public void calculateProductScore(Product product, PublishSubject<CalculateProductScoreResponse> downloadStream) { downloadStream.onNext( CalculateProductScoreResponse .newBuilder() .setProduct(product) .setScore((long) product.getProductPrice()) .build() ); } void upsertProduct(Product product); boolean ... | @Test public void calculateProductScore() throws Exception { PublishSubject<CalculateProductScoreResponse> publishSubject = PublishSubject.create(); List<CalculateProductScoreResponse> responses = Lists.newArrayList(); publishSubject .doOnNext(response -> responses.add(response)) .subscribe(); Product product = createP... |
Metric { abstract Optional<String> action(); static Builder builder(); } | @Test public void action() throws Exception { assertThat(metric.action().get()).isEqualTo("test"); } |
Metric { abstract Optional<List<String>> labels(); static Builder builder(); } | @Test public void labels() throws Exception { assertThat(metric.labels()).isNotEmpty(); assertThat(metric.labels().get()).contains("labela", "labelb"); } |
Metric { public static Builder builder() { return new AutoValue_Metric.Builder(); } static Builder builder(); } | @Test(expected = IllegalStateException.class) public void mandatory_field() throws Exception { metric = Metric .builder() .build(); fail("should failed as mandatory field is missing"); } |
CounterFactory { public static Counter create(final Metric metric) { return cachedCounter.getUnchecked(metric); } static Counter create(final Metric metric); } | @Test public void create() throws Exception { Counter counter1 = CounterFactory.create( Metric.builder() .setService(CounterFactoryTest.class) .setAction("test") .build() ); assertThat(counter1).isNotNull(); Counter counter2 = CounterFactory.create( Metric.builder() .setService(CounterFactoryTest.class) .setAction("tes... |
ConfigurationProvider implements Provider<Configuration> { @Override public Configuration get() { Configurations configs = new Configurations(); try { return configs.properties(new File(getPropertyFilePath())); } catch (ConfigurationException e) { log.error(" error on build configuration", e); throw new IllegalStateExc... | @Test public void get() throws Exception { Configuration configuration = configurationProvider.get(); assertThat(configuration.getString("key1")).isEqualTo("value1"); }
@Test(expected = IllegalStateException.class) public void properties_file_not_found() throws Exception { System.setProperty(Constants.CONFIG_PROP_FILE_... |
ConfigurationProvider implements Provider<Configuration> { public String getPropertyFilePath() { return propertyFilePath; } ConfigurationProvider(); @Override Configuration get(); String getPropertyFilePath(); } | @Test public void getPropertyFilePath() throws Exception { assertThat(configurationProvider.getPropertyFilePath()).isEqualTo(path); } |
ElasticSearchModule extends AbstractModule { @Override protected void configure() { bind(Configuration.class).toProvider(ConfigurationProvider.class).in(Singleton.class); bind(TransportClient.class).toProvider(TransportClientProvider.class).in(Singleton.class); bind(JsonFormat.Printer.class).toInstance(JsonFormat.print... | @Test public void testConfigure() throws Exception { Injector injector = Guice.createInjector(new ElasticSearchModule()); Configuration configuration = injector.getInstance(Configuration.class); assertThat(configuration.getString("key1")).isEqualTo("value1"); } |
LoginViewModel extends BaseViewModel<LoginNavigator> { public void login(String email, String password) { setIsLoading(true); getCompositeDisposable().add(getDataManager() .doServerLoginApiCall(new LoginRequest.ServerLoginRequest(email, password)) .doOnSuccess(response -> getDataManager() .updateUserInfo( response.getA... | @Test public void testServerLoginSuccess() { String email = "dummy@gmail.com"; String password = "password"; LoginResponse loginResponse = new LoginResponse(); doReturn(Single.just(loginResponse)) .when(mMockDataManager) .doServerLoginApiCall(new LoginRequest.ServerLoginRequest(email, password)); mLoginViewModel.login(... |
RAMLtoSwagger implements Constants { @SuppressWarnings("WeakerAccess, unused") public String convertToSwagger(String raml) { return convertToSwagger(raml, null); } RAMLtoSwagger(); @SuppressWarnings("WeakerAccess, unused") String convertToSwagger(String raml); @SuppressWarnings("WeakerAccess, unused") String convertToS... | @Test @SuppressWarnings("unchecked") public void convertToSwaggerValidJson() throws Exception { String raml = IOUtils.resourceToString("/product-api.raml", Charset.forName("UTF-8")); Assert.assertNotNull(raml); String swagger = raml2Swagger.convertToSwagger(raml); Assert.assertNotNull(swagger); TypeReference<HashMap<St... |
HoneycombDOMRpcService implements DOMRpcService { @Nonnull @Override public FluentFuture<DOMRpcResult> invokeRpc(@Nonnull final SchemaPath schemaPath, @Nullable final NormalizedNode<?, ?> normalizedNode) { DataObject input = null; if (normalizedNode != null) { final SchemaPath nodePatch = schemaPath.createChild(normali... | @Test public void testInvokeRpc() throws Exception { final ContainerNode outputBi = mock(ContainerNode.class); final DataObject outputBa = mock(DataObject.class); when(serializer.toNormalizedNodeRpcData(ArgumentMatchers.any())).thenReturn(outputBi); when(registry.invoke(path, input)).thenReturn(CompletableFuture.comple... |
HoneycombNotificationCollector implements NotificationCollector, AutoCloseable { @Override @Nonnull public Collection<Class<? extends Notification>> getNotificationTypes() { return notificationProducerRegistry.getNotificationTypes(); } HoneycombNotificationCollector(
@Nonnull final NotificationPublishService bi... | @Test public void testNotificationTypes() throws Exception { final HoneycombNotificationCollector honeycombNotificationCollector = new HoneycombNotificationCollector(notificationService, notificationRegistry); honeycombNotificationCollector.getNotificationTypes(); verify(producer, atLeast(1)).getNotificationTypes(); } |
HoneycombNotificationCollector implements NotificationCollector, AutoCloseable { @Override public void onNotification(@Nonnull final Notification notification) { LOG.debug("Notification: {} pushed into collector", notification.getClass().getSimpleName()); LOG.trace("Notification: {} pushed into collector", notification... | @Test public void testCollect() throws Exception { final HoneycombNotificationCollector honeycombNotificationCollector = new HoneycombNotificationCollector(notificationService, notificationRegistry); final NetconfSessionStart notif = new NetconfSessionStartBuilder().build(); honeycombNotificationCollector.onNotificatio... |
NotificationProducerRegistry { Set<Class<? extends Notification>> getNotificationTypes() { return notificationTypes; } NotificationProducerRegistry(final List<ManagedNotificationProducer> notificationProducersDependency); static QName getQName(final Class<? extends Notification> aClass); } | @Test public void testNotificationTypes() throws Exception { final NotificationProducerRegistry notificationRegistry = new NotificationProducerRegistry(Lists.newArrayList(producer, producer2)); final Set<Class<? extends Notification>> notificationTypes = notificationRegistry.getNotificationTypes(); Assert.assertThat(no... |
PersistingDataTreeAdapter implements DataTree { @Override public DataTreeSnapshot takeSnapshot() { return delegateDependency.takeSnapshot(); } PersistingDataTreeAdapter(@Nonnull final DataTree delegate,
@Nonnull final DOMSchemaService schemaService,
... | @Test public void testTakeSnapshot() throws Exception { persistingDataTreeAdapter.takeSnapshot(); verify(delegatingDataTree).takeSnapshot(); } |
PersistingDataTreeAdapter implements DataTree { @Override public void setSchemaContext(final SchemaContext schemaContext) { delegateDependency.setSchemaContext(schemaContext); } PersistingDataTreeAdapter(@Nonnull final DataTree delegate,
@Nonnull final DOMSchemaService schemaService... | @Test public void testSetSchema() throws Exception { persistingDataTreeAdapter.setSchemaContext(null); verify(delegatingDataTree).setSchemaContext(null); } |
PersistingDataTreeAdapter implements DataTree { @Override public void validate(final DataTreeModification dataTreeModification) throws DataValidationFailedException { delegateDependency.validate(dataTreeModification); } PersistingDataTreeAdapter(@Nonnull final DataTree delegate,
@No... | @Test public void testValidate() throws Exception { persistingDataTreeAdapter.validate(null); verify(delegatingDataTree).validate(null); } |
PersistingDataTreeAdapter implements DataTree { @Override public DataTreeCandidateTip prepare( final DataTreeModification dataTreeModification) { return delegateDependency.prepare(dataTreeModification); } PersistingDataTreeAdapter(@Nonnull final DataTree delegate,
@Nonnull final DOM... | @Test public void testPrepare() throws Exception { persistingDataTreeAdapter.prepare(null); verify(delegatingDataTree).prepare(null); } |
PersistingDataTreeAdapter implements DataTree { @Override public YangInstanceIdentifier getRootPath() { return delegateDependency.getRootPath(); } PersistingDataTreeAdapter(@Nonnull final DataTree delegate,
@Nonnull final DOMSchemaService schemaService,
... | @Test public void testGetRootPath() throws Exception { persistingDataTreeAdapter.getRootPath(); verify(delegatingDataTree).getRootPath(); } |
ReadWriteTransaction implements DOMDataTreeReadWriteTransaction, ValidableTransaction { @Override public boolean cancel() { delegateReadTx.close(); return delegateWriteTx.cancel(); } ReadWriteTransaction(@Nonnull final DOMDataTreeReadTransaction delegateReadTx,
@Nonnull final ValidableTransacti... | @Test public void testCancel() { readWriteTx.cancel(); verify(writeTx).cancel(); } |
ReadWriteTransaction implements DOMDataTreeReadWriteTransaction, ValidableTransaction { @Override public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) { delegateWriteTx.put(store, path, data); } ReadWriteTransaction(@Nonnull final DOMDataTreeReadTransacti... | @Test public void testPut() { readWriteTx.put(store, path, data); verify(writeTx).put(store, path, data); } |
RestoringInitializer implements DataTreeInitializer { @Override public void initialize() throws InitializeException { LOG.debug("Starting restoration of {} from {} using {}", dataTree, path, restorationType); if (!Files.exists(path)) { LOG.debug("Persist file {} does not exist. Skipping restoration", path); return; } t... | @Test public void testMergeConfig() throws Exception { final RestoringInitializer init = new RestoringInitializer(schemaService, path, dataTree, RestoringInitializer.RestorationType.Merge, LogicalDatastoreType.CONFIGURATION, jsonReader); init.initialize(); verify(writeTx).merge(LogicalDatastoreType.CONFIGURATION, YangI... |
ReadWriteTransaction implements DOMDataTreeReadWriteTransaction, ValidableTransaction { @Override public void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) { delegateWriteTx.merge(store, path, data); } ReadWriteTransaction(@Nonnull final DOMDataTreeReadTrans... | @Test public void testMerge() { readWriteTx.merge(store, path, data); verify(writeTx).merge(store, path, data); } |
ReadWriteTransaction implements DOMDataTreeReadWriteTransaction, ValidableTransaction { @Override public void delete(final LogicalDatastoreType store, final YangInstanceIdentifier path) { delegateWriteTx.delete(store, path); } ReadWriteTransaction(@Nonnull final DOMDataTreeReadTransaction delegateReadTx,
... | @Test public void testDelete() { readWriteTx.delete(store, path); verify(writeTx).delete(store, path); } |
ReadWriteTransaction implements DOMDataTreeReadWriteTransaction, ValidableTransaction { @Override public FluentFuture<? extends CommitInfo> commit() { return delegateWriteTx.commit(); } ReadWriteTransaction(@Nonnull final DOMDataTreeReadTransaction delegateReadTx,
@Nonnull final ValidableTransa... | @Test public void testCommit() { readWriteTx.commit(); verify(writeTx).commit(); } |
ReadWriteTransaction implements DOMDataTreeReadWriteTransaction, ValidableTransaction { @Override public FluentFuture<Optional<NormalizedNode<?, ?>>> read(final LogicalDatastoreType store, final YangInstanceIdentifier path) { return delegateReadTx.read(store, path); } ReadWriteTransaction(@Nonnull final DOMDataTreeRead... | @Test public void testRead() { readWriteTx.read(store, path); verify(readTx).read(store, path); } |
ReadWriteTransaction implements DOMDataTreeReadWriteTransaction, ValidableTransaction { @Override public FluentFuture<Boolean> exists(final LogicalDatastoreType store, final YangInstanceIdentifier path) { return delegateReadTx.exists(store, path); } ReadWriteTransaction(@Nonnull final DOMDataTreeReadTransaction delegat... | @Test public void testExists() { readWriteTx.exists(store, path); verify(readTx).exists(store, path); } |
ReadWriteTransaction implements DOMDataTreeReadWriteTransaction, ValidableTransaction { @Override public Object getIdentifier() { return this; } ReadWriteTransaction(@Nonnull final DOMDataTreeReadTransaction delegateReadTx,
@Nonnull final ValidableTransaction delegateWriteTx); @Override boolean... | @Test public void testGetIdentifier() { assertNotNull(readWriteTx.getIdentifier()); } |
ReadOnlyTransaction implements DOMDataTreeReadTransaction { @Override public FluentFuture<Boolean> exists(final LogicalDatastoreType store, final YangInstanceIdentifier path) { LOG.debug("ReadOnlyTransaction.exists() store={}, path={}", store, path); ListenableFuture<Boolean> listenableFuture = Futures.transform(read(s... | @Test public void testExists() { final YangInstanceIdentifier path = mock(YangInstanceIdentifier.class); final FluentFuture<Optional<NormalizedNode<?, ?>>> future = mock(FluentFuture.class); when(operationalData.read(path)).thenReturn(future); readOnlyTx.exists(LogicalDatastoreType.OPERATIONAL, path); verify(operationa... |
ReadOnlyTransaction implements DOMDataTreeReadTransaction { @Nonnull @Override public Object getIdentifier() { return this; } private ReadOnlyTransaction(@Nullable final DataModification configData,
@Nullable final ReadableDataManager operationalData); @Override synchronized void close(... | @Test public void testGetIdentifier() { assertNotNull(readOnlyTx.getIdentifier()); } |
ModifiableDataTreeDelegator extends ModifiableDataTreeManager { @Override public DataModification newModification() { return new DelegatingConfigSnapshot(super.newModification()); } ModifiableDataTreeDelegator(@Nonnull final BindingNormalizedNodeSerializer serializer,
@Nonnull fin... | @Test public void testRead() throws Exception { final ContainerNode topContainer = getTopContainer("topContainer"); addNodeToTree(dataTree, topContainer, TOP_CONTAINER_ID); final FluentFuture<Optional<NormalizedNode<?, ?>>> read = configDataTree.read(TOP_CONTAINER_ID); final FluentFuture<Optional<NormalizedNode<?, ?>>>... |
ModifiableDataTreeDelegator extends ModifiableDataTreeManager { @VisibleForTesting static WriterRegistry.DataObjectUpdates toBindingAware( final WriterRegistry registry, final Map<YangInstanceIdentifier, NormalizedNodeUpdate> biNodes, final BindingNormalizedNodeSerializer serializer) { final Multimap<InstanceIdentifier... | @Test public void testToBindingAware() throws Exception { when(serializer.fromNormalizedNode(any(YangInstanceIdentifier.class), eq(null))).thenReturn(null); when(writer.writerSupportsUpdate(any())).thenReturn(true); final Map<YangInstanceIdentifier, NormalizedNodeUpdate> biNodes = new HashMap<>(); final QName nn1 = QNa... |
WriteTransaction implements ValidableTransaction { @Override public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) { LOG.debug("WriteTransaction.put() store={}, path={}, data={}", store, path, data); checkIsNew(); handleOperation(store, (modification) -> m... | @Test public void testPut() { writeTx.put(LogicalDatastoreType.CONFIGURATION, path, data); verify(configSnapshot).write(path, data); }
@Test(expected = IllegalArgumentException.class) public void testPutOperational() { writeTx.put(LogicalDatastoreType.OPERATIONAL, path, data); verify(configSnapshot).write(path, data); ... |
WriteTransaction implements ValidableTransaction { @Override public void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) { LOG.debug("WriteTransaction.merge() store={}, path={}, data={}", store, path, data); checkIsNew(); handleOperation(store, (modification) ... | @Test public void testMerge() { writeTx.merge(LogicalDatastoreType.CONFIGURATION, path, data); verify(configSnapshot).merge(path, data); } |
WriteTransaction implements ValidableTransaction { @Override public boolean cancel() { if (status != TransactionStatus.NEW) { return false; } else { if (configModification != null) { configModification.close(); } status = TransactionStatus.CANCELED; return true; } } private WriteTransaction(@Nullable final DataModific... | @Test public void testCancel() { assertTrue(writeTx.cancel()); } |
WriteTransaction implements ValidableTransaction { @Override public void delete(LogicalDatastoreType store, final YangInstanceIdentifier path) { LOG.debug("WriteTransaction.delete() store={}, path={}", store, path); checkIsNew(); handleOperation(store, (modification) -> modification.delete(path)); } private WriteTrans... | @Test public void testDelete() { writeTx.delete(LogicalDatastoreType.CONFIGURATION, path); verify(configSnapshot).delete(path); } |
WriteTransaction implements ValidableTransaction { @Override public @NonNull FluentFuture<? extends CommitInfo> commit() { LOG.trace("WriteTransaction.commit()"); checkIsNew(); try { doCommit(); } catch (Exception e) { status = TransactionStatus.FAILED; LOG.error("Submit failed", e); return FluentFuture .from(Futures.i... | @Test public void testSubmit() throws Exception { writeTx.commit(); verify(configSnapshot).commit(); }
@Test public void testSubmitFailed() throws Exception { doThrow(mock(ValidationFailedException.class)).when(configSnapshot).commit(); final FluentFuture<? extends CommitInfo> future = writeTx.commit(); try { future.ge... |
WriteTransaction implements ValidableTransaction { @Override public Object getIdentifier() { return this; } private WriteTransaction(@Nullable final DataModification configModification,
@Nullable final DataModification operationalModification); @Override void put(final LogicalDatastoreType... | @Test public void testGetIdentifier() { assertNotNull(writeTx.getIdentifier()); } |
DataBroker implements DOMDataBroker, Closeable { @Override public DOMDataTreeReadWriteTransaction newReadWriteTransaction() { LOG.trace("DataBroker({}).newReadWriteTransaction()", this); return transactionFactory.newReadWriteTransaction(); } DataBroker(final TransactionFactory transactionFactory); @Override DOMDataTree... | @Test public void testNewReadWriteTransaction() { final DOMDataTreeReadWriteTransaction readWriteTx = broker.newReadWriteTransaction(); final YangInstanceIdentifier path = mock(YangInstanceIdentifier.class); readWriteTx.read(LogicalDatastoreType.CONFIGURATION, path); verify(configSnapshot).read(path); verify(confiDataT... |
DataBroker implements DOMDataBroker, Closeable { @Override public DOMDataTreeWriteTransaction newWriteOnlyTransaction() { LOG.trace("DataBroker({}).newWriteTransaction()", this); return transactionFactory.newWriteTransaction(); } DataBroker(final TransactionFactory transactionFactory); @Override DOMDataTreeReadTransact... | @Test public void testNewWriteOnlyTransaction() { broker.newWriteOnlyTransaction(); verify(confiDataTree).newModification(); } |
DataBroker implements DOMDataBroker, Closeable { @Override public DOMDataTreeReadTransaction newReadOnlyTransaction() { LOG.trace("DataBroker({}).newReadTransaction()", this); return transactionFactory.newReadTransaction(); } DataBroker(final TransactionFactory transactionFactory); @Override DOMDataTreeReadTransaction ... | @Test public void testNewReadOnlyTransaction() { final DOMDataTreeReadTransaction readTx = broker.newReadOnlyTransaction(); final YangInstanceIdentifier path = mock(YangInstanceIdentifier.class); readTx.read(LogicalDatastoreType.CONFIGURATION, path); verify(configSnapshot).read(path); } |
DataBroker implements DOMDataBroker, Closeable { @Override public DOMTransactionChain createTransactionChain(final DOMTransactionChainListener listener) { throw new UnsupportedOperationException("Not supported"); } DataBroker(final TransactionFactory transactionFactory); @Override DOMDataTreeReadTransaction newReadOnly... | @Test(expected = UnsupportedOperationException.class) public void testCreateTransactionChain() { final DOMTransactionChainListener listener = mock(DOMTransactionChainListener.class); broker.createTransactionChain(listener); } |
DataBroker implements DOMDataBroker, Closeable { @Override public @NonNull ClassToInstanceMap<DOMDataBrokerExtension> getExtensions() { return ImmutableClassToInstanceMap.of(DOMDataTransactionValidator.class, tx -> ((ValidableTransaction) tx).validate()); } DataBroker(final TransactionFactory transactionFactory); @Over... | @Test public void testGetSupportedExtensions() { final @NonNull ClassToInstanceMap<DOMDataBrokerExtension> supportedExtensions = broker.getExtensions(); assertEquals(1, supportedExtensions.size()); assertNotNull(supportedExtensions.get(DOMDataTransactionValidator.class)); } |
Reverter { void revert(@Nonnull final WriteContext writeContext) throws RevertFailedException { checkNotNull(writeContext, "Cannot revert changes for null context"); final WriterRegistry.DataObjectUpdates revertedAndMapped = revertAndMapProcessed(revertOrder(toBeReverted)); LOG.info("Attempting revert for changes: {}",... | @Test public void revertSingle() throws Exception { final DataObjectUpdate create = DataObjectUpdate.create(IID_0, null, mock(DataObject.class)); new Reverter(ImmutableList.of(create), registry).revert(writeContext); assertSingleRevert(create); }
@Test public void revertSingleFailed() throws TranslationException { fina... |
FlatWriterRegistryBuilder extends AbstractSubtreeManagerRegistryBuilderBuilder<Writer<? extends DataObject>, WriterRegistry> implements ModifiableWriterRegistryBuilder, WriterRegistryBuilder { @VisibleForTesting @Override protected ImmutableMap<InstanceIdentifier<?>, Writer<? extends DataObject>> getMappedHandlers() { ... | @Test public void testRelationsBefore() throws Exception { final FlatWriterRegistryBuilder flatWriterRegistryBuilder = new FlatWriterRegistryBuilder(new YangDAG()); flatWriterRegistryBuilder.add(mockWriter(DataObjects.DataObject3.class)); flatWriterRegistryBuilder.add(mockWriter(DataObjects.DataObject4.class)); flatWri... |
ReadableDataTreeDelegator implements ReadableDataManager { private Optional<NormalizedNode<?, ?>> readNode(final YangInstanceIdentifier yangInstanceIdentifier, final ReadContext ctx) throws ReadFailedException { LOG.debug("OperationalDataTree.readNode(), yangInstanceIdentifier={}", yangInstanceIdentifier); final Instan... | @Test public void testReadNode() throws Exception { final YangInstanceIdentifier yangId = mock(YangInstanceIdentifier.class); final YangInstanceIdentifier.PathArgument pArg = mock(YangInstanceIdentifier.PathArgument.class); doReturn(pArg).when(yangId).getLastPathArgument(); doReturn(Collections.singletonList(pArg)).whe... |
ReadableDataTreeDelegator implements ReadableDataManager { @Override public FluentFuture<Optional<NormalizedNode<?, ?>>> read( @Nonnull final YangInstanceIdentifier yangInstanceIdentifier) { try (TransactionMappingContext mappingContext = new TransactionMappingContext( contextBroker.newReadWriteTransaction()); ReadCont... | @Test public void testReadNonExistingNode() throws Exception { final YangInstanceIdentifier yangId = mock(YangInstanceIdentifier.class); doReturn(id).when(serializer).fromYangInstanceIdentifier(yangId); doReturn(Optional.empty()).when(reader).read(same(id), any(ReadContext.class)); final FluentFuture<Optional<Normalize... |
ReadableDataTreeDelegator implements ReadableDataManager { @VisibleForTesting static DataContainerChild<?, ?> wrapListIntoMixinNode( final Collection<NormalizedNode<?, ?>> normalizedRootElements, final ListSchemaNode listSchema) { if (listSchema.getKeyDefinition().isEmpty()) { final CollectionNodeBuilder<UnkeyedListEnt... | @Test public void testWrapMixin() throws Exception { final QName nodeQName = QName.create("namespace", "node"); final QName keyQName = QName.create("namespace", "key"); final List<NormalizedNode<?, ?>> mapNodes = Lists.newArrayList("one", "two", "three").stream() .map(value -> ImmutableNodes.mapEntry(nodeQName, keyQNam... |
ModificationDiff { Map<YangInstanceIdentifier, NormalizedNodeUpdate> getUpdates() { return updates; } private ModificationDiff(@Nonnull Map<YangInstanceIdentifier, NormalizedNodeUpdate> updates); @Override String toString(); } | @Test public void testInitialWrite() throws Exception { final DataTree dataTree = getDataTree(); final DataTreeModification dataTreeModification = getModification(dataTree); final NormalizedNode<?, ?> topContainer = getTopContainer("string1"); final YangInstanceIdentifier TOP_CONTAINER_ID = YangInstanceIdentifier.of(TO... |
FlatWriterRegistryBuilder extends AbstractSubtreeManagerRegistryBuilderBuilder<Writer<? extends DataObject>, WriterRegistry> implements ModifiableWriterRegistryBuilder, WriterRegistryBuilder { @Override public WriterRegistry build() { final ImmutableMap<InstanceIdentifier<?>, Writer<?>> mappedWriters = getMappedHandler... | @Test public void testBuild() throws Exception { final FlatWriterRegistryBuilder flatWriterRegistryBuilder = new FlatWriterRegistryBuilder(new YangDAG()); final Writer<? extends DataObject> writer = mockWriter(DataObjects.DataObject3.class); flatWriterRegistryBuilder.add(writer); final WriterRegistry build = flatWriter... |
YangModuleWhitelistReader extends JAXBContextHolder { @Nonnull public YangModuleWhitelist read(@Nonnull final Path path) { final Unmarshaller unmarshaller = createUnmarshaller(); return YangModuleWhitelist.class.cast(readWhitelist(path, unmarshaller)); } YangModuleWhitelistReader(); @Nonnull YangModuleWhitelist read(@N... | @Test public void read() throws Exception { final YangModuleWhitelist whitelist = reader.read( Paths.get(this.getClass().getClassLoader().getResource("expected-whitelist.xml").getPath())); assertNotNull(whitelist); final List<Module> modules = whitelist.getModules(); assertEquals(2, modules.size()); final Module module... |
YangModuleWhitelistWriter extends JAXBContextHolder { public void write(@Nonnull final YangModuleWhitelist whitelist, @Nonnull final Path outPath, final boolean formatOutput) { Objects.requireNonNull(whitelist, "Cannot white null whitelist"); final Marshaller marshaller = createMarshaller(getCtx()); setupPrettyPrint(ma... | @Test public void write() throws Exception { final Module moduleA = new Module(); final Module moduleB = new Module(); moduleA.setPckg("module.a.package"); moduleA.setDescription("desc"); moduleB.setPckg("module.b.package"); final YangModuleWhitelist whitelist = new YangModuleWhitelist(); whitelist.setModules(Immutable... |
SubtreeWriter implements Writer<D> { static Writer<?> createForWriter(@Nonnull final Set<InstanceIdentifier<?>> handledChildren, @Nonnull final Writer<? extends DataObject> writer) { return new SubtreeWriter<>(writer, handledChildren); } private SubtreeWriter(final Writer<D> delegate, final Set<InstanceIdentifier<?>> ... | @Test(expected = IllegalArgumentException.class) public void testSubtreeWriterCreationFail() throws Exception { SubtreeWriter.createForWriter(Collections.singleton(InstanceIdentifier.create(DataObject.class)), writer); }
@Test(expected = IllegalArgumentException.class) public void testSubtreeWriterCreationFailInvalidIi... |
SubtreeWriter implements Writer<D> { @Override public boolean canProcess(@Nonnull final InstanceIdentifier<? extends DataObject> instanceIdentifier) { if (isWildcarded) { final Class<D> parent = delegate.getManagedDataObjectType().getTargetType(); for (InstanceIdentifier.PathArgument pathArgument : instanceIdentifier.g... | @Test public void testCanHandleChild() throws Exception { final SubtreeWriter<?> forWriter = createSubtreeWriter(); InstanceIdentifier<DataObjects.DataObject4.DataObject41.DataObject411> testIid = InstanceIdentifier.create( DataObjects.DataObject4.class).child(DataObjects.DataObject4.DataObject41.class).child( DataObje... |
FlatWriterRegistry implements WriterRegistry { static Collection<DataObjectUpdate> getParentDataObjectUpdate(final WriteContext ctx, final Multimap<InstanceIdentifier<?>, ? extends DataObjectUpdate> updates, final Writer<?> writer) { return ((SubtreeWriter<?>) writer).getHandledChildTypes().stream() .filter(updates::co... | @Test public void testSubtreeWriterUpdateAggregation() throws Exception { Multimap<InstanceIdentifier<?>, DataObjectUpdate> updates = HashMultimap.create(); when(ctx.readAfter(DataObject1.IID)).thenReturn(Optional.of(mock(DataObject1.class))); when(ctx.readBefore(DataObject1.IID)).thenReturn(Optional.of(mock(DataObject... |
FlatWriterRegistry implements WriterRegistry { @Override public void processModifications(@Nonnull final DataObjectUpdates updates, @Nonnull final WriteContext ctx) throws TranslationException { if (updates.isEmpty()) { return; } final List<DataObjectUpdate> alreadyProcessed = new LinkedList<>(); if (updates.containsOn... | @Test public void testMultipleUpdatesForSingleWriter() throws Exception { final FlatWriterRegistry flatWriterRegistry = new FlatWriterRegistry(ImmutableMap.of(DataObject1.IID, writer1, DataObject2.IID, writer2)); final Multimap<InstanceIdentifier<?>, DataObjectUpdate> updates = HashMultimap.create(); final InstanceIden... |
FlatWriterRegistry implements WriterRegistry { @Override public void validateModifications(@Nonnull final DataObjectUpdates updates, @Nonnull final WriteContext ctx) throws DataValidationFailedException { validateModifications(updates.getDeletes(), ctx); validateModifications(updates.getUpdates(), ctx); } FlatWriterReg... | @Test(expected = IllegalArgumentException.class) public void testValidateMissingWriter() throws Exception { final FlatWriterRegistry flatWriterRegistry = new FlatWriterRegistry(ImmutableMap.of(DataObject1.IID, writer1)); final Multimap<InstanceIdentifier<?>, DataObjectUpdate> updates = HashMultimap.create(); addUpdate(... |
GenericListWriter extends
AbstractGenericWriter<D> implements ListWriter<D, K> { @Override protected void writeCurrentAttributes(@Nonnull final InstanceIdentifier<D> id, @Nonnull final D data, @Nonnull final WriteContext ctx) throws WriteFailedException { try { customizer.writeCurrentAttributes(id, data, ctx); ... | @Test(expected = WriteFailedException.CreateFailedException.class) public void testWriteFail() throws Exception { doThrow(new IllegalStateException("test")).when(customizer).writeCurrentAttributes(DATA_OBJECT_ID, after, ctx); writer = new GenericListWriter<>(DATA_OBJECT_ID, customizer); writer.writeCurrentAttributes(DA... |
GenericListWriter extends
AbstractGenericWriter<D> implements ListWriter<D, K> { @Override protected void updateCurrentAttributes(@Nonnull final InstanceIdentifier<D> id, @Nonnull final D dataBefore, @Nonnull final D dataAfter, @Nonnull final WriteContext ctx) throws WriteFailedException { try { customizer.upda... | @Test(expected = WriteFailedException.UpdateFailedException.class) public void testUpdateFail() throws Exception { doThrow(new IllegalStateException("test")).when(customizer) .updateCurrentAttributes(DATA_OBJECT_ID, before, after, ctx); writer = new GenericListWriter<>(DATA_OBJECT_ID, customizer); writer.updateCurrentA... |
GenericListWriter extends
AbstractGenericWriter<D> implements ListWriter<D, K> { @Override protected void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<D> id, @Nonnull final D dataBefore, @Nonnull final WriteContext ctx) throws WriteFailedException { try { customizer.deleteCurrentAttributes(id, data... | @Test(expected = WriteFailedException.DeleteFailedException.class) public void testDeleteFail() throws Exception { doThrow(new IllegalStateException("test")).when(customizer) .deleteCurrentAttributes(DATA_OBJECT_ID, before, ctx); writer = new GenericListWriter<>(DATA_OBJECT_ID, customizer); writer.deleteCurrentAttribut... |
GenericWriter extends AbstractGenericWriter<D> { @Override protected void writeCurrentAttributes(@Nonnull final InstanceIdentifier<D> id, @Nonnull final D data, @Nonnull final WriteContext ctx) throws WriteFailedException { try { customizer.writeCurrentAttributes(id, data, ctx); } catch (RuntimeException e) { throw new... | @Test(expected = WriteFailedException.CreateFailedException.class) public void testWriteFail() throws Exception { doThrow(new IllegalStateException("test")).when(customizer).writeCurrentAttributes(DATA_OBJECT_ID, after, ctx); writer = new GenericWriter<>(DATA_OBJECT_ID, customizer); writer.writeCurrentAttributes(DATA_O... |
GenericWriter extends AbstractGenericWriter<D> { @Override protected void updateCurrentAttributes(@Nonnull final InstanceIdentifier<D> id, @Nonnull final D dataBefore, @Nonnull final D dataAfter, @Nonnull final WriteContext ctx) throws WriteFailedException { try { customizer.updateCurrentAttributes(id, dataBefore, data... | @Test(expected = WriteFailedException.UpdateFailedException.class) public void testUpdateFail() throws Exception { doThrow(new IllegalStateException("test")).when(customizer) .updateCurrentAttributes(DATA_OBJECT_ID, before, after, ctx); writer = new GenericWriter<>(DATA_OBJECT_ID, customizer); writer.updateCurrentAttri... |
WriteFailedException extends TranslationException { @Nonnull public InstanceIdentifier<?> getFailedId() { return failedId; } WriteFailedException(@Nonnull final InstanceIdentifier<?> failedId,
@Nonnull final String message,
@Nonnull final Throwable cause);... | @Test public void testCreateFailed() throws Exception { final WriteFailedException.CreateFailedException cause = new WriteFailedException.CreateFailedException(id, dataAfter); final WriteFailedException.CreateFailedException createFailedException = new WriteFailedException.CreateFailedException(id, dataAfter, cause); a... |
GenericWriter extends AbstractGenericWriter<D> { @Override protected void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<D> id, @Nonnull final D dataBefore, @Nonnull final WriteContext ctx) throws WriteFailedException { try { customizer.deleteCurrentAttributes(id, dataBefore, ctx); } catch (RuntimeException ... | @Test(expected = WriteFailedException.DeleteFailedException.class) public void testDeleteFail() throws Exception { doThrow(new IllegalStateException("test")).when(customizer) .deleteCurrentAttributes(DATA_OBJECT_ID, before, ctx); writer = new GenericWriter<>(DATA_OBJECT_ID, customizer); writer.deleteCurrentAttributes(D... |
GenericWriter extends AbstractGenericWriter<D> { static boolean isUpdateSupported(final @Nonnull WriterCustomizer<?> customizer) { try { final Class<? extends WriterCustomizer> customizerClass = customizer.getClass(); final Class<?> updateDeclaringClass = customizerClass .getMethod(UPDATE_M, InstanceIdentifier.class, D... | @Test public void testUpdateSupported() { assertFalse(GenericWriter.isUpdateSupported(new NoopWriters.NonDirectUpdateWriterCustomizer())); assertTrue(GenericWriter.isUpdateSupported(new NoopWriters.DirectUpdateWriterCustomizer())); assertTrue(GenericWriter.isUpdateSupported(new NoopWriters.ParentImplDirectUpdateWriterC... |
GenericInitListReader extends GenericListReader<O, K, B> implements InitListReader<O, K, B> { @Override public void init(final DataBroker broker, final InstanceIdentifier<O> id, final ReadContext ctx) throws InitFailedException { LOG.debug("{}: Initializing current: {}", this, id); try { for (K k : getAllIds(id, ctx)) ... | @SuppressWarnings("unchecked") @Test public void testInit() throws Exception { final Initialized<TestingData> initialized = Initialized.create(DATA_OBJECT_ID, data); when(getCustomizer().isPresent(any(), any(), any())).thenReturn(true); doReturn(initialized).when(getCustomizer()).init(any(), any(), any()); when(writeTx... |
CompositeReader extends AbstractGenericReader<D, B> implements InitReader<D, B>, DelegatingReader<D, B> { @Nonnull @Override public Optional<? extends DataObject> read(@Nonnull final InstanceIdentifier<? extends DataObject> id, @Nonnull final ReadContext ctx) throws ReadFailedException { if (shouldReadCurrent(id)) { LO... | @Test public void testReadFallback() throws Exception { compositeReader.read(DataObjects.DataObject4.DataObject42.IID, ctx); verify(reader4).read(DataObjects.DataObject4.DataObject42.IID, ctx); verify(reader41, times(0)).read(any(InstanceIdentifier.class), any(ReadContext.class)); } |
CompositeReaderRegistry implements ReaderRegistry { @Override @Nonnull public Multimap<InstanceIdentifier<? extends DataObject>, ? extends DataObject> readAll( @Nonnull final ReadContext ctx) throws ReadFailedException { LOG.debug("Reading from all delegates: {}", this); LOG.trace("Reading from all delegates: {}", root... | @Test public void testReadAll() throws Exception { reg.readAll(ctx); final InOrder inOrder = inOrder(rootReader3, rootReader4, reader31, reader41); inOrder.verify(rootReader3).read(any(InstanceIdentifier.class), any(ReadContext.class)); inOrder.verify(reader31).read(any(InstanceIdentifier.class), any(ReadContext.class)... |
CompositeReaderRegistry implements ReaderRegistry { @Nonnull @Override public Optional<? extends DataObject> read(@Nonnull final InstanceIdentifier<? extends DataObject> id, @Nonnull final ReadContext ctx) throws ReadFailedException { final InstanceIdentifier.PathArgument first = checkNotNull( Iterables.getFirst(id.get... | @Test public void testReadSingleRoot() throws Exception { reg.read(DataObject3.IID, ctx); final InOrder inOrder = inOrder(rootReader3, rootReader4, reader31, reader41); inOrder.verify(rootReader3).read(any(InstanceIdentifier.class), any(ReadContext.class)); inOrder.verify(reader31).read(any(InstanceIdentifier.class), a... |
SubtreeReader implements DelegatingReader<D, B> { static <D extends DataObject, B extends Builder<D>> Reader<D, B> createForReader(@Nonnull final Set<InstanceIdentifier<?>> handledChildren, @Nonnull final Reader<D, B> reader) { return (reader instanceof ListReader) ? new SubtreeListReader<>((ListReader) reader, handled... | @Test(expected = IllegalArgumentException.class) public void testCreateInvalid() throws Exception { SubtreeReader.createForReader(Sets.newHashSet(DataObjects.DataObject1.IID), delegate); } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.