Skip to content

Commit

Permalink
fixed the character error and can store string data into mogilefs
Browse files Browse the repository at this point in the history
  • Loading branch information
hawklithm committed Oct 2, 2014
1 parent 54663ca commit ecc3377
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/domain.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 20 additions & 9 deletions test/domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ var mogile = require('../index');

module.exports = testCase({
setUp: function(callback) {
this.trackers = ['mogtracker1:7001'];
this.trackers = ['127.0.0.1:7001'];
this.client = mogile.createClient(this.trackers);
this.domain = this.client.domain('default');
this.domain = this.client.domain('articles');
callback();
},
testGetDomains: function(test) {
Expand All @@ -15,7 +15,7 @@ module.exports = testCase({
});
},
testStoreFile: function(test) {
this.domain.storeFile('AAAAAAA.jpg', 'dropbox', '/tmp/AAAAAAA.jpg', function(err, bytes_written) {
this.domain.storeFile('asdfdgahh', 'level1', '/home/bluehawky/mogileFs_note.txt', function(err, bytes_written) {
if (err) {
console.log(err);
test.ok(false);
Expand All @@ -26,7 +26,7 @@ module.exports = testCase({
});
},
testGetPaths: function(test) {
this.domain.getPaths('AAAAAAA.jpg', 0, function(err, paths) {
this.domain.getPaths('asdfdgahh', 0, function(err, paths) {
if (err) {
test.ok(false);
} else {
Expand All @@ -36,7 +36,7 @@ module.exports = testCase({
});
},
testGetFile: function(test) {
this.domain.getFile('AAAAAAA.jpg', '/tmp/AAAAAAA.jpg', function(err, bytes) {
this.domain.getFile('asdfdgahh', '/home/bluehawky/mogileFs_note_heh.txt', function(err, bytes) {
if (err) {
test.ok(false);
} else {
Expand All @@ -46,7 +46,7 @@ module.exports = testCase({
});
},
testRenameFile: function(test) {
this.domain.rename('AAAAAAA.jpg', 'BBBBBBB.jpg', function(err) {
this.domain.rename('asdfdgahh', 'zzzzzzzz', function(err) {
if (err) {
test.ok(false);
} else {
Expand All @@ -57,13 +57,13 @@ module.exports = testCase({
},
testDeleteFile: function(test) {
var $this = this;
this.domain.del('BBBBBBB.jpg', function(err) {
this.domain.del('zzzzzzzz', function(err) {
if (err) {
test.ok(false);
} else {
test.ok(true);
}
$this.domain.getPaths('BBBBBBB.jpg', 0, function(err, paths) {
$this.domain.getPaths('zzzzzzzz', 0, function(err, paths) {
if (!err) {
test.ok(false);
} else if (err.indexOf(err, 'unknown_key') != -1) {
Expand All @@ -72,5 +72,16 @@ module.exports = testCase({
test.done();
});
});
}
},
testStoreData: function(test){
this.domain.storeData('adfghjkl;z\'','level1','hhhhhhhh把这个东西存到mogilefs中去', function(err, bytes_written) {
if (err) {
console.log(err);
test.ok(false);
} else {
test.ok(bytes_written > 0);
}
test.done();
});
}
});

0 comments on commit ecc3377

Please sign in to comment.