Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
[cleanup] More cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
garuma committed Jul 26, 2013
1 parent 897e6d6 commit d6b4090
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 31 deletions.
3 changes: 2 additions & 1 deletion src/BusObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ namespace DBus

public class BusObject
{
static Dictionary<object,BusObject> boCache = new Dictionary<object,BusObject>();

protected Connection conn;
string bus_name;
ObjectPath object_path;
Expand Down Expand Up @@ -205,7 +207,6 @@ public static object GetObject (Connection conn, string bus_name, ObjectPath obj
return instObj;
}

static Dictionary<object,BusObject> boCache = new Dictionary<object,BusObject>();
public static BusObject GetBusObject (object instObj)
{
if (instObj is BusObject)
Expand Down
3 changes: 2 additions & 1 deletion src/Connection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ void Authenticate ()
isAuthenticated = true;
}

//Interlocked.Increment() handles the overflow condition for uint correctly, so it's ok to store the value as an int but cast it to uint
// Interlocked.Increment() handles the overflow condition for uint correctly,
// so it's ok to store the value as an int but cast it to uint
internal uint GenerateSerial ()
{
return (uint)Interlocked.Increment (ref serial);
Expand Down
4 changes: 2 additions & 2 deletions src/DBus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ public enum ReleaseNameReply : uint

public enum StartReply : uint
{
//The service was successfully started.
// The service was successfully started.
Success = 1,
//A connection already owns the given name.
// A connection already owns the given name.
AlreadyRunning,
}

Expand Down
7 changes: 0 additions & 7 deletions src/DProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,6 @@ public override IMessage Invoke (IMessage message)
return returnMessage;
}

/*
public override ObjRef CreateObjRef (Type ServerType)
{
throw new System.NotImplementedException ();
}
*/

~DProxy ()
{
//FIXME: remove handlers/match rules here
Expand Down
4 changes: 2 additions & 2 deletions src/TypeImplementer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ class TypeImplementer

public TypeImplementer (string name, bool canSave)
{
asmB = AppDomain.CurrentDomain.DefineDynamicAssembly (new AssemblyName (name), canSave ? AssemblyBuilderAccess.RunAndSave : AssemblyBuilderAccess.Run);
asmB = AppDomain.CurrentDomain.DefineDynamicAssembly (new AssemblyName (name),
canSave ? AssemblyBuilderAccess.RunAndSave : AssemblyBuilderAccess.Run);
modB = asmB.DefineDynamicModule (name);
}

Expand Down Expand Up @@ -520,7 +521,6 @@ static void Gen (DynamicMethod hookupMethod, MethodInfo declMethod)
ilg.Emit (OpCodes.Ret);
}

//takes the Reader instance off the stack, puts value of type t on the stack
public static void GenReader (ILGenerator ilg, Type t)
{
Type tUnder = t;
Expand Down
2 changes: 1 addition & 1 deletion tests/ExportInterfaceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public void ReturnValues ()
/// <summary>
///
/// </summary>
[Test]
[Test, Ignore ("That's a bit brutal right now")]
public void ComplexAsVariant ()
{
MyTuple2 cpx = new MyTuple2 ();
Expand Down
28 changes: 11 additions & 17 deletions tests/RenamedInterfaceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// This software is made available under the MIT License
// See COPYING for details

using System;
using NUnit.Framework;
using DBus;
using org.freedesktop.DBus;
Expand All @@ -14,50 +15,43 @@ public class RenamedInterfaceTest
string bus_name = "org.dbussharp.restaurant";
ObjectPath path = new ObjectPath ("/org/dbussharp/restaurant");

/// <summary>
///
/// </summary>
[Test]
[Ignore ("Not working for now")]
[Test, Ignore]
public void FirstInterface ()
{
var restaurant = new StandingRestaurant ();
Bus.Session.Register (path, restaurant);
Assert.AreEqual (Bus.Session.RequestName (bus_name), RequestNameReply.PrimaryOwner);
Bus.Session.Register (path, restaurant);

try {
Assert.AreEqual ("cheese", GetFood ());
Assert.AreEqual ("cheese", GetFood (false));
} finally {
Bus.Session.ReleaseName (bus_name);
Bus.Session.Unregister (path);
}
}

/// <summary>
///
/// </summary>
[Test]
[Ignore ("Not working for now")]
[Test, Ignore]
public void SecondInterface ()
{
var restaurant = new SeatedRestaurant ();
Bus.Session.Register (path, restaurant);
Assert.AreEqual (Bus.Session.RequestName (bus_name), RequestNameReply.PrimaryOwner);

try {
Assert.AreEqual ("bacon", GetFood ());
Assert.AreEqual ("bacon", GetFood (true));
} finally {
Bus.Session.ReleaseName (bus_name);
Bus.Session.Unregister (path);
}
}

private string GetFood ()
string GetFood (bool second)
{
IRestaurantBase restaurant = Bus.Session.GetObject<IRestaurantv2> (bus_name, path);
if (restaurant == null) {
IRestaurantBase restaurant = null;
if (second)
restaurant = Bus.Session.GetObject<IRestaurantv2> (bus_name, path);
else
restaurant = Bus.Session.GetObject<IRestaurant> (bus_name, path);
}
return restaurant.Food ();
}
}
Expand Down

0 comments on commit d6b4090

Please sign in to comment.