Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSE-5411 #50

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion media-nep/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,16 @@
<groupId>nl.vpro.poms</groupId>
<artifactId>poms-shared-domain</artifactId>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.4</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<optional>true</optional>
</dependency>
</dependencies>


Expand All @@ -141,9 +151,10 @@
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>3.3.4</version> <!-- newer versions create NPE during generation -->
<version>6.3.0</version>
<executions>
<execution>
<id>samapi</id>
<goals>
<goal>generate</goal>
</goals>
Expand All @@ -165,6 +176,30 @@
</configOptions>
</configuration>
</execution>
<execution>
<id>sourcingservice</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/sourcing-service/openapi.yaml</inputSpec>
<generatorName>java</generatorName>
<apiPackage>nl.vpro.nep.sourcingservice.api</apiPackage>
<modelPackage>nl.vpro.nep.sourcingservice.model</modelPackage>
<invokerPackage>nl.vpro.nep.sourcingservice.invoker</invokerPackage>
<configHelp>false</configHelp>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
<configOptions>
<strictSpec>true</strictSpec>
<dateLibrary>java8</dateLibrary>
<java8>true</java8>
<library>resteasy</library>
<withXml>false</withXml>

</configOptions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package nl.vpro.nep.service;

import nl.vpro.nep.sourcingservice.invoker.ApiException;

/**
* TODO: MSE-5411
*/
public interface NEPSourcingService {


void ingest() throws ApiException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import lombok.extern.slf4j.Slf4j;

import java.time.Duration;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
Expand Down Expand Up @@ -152,12 +151,14 @@ public String getStreamAccessMidString() {
}

static StreamAccessItem createStreamAccessItem(String ip, Duration duration) {
StreamAccessItem item = new StreamAccessItem().data(new ApiObject().type("access"));
Map<String, Object> attributes = new HashMap<>();
attributes.put("viewer", "pomsgui");
attributes.put("ip", ip);
attributes.put("duration", duration == null ? null : duration.toString());
item.getData().setAttributes(attributes);
StreamAccessItem item = new StreamAccessItem().data(
new StreamAccessItemData().type("access")
);
StreamAccessAttributes accessAttributes = new StreamAccessAttributes();
accessAttributes.setViewer("pomsgui");
accessAttributes.setIp(ip);
accessAttributes.setDuration((int) (duration.toMillis() / 1000));
item.getData().setAttributes(accessAttributes);
return item;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package nl.vpro.nep.service.impl;

import java.util.Arrays;
import java.util.UUID;

import nl.vpro.nep.service.NEPSourcingService;
import nl.vpro.nep.sourcingservice.api.IngestApi;
import nl.vpro.nep.sourcingservice.invoker.ApiException;
import nl.vpro.nep.sourcingservice.model.IngestRequest;
import nl.vpro.nep.sourcingservice.model.IngestRequestProfiles;

/**
* TODO. MSE-5411
*
*/
public class NEPSourcingServiceImpl implements NEPSourcingService {

private final IngestApi ingestApi;

public NEPSourcingServiceImpl(IngestApi ingestApi) {
this.ingestApi = ingestApi;
}

@Override
public void ingest() throws ApiException {
IngestRequest request = new IngestRequest();
request.setFileName("bla.mp3");
request.setProfiles(Arrays.asList(
new IngestRequestProfiles().uuid(UUID.randomUUID())
));
ingestApi.v1IngestRequestPost(
new IngestRequest()
);

}
}
Loading