@JsonProperty("target_uri")
public String targetUri;
+ @ApiModelProperty(value = "The owner of the job")
+ @SerializedName("owner")
+ @JsonProperty("owner")
+ public String owner;
+
}
.typeId("type1") //
.jobData(getStringFromFile("job-1.json")) //
.targetUri("http://example.com/") //
+ .owner("owner") //
.build();
assertThat(jobs).hasSize(1) //
.contains(gson.toJsonTree(wantedJobInfo));
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 Nordix Foundation
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================LICENSE_END===================================
- */
-package org.oransc.portal.nonrtric.controlpanel.mock;
-
-import org.immutables.gson.Gson;
-import org.immutables.value.Value;
-
-@Value.Immutable
-@Gson.TypeAdapters
-public interface EiJob {
-
- public String ei_job_identity();
-
- public String target_uri();
-
- public Object ei_job_data();
-
- public String ei_type_identity();
-
- public String owner();
-
- public String status();
-
-}
import java.util.ArrayList;
-public class EiJobs extends ArrayList<EiJob> {
+import org.oransc.portal.nonrtric.controlpanel.model.JobInfo;
+
+public class EiJobs extends ArrayList<JobInfo> {
private static final long serialVersionUID = -928428052502491021L;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Optional;
import java.util.stream.Collectors;
import org.oransc.portal.nonrtric.controlpanel.eiproducerapi.EiProducerApi;
+import org.oransc.portal.nonrtric.controlpanel.model.JobInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.test.context.TestConfiguration;
@Override
public ResponseEntity<String> getEiJobsForOneEiProducer(String eiProducerId) {
EiJobs result = new EiJobs();
- List<EiJob> inst = database.getEiJobsForOneEiProducer(Optional.of(eiProducerId));
- result.addAll(inst);
+
+ result.addAll(database.getAllEiJobs());
return new ResponseEntity<>(gson.toJson(result), HttpStatus.OK);
}
// Create EiJob instance
schema = getStringFromFile("job-1.json");
- putEiJobInstance("type1", "job1", schema, "prod-1", "http://example.com/");
+ putEiJobInstance("type1", "job1", schema, "owner", "http://example.com/");
}
private String getStringFromFile(String path) {
}
void putEiJobInstance(String typeId, String instanceId, Object instanceData, String owner, String targetUrl) {
- EiJob i = ImmutableEiJob.builder() //
- .ei_job_data(instanceData) //
- .ei_job_identity(instanceId) //
+ JobInfo i = JobInfo.builder() //
+ .jobData(instanceData) //
+ .id(instanceId) //
.owner(owner) //
- .ei_type_identity(typeId) //
- .target_uri(targetUrl) //
- .status("ENABLED") //
+ .typeId(typeId) //
+ .targetUri(targetUrl) //
.build(); //
eiJobs.put(instanceId, i);
}
return eiProducers.values();
}
- public Collection<EiJob> getAllEiJobs() {
- return eiJobs.values();
- }
-
- public List<EiJob> getEiJobsForOneEiProducer(Optional<String> eiProducerId) {
- List<EiJob> result = new ArrayList<>();
- for (EiJob i : eiJobs.values()) {
- if (eiProducerId.isPresent()) {
- if (i.owner().equals(eiProducerId.get())) {
- result.add(i);
- }
+ public List<JobInfo> getAllEiJobs() {
+ return new ArrayList<>(eiJobs.values());
- } else {
- result.add(i);
- }
- }
- return result;
}
private Map<String, EiProducer> eiProducers = new HashMap<>();
- private Map<String, EiJob> eiJobs = new HashMap<>();
+ private Map<String, JobInfo> eiJobs = new HashMap<>();
}
}
<th mat-header-cell *matHeaderCellDef> Type ID </th>
<td mat-cell *matCellDef="let eiJob"> {{this.getEITypeId(eiJob)}} </td>
</ng-container>
+ <ng-container matColumnDef="owner">
+ <th mat-header-cell *matHeaderCellDef> Owner </th>
+ <td mat-cell *matCellDef="let eiJob"> {{eiJob.owner}} </td>
+ </ng-container>
<ng-container matColumnDef="targetUri">
<th mat-header-cell *matHeaderCellDef> Target URI </th>
<td mat-cell *matCellDef="let eiJob"> {{this.getTargetUri(eiJob)}} </td>
</ng-container>
- <tr mat-header-row *matHeaderRowDef="['id', 'typeId', 'targetUri']"></tr>
- <tr mat-row *matRowDef="let row; columns: ['id', 'typeId', 'targetUri'];"></tr>
+ <tr mat-header-row *matHeaderRowDef="['id', 'typeId', 'owner', 'targetUri']"></tr>
+ <tr mat-row *matRowDef="let row; columns: ['id', 'typeId', 'owner', 'targetUri'];"></tr>
</table>
\ No newline at end of file
}
getEITypeId(eiJob: EIJob): string {
- if (eiJob.ei_type_identity){
+ if (eiJob.ei_type_identity) {
return eiJob.ei_type_identity;
}
return '< No type >';
}
getTargetUri(eiJob: EIJob): string {
- if (eiJob.target_uri){
+ if (eiJob.target_uri) {
return eiJob.target_uri;
}
return '< No target URI >';
}
getEIProducerId(eiProducer: EIProducer): string {
- if (eiProducer.ei_producer_id){
+ if (eiProducer.ei_producer_id) {
return eiProducer.ei_producer_id;
}
return '< No id>';
}
getEIProducerTypes(eiProducer: EIProducer): string[] {
- if (eiProducer.ei_producer_types){
+ if (eiProducer.ei_producer_types) {
return eiProducer.ei_producer_types;
}
return ['< No types >'];
}
getEIProducerStatus(eiProducer: EIProducer): string {
- if (eiProducer.status){
+ if (eiProducer.status) {
return eiProducer.status;
}
return '< No status >';
// Models of data used by the EI Coordinator
export interface EIJobBis {
- eiTypeId: string;
- jobResultUri: string;
- jobOwner: string;
- jobStatusNotificationUri: string;
- jobDefinition: any;
- }
+ eiTypeId: string;
+ jobResultUri: string;
+ jobOwner: string;
+ jobStatusNotificationUri: string;
+ jobDefinition: any;
+}
- export interface EIJob {
- ei_job_identity: string;
- ei_job_data: any;
- ei_type_identity: string;
- target_uri: string;
- }
+export interface EIJob {
+ ei_job_identity: string;
+ ei_job_data: any;
+ ei_type_identity: string;
+ target_uri: string;
+ owner: string;
+}
- export interface EIType {
- id: string;
- description: string;
- }
+export interface EIType {
+ id: string;
+ description: string;
+}
- export interface EIProducer {
- ei_producer_id: string;
- ei_producer_types: string[];
- status: string;
- }
\ No newline at end of file
+export interface EIProducer {
+ ei_producer_id: string;
+ ei_producer_types: string[];
+ status: string;
+}
\ No newline at end of file