use of org.eclipse.microprofile.openapi.models.servers.Server in project empoa by OpenAPITools.
the class ServerTest method testCreateServer.
@Test
public void testCreateServer() {
Server server = OASFactory.createServer();
assertThat(server).isNotNull();
}
use of org.eclipse.microprofile.openapi.models.servers.Server in project empoa by OpenAPITools.
the class OASMergeTest method testMergeServer.
@Test
public void testMergeServer() throws Exception {
Server from1 = OASTestFactory.createTestServer();
Server into1 = OASFactory.createServer();
OASMerge.merge(from1, into1);
asJsonIsEqualTo(from1, into1);
Server from2 = OASFactory.createServer();
Server into2 = OASTestFactory.createTestServer();
OASMerge.merge(from2, into2);
Server from3 = OASTestFactory.createTestServer();
Server into3 = OASTestFactory.createTestServer();
OASMerge.merge(from3, into3);
asJsonIsEqualTo(from3, into3);
}
use of org.eclipse.microprofile.openapi.models.servers.Server in project empoa by OpenAPITools.
the class OASCopy method copy.
public static Server copy(Server from) {
if (from == null) {
return null;
}
Server to = OASFactory.createServer();
to.setUrl(from.getUrl());
to.setDescription(from.getDescription());
Map<String, ServerVariable> variables = from.getVariables();
if (variables != null) {
for (Entry<String, ServerVariable> entry : variables.entrySet()) {
to.addVariable(entry.getKey(), copy(entry.getValue()));
}
}
Map<String, Object> extensions = from.getExtensions();
if (extensions != null) {
for (Entry<String, Object> entry : extensions.entrySet()) {
to.addExtension(entry.getKey(), entry.getValue());
}
}
return to;
}
use of org.eclipse.microprofile.openapi.models.servers.Server in project empoa by OpenAPITools.
the class OASCopy method copy.
public static Operation copy(Operation from) {
if (from == null) {
return null;
}
Operation to = OASFactory.createOperation();
List<String> tags = from.getTags();
if (tags != null) {
for (String item : tags) {
to.addTag(item);
}
}
to.setSummary(from.getSummary());
to.setDescription(from.getDescription());
to.setExternalDocs(copy(from.getExternalDocs()));
to.setOperationId(from.getOperationId());
List<Parameter> parameters = from.getParameters();
if (parameters != null) {
for (Parameter item : parameters) {
to.addParameter(copy(item));
}
}
to.setRequestBody(copy(from.getRequestBody()));
to.setResponses(copy(from.getResponses()));
Map<String, Callback> callbacks = from.getCallbacks();
if (callbacks != null) {
for (Entry<String, Callback> entry : callbacks.entrySet()) {
to.addCallback(entry.getKey(), copy(entry.getValue()));
}
}
to.setDeprecated(from.getDeprecated());
List<SecurityRequirement> security = from.getSecurity();
if (security != null) {
for (SecurityRequirement item : security) {
to.addSecurityRequirement(copy(item));
}
}
List<Server> servers = from.getServers();
if (servers != null) {
for (Server item : servers) {
to.addServer(copy(item));
}
}
Map<String, Object> extensions = from.getExtensions();
if (extensions != null) {
for (Entry<String, Object> entry : extensions.entrySet()) {
to.addExtension(entry.getKey(), entry.getValue());
}
}
return to;
}
use of org.eclipse.microprofile.openapi.models.servers.Server in project empoa by OpenAPITools.
the class OASCopy method copy.
public static PathItem copy(PathItem from) {
if (from == null) {
return null;
}
PathItem to = OASFactory.createPathItem();
to.setRef(from.getRef());
to.setSummary(from.getSummary());
to.setDescription(from.getDescription());
to.setGET(copy(from.getGET()));
to.setPUT(copy(from.getPUT()));
to.setPOST(copy(from.getPOST()));
to.setDELETE(copy(from.getDELETE()));
to.setOPTIONS(copy(from.getOPTIONS()));
to.setHEAD(copy(from.getHEAD()));
to.setPATCH(copy(from.getPATCH()));
to.setTRACE(copy(from.getTRACE()));
List<Server> servers = from.getServers();
if (servers != null) {
for (Server item : servers) {
to.addServer(copy(item));
}
}
List<Parameter> parameters = from.getParameters();
if (parameters != null) {
for (Parameter item : parameters) {
to.addParameter(copy(item));
}
}
Map<String, Object> extensions = from.getExtensions();
if (extensions != null) {
for (Entry<String, Object> entry : extensions.entrySet()) {
to.addExtension(entry.getKey(), entry.getValue());
}
}
return to;
}
Aggregations