我使用此命令创建了一个角度材质数据表ng generate @angular/material:material-table,它提供了以下文件结构:
这里的想法是在table-datasource.ts. 默认情况下,数据放置在内部的 Array 中,table-datasource.ts但在我的例子中,它来自 ngxs-store,它公开了Array 的 Observable。Atm 我有以下实现:
表数据源.ts:
export class TokenTableDataSource extends DataSource<TokenTableItem> {
@Select(TokenTableState.getTokenTableItems) private tokenTableItems$:Observable<TokenTableItem[]>;
totalItems$ = new BehaviorSubject<TokenTableItem[]>([]);
constructor(private paginator: MatPaginator, private sort: MatSort) {
super();
}
/**
* Connect this data source to the table. The table will only update when
* the returned stream emits new items.
* @returns A stream of the items to be rendered.
*/
connect(): Observable<TokenTableItem[]> …Run Code Online (Sandbox Code Playgroud) In the RxJs doc I found following code snippet:
[rxSubscriberSymbol]() {
return new SubjectSubscriber(this);
}
Run Code Online (Sandbox Code Playgroud)
Its part of the Subject source code and is the first method right after the constructor.
So what do square brackets mean in this context?
到目前为止我们正在使用这种方法如何更改Android模拟器中的移动国家代码(MCC)?更改SIM国家/地区值.由于我们使用API 24运行我们的模拟设备,因此模拟器保留默认的美国国家/地区代码.
这就是我们在gradle中运行它的方式:
tasks.withType(Test) {
systemProperties = System.getProperties()
systemProperty "buildDir", "${buildDir}"
systemProperty "file.encoding", "UTF8"
beforeTest {
logger.info "restoring android emulator SIM country to AT"
exec {
commandLine "bash", "-c", "source ~/.bash_profile && adb -e shell setprop gsm.sim.operator.iso-country at
ignoreExitValue true
}
}
}
Run Code Online (Sandbox Code Playgroud) 我们有自定义注释,例如
@AuthTokenRequired(Permissions.SOME_PERMISSION)
Run Code Online (Sandbox Code Playgroud)
或者
@ClientAppKeyRequired
Run Code Online (Sandbox Code Playgroud)
我们将其添加到 java 代码中的某些 REST-Endpoints 中。
这看起来像这样:
@Path("somePath")
@Consumes("application/json")
@Produces("application/json")
public class SomeResource {
@GET
@AuthTokenRequired(Permissions.SOME_PERMISSION)
@ClientAppKeyRequired
public Response getSomeData(){
//some code
}
@GET
@ClientAppKeyRequired
public Response getSomeOtherData(){
//some code
}
@DELETE
@AuthTokenRequired(Permissions.SOME_PERMISSION)
public Response deleteSomeData(){
//some code
}
}
Run Code Online (Sandbox Code Playgroud)
我们想要测试的是这些端点是否在方法级别上正确注释。
我们使用 JUnit4、MockitoJunit 和 Hamcrest 进行断言。也可以使用 Powermock,但我们不想这样做。
javascript ×2
adb ×1
android ×1
angular ×1
appium ×1
ecmascript-6 ×1
java ×1
junit ×1
rest ×1
rxjs ×1