Rename ServerSideSortingControl

ServerSideSortingRequestControl will be more consistent when
ServerSideSortingResponseControl is implemented.
This commit is contained in:
Patrick Mooney 2014-06-09 15:37:19 -07:00
parent f1d4b667c3
commit 352e4bbfba
3 changed files with 21 additions and 20 deletions

View File

@ -7,7 +7,8 @@ var EntryChangeNotificationControl =
require('./entry_change_notification_control'); require('./entry_change_notification_control');
var PersistentSearchControl = require('./persistent_search_control'); var PersistentSearchControl = require('./persistent_search_control');
var PagedResultsControl = require('./paged_results_control'); var PagedResultsControl = require('./paged_results_control');
var ServerSideSortingControl = require('./server_side_sorting_control.js'); var ServerSideSortingRequestControl =
require('./server_side_sorting_request_control.js');
@ -58,8 +59,8 @@ module.exports = {
value: value value: value
}); });
break; break;
case ServerSideSortingControl.OID: case ServerSideSortingRequestControl.OID:
control = new ServerSideSortingControl({ control = new ServerSideSortingRequestControl({
critical: critical, critical: critical,
value: value value: value
}); });
@ -80,5 +81,5 @@ module.exports = {
EntryChangeNotificationControl: EntryChangeNotificationControl, EntryChangeNotificationControl: EntryChangeNotificationControl,
PagedResultsControl: PagedResultsControl, PagedResultsControl: PagedResultsControl,
PersistentSearchControl: PersistentSearchControl, PersistentSearchControl: PersistentSearchControl,
ServerSideSortingControl: ServerSideSortingControl ServerSideSortingRequestControl: ServerSideSortingRequestControl
}; };

View File

@ -15,11 +15,11 @@ var BerWriter = asn1.BerWriter;
///--- API ///--- API
function ServerSideSortingControl(options) { function ServerSideSortingRequestControl(options) {
if (!options) if (!options)
options = {}; options = {};
options.type = ServerSideSortingControl.OID; options.type = ServerSideSortingRequestControl.OID;
if (options.value) { if (options.value) {
if (Buffer.isBuffer(options.value)) { if (Buffer.isBuffer(options.value)) {
this.parse(options.value); this.parse(options.value);
@ -49,11 +49,11 @@ function ServerSideSortingControl(options) {
return self._value || []; return self._value || [];
}); });
} }
util.inherits(ServerSideSortingControl, Control); util.inherits(ServerSideSortingRequestControl, Control);
module.exports = ServerSideSortingControl; module.exports = ServerSideSortingRequestControl;
ServerSideSortingControl.prototype.parse = function parse(buffer) { ServerSideSortingRequestControl.prototype.parse = function parse(buffer) {
assert.ok(buffer); assert.ok(buffer);
var ber = new BerReader(buffer); var ber = new BerReader(buffer);
@ -78,7 +78,7 @@ ServerSideSortingControl.prototype.parse = function parse(buffer) {
}; };
ServerSideSortingControl.prototype._toBer = function (ber) { ServerSideSortingRequestControl.prototype._toBer = function (ber) {
assert.ok(ber); assert.ok(ber);
if (!this._value || this.value.length === 0) if (!this._value || this.value.length === 0)
@ -105,10 +105,10 @@ ServerSideSortingControl.prototype._toBer = function (ber) {
}; };
ServerSideSortingControl.prototype._json = function (obj) { ServerSideSortingRequestControl.prototype._json = function (obj) {
obj.controlValue = this.value; obj.controlValue = this.value;
return obj; return obj;
}; };
ServerSideSortingControl.OID = '1.2.840.113556.1.4.473'; ServerSideSortingRequestControl.OID = '1.2.840.113556.1.4.473';

View File

@ -6,26 +6,26 @@ var asn1 = require('asn1');
var BerReader = asn1.BerReader; var BerReader = asn1.BerReader;
var BerWriter = asn1.BerWriter; var BerWriter = asn1.BerWriter;
var getControl; var getControl;
var ServerSideSortingControl; var SSSRControl;
///--- Tests ///--- Tests
test('load library', function (t) { test('load library', function (t) {
ServerSideSortingControl = require('../../lib').ServerSideSortingControl; SSSRControl = require('../../lib').ServerSideSortingRequestControl;
t.ok(ServerSideSortingControl); t.ok(SSSRControl);
getControl = require('../../lib').getControl; getControl = require('../../lib').getControl;
t.ok(getControl); t.ok(getControl);
t.end(); t.end();
}); });
test('new no args', function (t) { test('new no args', function (t) {
t.ok(new ServerSideSortingControl()); t.ok(new SSSRControl());
t.end(); t.end();
}); });
test('new with args', function (t) { test('new with args', function (t) {
var c = new ServerSideSortingControl({ var c = new SSSRControl({
criticality: true, criticality: true,
value: { value: {
attributeType: 'sn' attributeType: 'sn'
@ -41,7 +41,7 @@ test('new with args', function (t) {
}); });
test('toBer - object', function (t) { test('toBer - object', function (t) {
var sssc = new ServerSideSortingControl({ var sssc = new SSSRControl({
criticality: true, criticality: true,
value: { value: {
attributeType: 'sn', attributeType: 'sn',
@ -64,7 +64,7 @@ test('toBer - object', function (t) {
}); });
test('toBer - array', function (t) { test('toBer - array', function (t) {
var sssc = new ServerSideSortingControl({ var sssc = new SSSRControl({
criticality: true, criticality: true,
value: [ value: [
{ {
@ -97,7 +97,7 @@ test('toBer - array', function (t) {
}); });
test('toBer - empty', function (t) { test('toBer - empty', function (t) {
var sssc = new ServerSideSortingControl(); var sssc = new SSSRControl();
var ber = new BerWriter(); var ber = new BerWriter();
sssc.toBer(ber); sssc.toBer(ber);