feat: Add native binary analyzer test utilities and implement SM2 signing tests
Some checks failed
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
Manifest Integrity / Audit SHA256SUMS Files (push) Has been cancelled
Manifest Integrity / Validate Schema Integrity (push) Has been cancelled
Manifest Integrity / Validate Contract Documents (push) Has been cancelled
Manifest Integrity / Validate Pack Fixtures (push) Has been cancelled
Manifest Integrity / Verify Merkle Roots (push) Has been cancelled
Scanner Analyzers / Build Analyzers (push) Has been cancelled
Scanner Analyzers / Discover Analyzers (push) Has been cancelled
Scanner Analyzers / Test Language Analyzers (push) Has been cancelled
Scanner Analyzers / Validate Test Fixtures (push) Has been cancelled
Scanner Analyzers / Verify Deterministic Output (push) Has been cancelled
Signals CI & Image / signals-ci (push) Has been cancelled
Concelier Attestation Tests / attestation-tests (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
Export Center CI / export-ci (push) Has been cancelled
Notify Smoke Test / Notify Unit Tests (push) Has been cancelled
Notify Smoke Test / Notifier Service Tests (push) Has been cancelled
Notify Smoke Test / Notification Smoke Test (push) Has been cancelled
Some checks failed
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
Manifest Integrity / Audit SHA256SUMS Files (push) Has been cancelled
Manifest Integrity / Validate Schema Integrity (push) Has been cancelled
Manifest Integrity / Validate Contract Documents (push) Has been cancelled
Manifest Integrity / Validate Pack Fixtures (push) Has been cancelled
Manifest Integrity / Verify Merkle Roots (push) Has been cancelled
Scanner Analyzers / Build Analyzers (push) Has been cancelled
Scanner Analyzers / Discover Analyzers (push) Has been cancelled
Scanner Analyzers / Test Language Analyzers (push) Has been cancelled
Scanner Analyzers / Validate Test Fixtures (push) Has been cancelled
Scanner Analyzers / Verify Deterministic Output (push) Has been cancelled
Signals CI & Image / signals-ci (push) Has been cancelled
Concelier Attestation Tests / attestation-tests (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
Export Center CI / export-ci (push) Has been cancelled
Notify Smoke Test / Notify Unit Tests (push) Has been cancelled
Notify Smoke Test / Notifier Service Tests (push) Has been cancelled
Notify Smoke Test / Notification Smoke Test (push) Has been cancelled
- Introduced `NativeTestBase` class for ELF, PE, and Mach-O binary parsing helpers and assertions. - Created `TestCryptoFactory` for SM2 cryptographic provider setup and key generation. - Implemented `Sm2SigningTests` to validate signing functionality with environment gate checks. - Developed console export service and store with comprehensive unit tests for export status management.
This commit is contained in:
83
src/app/core/console/console-export.service.ts
Normal file
83
src/app/core/console/console-export.service.ts
Normal file
@@ -0,0 +1,83 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { catchError, from, map, of, switchMap, tap } from 'rxjs';
|
||||
|
||||
import {
|
||||
ConsoleExportClient,
|
||||
} from '../api/console-export.client';
|
||||
import {
|
||||
ConsoleExportEvent,
|
||||
ConsoleExportRequest,
|
||||
ConsoleExportStatusDto,
|
||||
} from '../api/console-export.models';
|
||||
import { ConsoleExportStore } from './console-export.store';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ConsoleExportService {
|
||||
constructor(
|
||||
private readonly client: ConsoleExportClient,
|
||||
private readonly store: ConsoleExportStore
|
||||
) {}
|
||||
|
||||
startExport(
|
||||
request: ConsoleExportRequest,
|
||||
opts?: { tenantId?: string; traceId?: string; idempotencyKey?: string }
|
||||
) {
|
||||
this.store.setLoading(true);
|
||||
this.store.setError(null);
|
||||
return this.client.createExport(request, opts).pipe(
|
||||
tap((status) => this.store.setStatus(status)),
|
||||
tap(() => this.store.setLoading(false)),
|
||||
catchError((err) => {
|
||||
console.error('console export create failed', err);
|
||||
this.store.setError('Unable to start export');
|
||||
this.store.setLoading(false);
|
||||
return of(null as ConsoleExportStatusDto | null);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
refreshStatus(exportId: string, opts?: { tenantId?: string; traceId?: string }) {
|
||||
this.store.setLoading(true);
|
||||
this.store.setError(null);
|
||||
return this.client.getExport(exportId, opts).pipe(
|
||||
tap((status) => this.store.setStatus(status)),
|
||||
tap(() => this.store.setLoading(false)),
|
||||
catchError((err) => {
|
||||
console.error('console export status failed', err);
|
||||
this.store.setError('Unable to load export status');
|
||||
this.store.setLoading(false);
|
||||
return of(null as ConsoleExportStatusDto | null);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
streamExport(exportId: string, opts?: { tenantId?: string; traceId?: string }) {
|
||||
this.store.clearEvents();
|
||||
return this.client.streamExport(exportId, opts).pipe(
|
||||
tap((evt: ConsoleExportEvent) => this.store.appendEvent(evt)),
|
||||
catchError((err) => {
|
||||
console.error('console export stream failed', err);
|
||||
this.store.setError('Export stream ended with error');
|
||||
return of(null as ConsoleExportEvent | null);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
get status() {
|
||||
return this.store.status;
|
||||
}
|
||||
|
||||
get loading() {
|
||||
return this.store.loading;
|
||||
}
|
||||
|
||||
get error() {
|
||||
return this.store.error;
|
||||
}
|
||||
|
||||
get events() {
|
||||
return this.store.events;
|
||||
}
|
||||
}
|
||||
49
src/app/core/console/console-export.store.ts
Normal file
49
src/app/core/console/console-export.store.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { Injectable, computed, signal } from '@angular/core';
|
||||
|
||||
import {
|
||||
ConsoleExportEvent,
|
||||
ConsoleExportStatusDto,
|
||||
} from '../api/console-export.models';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ConsoleExportStore {
|
||||
private readonly statusSignal = signal<ConsoleExportStatusDto | null>(null);
|
||||
private readonly loadingSignal = signal(false);
|
||||
private readonly errorSignal = signal<string | null>(null);
|
||||
private readonly eventsSignal = signal<ConsoleExportEvent[]>([]);
|
||||
|
||||
readonly status = computed(() => this.statusSignal());
|
||||
readonly loading = computed(() => this.loadingSignal());
|
||||
readonly error = computed(() => this.errorSignal());
|
||||
readonly events = computed(() => this.eventsSignal());
|
||||
|
||||
setLoading(value: boolean): void {
|
||||
this.loadingSignal.set(value);
|
||||
}
|
||||
|
||||
setError(message: string | null): void {
|
||||
this.errorSignal.set(message);
|
||||
}
|
||||
|
||||
setStatus(status: ConsoleExportStatusDto | null): void {
|
||||
this.statusSignal.set(status);
|
||||
}
|
||||
|
||||
appendEvent(evt: ConsoleExportEvent): void {
|
||||
const next = [...this.eventsSignal(), evt].slice(-100); // keep last 100 for UI
|
||||
this.eventsSignal.set(next);
|
||||
}
|
||||
|
||||
clearEvents(): void {
|
||||
this.eventsSignal.set([]);
|
||||
}
|
||||
|
||||
clear(): void {
|
||||
this.statusSignal.set(null);
|
||||
this.loadingSignal.set(false);
|
||||
this.errorSignal.set(null);
|
||||
this.eventsSignal.set([]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user