Skip to content

Commit

Permalink
OAP-119 jclouds: byte[] upload support
Browse files Browse the repository at this point in the history
  • Loading branch information
galaxina committed Apr 11, 2024
1 parent 10bbc75 commit 1252291
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ public void start() {
System.setProperty( "failedValue", "value that can fail config parsing" );
var modules = List.of(
url( "modules/m1.conf" ),
url( "modules/m2.json" ),
url( "modules/m3.yaml" )
url( "modules/m2.conf" ),
url( "modules/m3.conf" )
);

var kernel = new Kernel( modules );
Expand Down Expand Up @@ -159,9 +159,9 @@ public void disabled() {
try {
kernel.start( Map.of( "boot.main", "disabled" ) );

assertThat( kernel.<ServiceOne>service( "modules..s1" ) ).isPresent().get()
assertThat( kernel.<ServiceOne>service( "disabled.s1" ) ).isPresent().get()
.satisfies( s1 -> assertThat( s1.list ).isEmpty() );
assertThat( kernel.<ServiceOne>service( "modules..s2" ) ).isNotPresent();
assertThat( kernel.<ServiceOne>service( "disabled.s2" ) ).isNotPresent();
} finally {
kernel.stop();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{
boot.main = m3
boot.main = m3

profiles = [profileOne]
services {
m2.ServiceTwo.parameters.j = ${a.b}
m1.ServiceOneP1.parameters.i2 = ${one.i2}
}
profiles = [profileOne]
services {
m2.ServiceTwo.parameters.j = ${a.b}
m1.ServiceOneP1.parameters.i2 = ${one.i2}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
{
name = disabled
services {
s1 {
implementation = oap.application.ServiceOne
parameters {
i = 1
list = [
modules.this.s2
]
}
dependsOn = [s2]
name = disabled
services {
s1 {
implementation = oap.application.ServiceOne
parameters {
i = 1
list = [
<modules.this.s2>
]
}
s2 {
implementation = oap.application.ServiceOne
profile = disabled
parameters {
i = 2
}
dependsOn = [s2]
}
s2 {
implementation = oap.application.ServiceOne
profile = disabled
parameters {
i = 2
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name = m2
dependsOn = m1

services {
ServiceTwo {
implementation = oap.application.ServiceTwo
parameters {
j = 1
one = <modules.m1.ServiceOne>
}
listen {
some = <modules.m1.ServiceOne>
},
supervision.supervise = true
}
ServiceScheduled {
implementation = oap.application.ServiceScheduled
supervision {
schedule = true
delay = 1s
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name = m3
dependsOn = [
m1
m2
]
services {
ServiceDepsList {
implementation = oap.application.ServiceDepsList
parameters {
deps = [
<modules.m1.ServiceOne>
<modules.m2.ServiceTwo>
]
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package oap.storage;

import lombok.ToString;
import oap.application.Kernel;
import oap.remote.FST;
import oap.remote.Remote;
import oap.remote.RemoteInvocationHandler;
import oap.http.server.nio.NioHttpServer;
import oap.id.Id;
import oap.id.Identifier;
import oap.remote.FST;
import oap.remote.Remote;
import oap.remote.RemoteInvocationHandler;
import oap.remote.RemoteLocation;
import oap.remote.application.RemoteKernel;
import oap.remote.RemoteServices;
import oap.testng.Fixtures;
import oap.testng.Ports;
import oap.util.Dates;
Expand All @@ -20,7 +19,6 @@
import java.io.Serializable;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Optional;

import static org.assertj.core.api.Assertions.assertThat;

Expand All @@ -29,13 +27,14 @@ public class RemoteStorageTest extends Fixtures {
public void testUpdate() throws IOException, URISyntaxException {
int port = Ports.getFreePort( getClass() );

Kernel kernel = Mockito.mock( Kernel.class );
RemoteServices remoteServices = Mockito.mock( RemoteServices.class );
MemoryStorage<String, TestRemoteStorage> serverStorage = new MemoryStorage<>( Identifier.forAnnotationFixed(), Storage.Lock.SERIALIZED );

Mockito.doReturn( Optional.of( serverStorage ) ).when( kernel ).service( "module.service" );
Mockito.doReturn( serverStorage ).when( remoteServices ).get( "module.service" );

try( var server = new NioHttpServer( new NioHttpServer.DefaultPort( port ) ) ) {
Remote remote = new Remote( FST.SerializationMethod.DEFAULT, "/remote", new RemoteKernel( kernel ), server );
Remote remote = new Remote( FST.SerializationMethod.DEFAULT, "/remote", remoteServices, server );
remote.start();

server.start();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void validation3() {
final TestBean.TestItem itemB = new TestBean.TestItem();
itemB.id = 2;

Object obj = kernel.kernel.service( "modules.oap-ws-validate-test.test-ws-bean" ).orElseThrow();
Object obj = kernel.kernel.service( "oap-ws-validate-test.test-ws-bean" ).orElseThrow();
TestBean bean = ( TestBean ) obj;
bean.a.add( itemA );
bean.a.add( itemB );
Expand Down

0 comments on commit 1252291

Please sign in to comment.