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

fix typo #3110

Merged
merged 1 commit into from
Jan 1, 2019
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -75,39 +75,39 @@ public void setUp() {
@Test
public void testRegister() {
dubboRegistry.register(serviceURL);
assertEquals(1, getRegistereds());
assertEquals(1, getRegisteredSize());
}

@Test
public void testUnRegister() {
assertEquals(0, getRegistereds());
assertEquals(0, getRegisteredSize());
dubboRegistry.register(serviceURL);
assertEquals(1, getRegistereds());
assertEquals(1, getRegisteredSize());
dubboRegistry.unregister(serviceURL);
assertEquals(0, getRegistereds());
assertEquals(0, getRegisteredSize());
}

@Test
public void testSubscribe() {
dubboRegistry.register(serviceURL);
assertEquals(1, getRegistereds());
assertEquals(1, getRegisteredSize());
dubboRegistry.subscribe(serviceURL, notifyListener);
assertEquals(1, getSubscribeds());
assertEquals(1, getSubscribedSize());
assertEquals(1, getNotifiedListeners());
}

@Test
public void testUnsubscribe() {
dubboRegistry.subscribe(serviceURL, notifyListener);
assertEquals(1, getSubscribeds());
assertEquals(1, getSubscribedSize());
assertEquals(1, getNotifiedListeners());
dubboRegistry.unsubscribe(serviceURL, notifyListener);
assertEquals(0, getNotifiedListeners());
}

private class MockDubboRegistry extends FailbackRegistry {

private volatile boolean isAvaliable = false;
private volatile boolean isAvailable = false;

public MockDubboRegistry(URL url) {
super(url);
Expand All @@ -116,13 +116,13 @@ public MockDubboRegistry(URL url) {
@Override
public void doRegister(URL url) {
logger.info("Begin to register: " + url);
isAvaliable = true;
isAvailable = true;
}

@Override
public void doUnregister(URL url) {
logger.info("Begin to ungister: " + url);
isAvaliable = false;
isAvailable = false;
}

@Override
Expand All @@ -137,19 +137,19 @@ public void doUnsubscribe(URL url, NotifyListener listener) {

@Override
public boolean isAvailable() {
return isAvaliable;
return isAvailable;
}
}

private int getNotifiedListeners() {
return dubboRegistry.getSubscribed().get(serviceURL).size();
}

private int getRegistereds() {
private int getRegisteredSize() {
return dubboRegistry.getRegistered().size();
}

private int getSubscribeds() {
private int getSubscribedSize() {
return dubboRegistry.getSubscribed().size();
}
}