Skip to content

Commit

Permalink
Merge pull request #143 from hufeng/master
Browse files Browse the repository at this point in the history
fixed test suite and document
  • Loading branch information
hufeng authored Oct 20, 2019
2 parents 06c649c + d3a7e1c commit 2e22edf
Show file tree
Hide file tree
Showing 14 changed files with 313 additions and 332 deletions.
8 changes: 4 additions & 4 deletions packages/dubbo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ nodejs 使用原生的 dubbo 协议打通了 dubbo 的 rpc 方法调用 .
## Getting Started

```shell
yarn add dubbo2.js
yarn add dubbo-js
```

## How to Usage?
Expand Down Expand Up @@ -139,13 +139,13 @@ const demoSerivce = Dubbo.proxService({
## FAQ

```javascript
import {Dubbo} from 'dubbo2.js';
import {Dubbo} from 'dubbo-js';
```

默认导入的 dubbo2.js 是按照 es2017 进行编译的,支持 node7.10 以上。
默认导入的 dubbo-js 是按照 es2017 进行编译的,支持 node7.10 以上。

如果更低的 node 版本,可以使用

```javascript
import {Dubbo} from 'dubbo2.js/es6';
import {Dubbo} from 'dubbo-js/es6';
```
2 changes: 1 addition & 1 deletion packages/dubbo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/dubbo/dubbo2.js.git"
"url": "https://github.com/apache/dubbo-js"
},
"dependencies": {
"debug": "3.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/dubbo/src/__tests__/context-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('context test suite', () => {
it('test default Value', () => {
const ctx = Context.create();
expect(ctx.requestId).toEqual(1);
expect(ctx.application).toEqual({name: 'dubbo2.js'});
expect(ctx.application).toEqual({name: 'dubbo-js'});
expect(ctx.isNotScheduled).toEqual(true);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/dubbo/src/__tests__/directly-dubbo-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

import {DirectlyDubbo, java} from 'dubbo2.js';
import {DirectlyDubbo, java} from 'dubbo-js';
import {
DemoProviderWrapper,
IDemoProvider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

import {Dubbo, setting} from 'dubbo2.js';
import {Dubbo, setting} from 'dubbo-js';
import {DemoProvider} from './providers/com/alibaba/dubbo/demo/DemoProvider';

const service = {
Expand Down
4 changes: 2 additions & 2 deletions packages/dubbo/src/__tests__/dubbo-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

import {Context, Dubbo, java, setting} from 'dubbo2.js';
import {Context, Dubbo, java, setting} from 'dubbo-js';
import {BasicTypeProvider} from './providers/com/alibaba/dubbo/demo/BasicTypeProvider';
import {DemoProvider} from './providers/com/alibaba/dubbo/demo/DemoProvider';
import {ErrorProvider} from './providers/com/alibaba/dubbo/demo/ErrorProvider';
Expand Down Expand Up @@ -43,7 +43,7 @@ const dubboSetting = setting
);

const dubbo = new Dubbo<typeof service>({
application: {name: '@qianmi/node-dubbo'},
application: {name: 'node-dubbo'},
register: 'localhost:2181',
service,
dubboSetting,
Expand Down
2 changes: 1 addition & 1 deletion packages/dubbo/src/__tests__/dubbo-timeout-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

import {Dubbo, java, setting} from 'dubbo2.js';
import {Dubbo, java, setting} from 'dubbo-js';
import {DemoProvider} from './providers/com/alibaba/dubbo/demo/DemoProvider';
import {UserRequest} from './providers/com/alibaba/dubbo/demo/UserRequest';

Expand Down
8 changes: 4 additions & 4 deletions packages/dubbo/src/__tests__/socket-worker-test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import SocketWorker from '../socket-worker';

// 测试启动后,过一会关闭wifi, 过20次的心跳间隔,会关闭socket, 重新创建连接
const worker = SocketWorker.from('47.110.39.117:8888');
console.log(worker);
// const worker = SocketWorker.from('47.110.39.117:8888');
// console.log(worker);

it('socket-time-out', () => {});
2 changes: 1 addition & 1 deletion packages/dubbo/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class Context<T = any> {
this._timeoutId = null;
this._isSupportedDubbox = false;
this._body = {err: null, res: null};
this._application = {name: 'dubbo2.js'};
this._application = {name: 'dubbo-js'};
this._attachments = {};
this._providerAttachments = {};
this._request = <IContextRequestParam>{
Expand Down
2 changes: 1 addition & 1 deletion packages/dubbo/src/dubbo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {msg, noop, traceInfo} from './util';

const log = debug('dubbo:bootstrap');
const packageVersion = require('../package.json').version;
log('dubbo2.js version :=> %s', packageVersion);
log('dubbo-js version :=> %s', packageVersion);

/**
* Dubbo
Expand Down
7 changes: 5 additions & 2 deletions packages/dubbo/src/registry/zookeeper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ export class ZkRegistry extends Registry<IZkClientProps & IDubboRegistryProps> {

//获取所有provider
for (let inf of interfaces) {
//init
this._dubboServiceUrlMap.set(inf, []);

//当前接口在zookeeper中的路径
const dubboServicePath = `/${zkRoot}/${inf}/providers`;
//当前接口路径下的dubbo url
Expand All @@ -83,10 +86,10 @@ export class ZkRegistry extends Registry<IZkClientProps & IDubboRegistryProps> {
if (err) {
log(`getChildren ${dubboServicePath} error ${err}`);
traceErr(err);
//If an error occurs, continue
continue;
}

//init
this._dubboServiceUrlMap.set(inf, []);
for (let serviceUrl of dubboServiceUrls) {
const url = DubboUrl.from(serviceUrl);
this._dubboServiceUrlMap.get(inf).push(url);
Expand Down
Loading

0 comments on commit 2e22edf

Please sign in to comment.