我有一个Flow需要字符串输入
@Bean
public IntegrationFlow myFlow() {
// @formatter:off
return IntegrationFlows.from("some.input.channel")
.handle(someService)
.get();
如何从集成测试中调用它,如何在“ some.input.channel”上放置字符串消息
答案 0 :(得分:1)
阅读您使用的API的Javadocs:
function exportExcel($userList,$clientLogo,$defaultLogo){
// Generate and return the spreadsheet
Excel::create('User_List', function ($excel) use ($userList,$clientLogo,$defaultLogo) {
// Set the spreadsheet title, creator, and description
$excel->setTitle('User List');
$excel->setCreator('CompanyName')->setCompany('CompanyName');
$excel->setDescription('User List Reports');
$excel->sheet('User List', function($sheet) use ($userList,$path,$clientLogo,$defaultLogo) {
//Set header with logo with different coloumn width & height
$objDrawing = new PHPExcel_Worksheet_Drawing;
$objDrawing->setPath(public_path('img/'.$defaultLogo));
$objDrawing->setCoordinates('A1');
$objDrawing->setWorksheet($sheet);
$objDrawing->setName('Client Logo');
$objDrawing->setResizeProportional(false);
$objDrawing->setWidth(100);
$objDrawing->setHeight(50);
$sheet->setSize('A1', 20, 50);
$objDrawing = new PHPExcel_Worksheet_Drawing;
$objDrawing->setPath(public_path('img/'.$clientLogo));
$objDrawing->setCoordinates('D1');
$objDrawing->setWorksheet($sheet);
$objDrawing->setName('Client Logo');
$objDrawing->setResizeProportional(false);
$objDrawing->setWidth(100);
$objDrawing->setHeight(50);
$sheet->setSize('D1', 20, 50);
$sheet->fromArray($userList, null, 'A2', false, false);
$sheet->cells('A1:D1', function($cells) {
$cells->setBackground('#36494F')->setFontColor('#FFFFF')->setFontWeight('bold');
});
$sheet->mergeCells('A1:D1');
$sheet->mergeCells('B1:C1');
$sheet->cell('B1', function($cell) {
$cell->setValue('User List')->setBackground('#36494F');
});
$sheet->row(1, function ($row) {
$row->setBackground('#36494F')->setFontColor('#FFFFFF')->setFontWeight('bold')->setValue('User Tickets List')->setAlignment('center')->setValignment('center');
});
$sheet->row(2, function ($row) {
$row->setBackground('#FFFFFF')->setFontColor('#36494F')->setFontWeight('bold')->setAlignment('center')->setValignment('center');
});
for ($i = 3; $i <= count($userList)+1; $i++) {
$sheet->cells('A'.$i.':D'.$i, function ($cells) use ($i) {
$cells->setBackground(($i%2) == 0 ? '#DCDCDC':'#EDEDEE');
});
}
for ($ascii = ord('A'); $ascii <= ord('D'); $ascii++) {
for ($i = 1; $i <= count($userList)+1; $i++) {
$sheet->cell(chr($ascii) . $i, function ($cell) {
$cell->setBorder('thin','thin','thin','thin');
});
}
}
});
})->download('xls');
}
然后打开您使用的框架的参考手册:
因此,由Java DSL创建的通道在应用程序上下文中成为bean。
将它们 autowire 插入测试类并从测试方法中调用其/**
* Populate the {@link MessageChannel} name to the new {@link IntegrationFlowBuilder} chain.
* The {@link org.springframework.integration.dsl.IntegrationFlow} {@code inputChannel}.
* @param messageChannelName the name of existing {@link MessageChannel} bean.
* The new {@link DirectChannel} bean will be created on context startup
* if there is no bean with this name.
* @return new {@link IntegrationFlowBuilder}.
*/
public static IntegrationFlowBuilder from(String messageChannelName) {
就足够了:
send()