Skip to content

Commit

Permalink
Merge pull request Terracotta-OSS#197 from anthonydahanne/upgrade_ver…
Browse files Browse the repository at this point in the history
…sions

Upgrade versions
  • Loading branch information
mathieucarbou authored Nov 23, 2016
2 parents 6229043 + 9cda45f commit 8a9833e
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ public void createNew() {
throw new UnsupportedOperationException("TODO Implement me!");
}

@Override
public void loadExisting() {
throw new UnsupportedOperationException("TODO Implement me!");
}

@Override
public void destroy() {
throw new UnsupportedOperationException("TODO Implement me!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public Collection<Class<?>> getProvidedServiceTypes() {
}

@Override
public void clear() throws ServiceProviderCleanupException {
public void prepareForSynchronization() throws ServiceProviderCleanupException {
listener.clear();
statisticsService.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.junit.runners.JUnit4;
import org.terracotta.entity.BasicServiceConfiguration;
import org.terracotta.entity.ClientCommunicator;
import org.terracotta.entity.PlatformConfiguration;
import org.terracotta.entity.ServiceConfiguration;
import org.terracotta.entity.ServiceRegistry;
import org.terracotta.management.model.message.Message;
Expand Down Expand Up @@ -61,7 +60,7 @@ public class ManagementRegistryServiceTest {

@Before
public void setUp() throws Exception {
provider.initialize(null, () -> "server-1");
provider.initialize(null, new MyPlatformConfiguration("server-1"));
platformListener = provider.getService(0, new BasicServiceConfiguration<>(IStripeMonitoring.class));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright Terracotta, Inc.
*
* 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.
*/
package org.terracotta.management.service.monitoring;

import org.terracotta.entity.PlatformConfiguration;

import java.util.Collection;

public class MyPlatformConfiguration implements PlatformConfiguration {

private final String serverName;

public MyPlatformConfiguration(String serverName) {
this.serverName = serverName;
}

@Override
public String getServerName() {
return serverName;
}

@Override
public <T> Collection<T> getExtendedConfiguration(Class<T> aClass) {
return null;
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public void setUp() throws Exception {
passive = new PlatformServer("server-2", "localhost", "127.0.0.1", "0.0.0.0", 9511, 9611, "v1", "b1", now);

// platform does this call to fire events to us
serviceProvider.initialize(null, () -> "server-1");
serviceProvider.initialize(null, new MyPlatformConfiguration("server-1"));
platformListener = serviceProvider.getService(0, new BasicServiceConfiguration<>(IStripeMonitoring.class));

// simulation of platform calls when active server is up
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public Collection<Class<?>> getProvidedServiceTypes() {
}

@Override
public void clear() {
public void prepareForSynchronization () {
resources.clear();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public void testNullReturnAfterClear() {

OffHeapResourcesProvider provider = new OffHeapResourcesProvider();
provider.initialize(config, null);
provider.clear();
provider.prepareForSynchronization();
assertThat(provider.getService(42L, OffHeapResourceIdentifier.identifier("foo")), nullValue());
}

Expand All @@ -158,7 +158,7 @@ public void testResourceTooBig() throws Exception {
} catch (ArithmeticException e) {
// expected
} finally {
provider.clear();
provider.prepareForSynchronization();
}
}

Expand All @@ -176,7 +176,7 @@ public void testResourceMax() throws Exception {
try {
provider.initialize(config, null);
} finally {
provider.clear();
provider.prepareForSynchronization();
}
}
}
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
<properties>
<maven-forge-plugin.version>1.2.16</maven-forge-plugin.version>
<slf4j.version>1.7.7</slf4j.version>
<terracotta-apis.version>1.0.11.beta</terracotta-apis.version>
<tcconfig.version>10.0.11.beta</tcconfig.version>
<passthrough-testing.version>1.0.11.beta3</passthrough-testing.version>
<statistics.version>1.4.0</statistics.version>
<terracotta-apis.version>1.0.12.beta</terracotta-apis.version>
<tcconfig.version>10.0.12.beta</tcconfig.version>
<passthrough-testing.version>1.0.12.beta</passthrough-testing.version>
<statistics.version>1.4.1</statistics.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.6</java.version>
Expand Down

0 comments on commit 8a9833e

Please sign in to comment.