Esempio n. 1
0
        /// <summary>
        /// This junit does not work because of a problem? in URL: The hashcode of
        /// the 2 urls url1 & url2 are equal! even if theu point to different domains
        /// (having the same IP)
        /// </summary>
        /// <exception cref="System.Exception">System.Exception</exception>
        public virtual void TestURL()
        {
            Java.Net.URL url1 = new Java.Net.URL("http://wiki.neodatis.org");
            Java.Net.URL url2 = new Java.Net.URL("http://www.neodatis.org");
            object       o1   = url1.GetContent();
            object       o2   = url2.GetContent();
            int          h1   = url1.GetHashCode();
            int          h2   = url2.GetHashCode();

            Println(h1 + " - " + h2);
            Println(url1.GetHost() + " - " + url1.GetDefaultPort() + " - " + url1.GetFile() +
                    " - " + url1.GetRef());
            Println(url2.GetHost() + " - " + url2.GetDefaultPort() + " - " + url2.GetFile() +
                    " - " + url2.GetRef());
            Println(url1.GetHost().GetHashCode() + " - " + url1.GetDefaultPort() + " - " + url1
                    .GetFile().GetHashCode() + " - " + url1.GetRef());
            Println(url2.GetHost().GetHashCode() + " - " + url2.GetDefaultPort() + " - " + url2
                    .GetFile().GetHashCode() + " - " + url2.GetRef());
            NeoDatis.Odb.ODB odb = Open(Name);
            odb.Store(url1);
            odb.Store(url2);
            odb.Close();
            odb = Open(Name);
            NeoDatis.Odb.Objects l = odb.GetObjects(typeof(Java.Net.URL));
            odb.Close();
            if (testNewFeature)
            {
                AssertEquals("Same HashCode Problem", 2, l.Count);
            }
        }
Esempio n. 2
0
        public virtual void Test22URL()
		{
			Java.Net.URL url1 = new Java.Net.URL("http://wiki.neodatis.org");
			Java.Net.URL url2 = new Java.Net.URL("http://www.neodatis.org");
			object o1 = url1.GetContent();
			object o2 = url2.GetContent();
			int h1 = url1.GetHashCode();
			int h2 = url2.GetHashCode();
			Println(h1 + " - " + h2);
			Println(url1.GetHost() + " - " + url1.GetDefaultPort() + " - " + url1.GetFile() +
				 " - " + url1.GetRef());
			Println(url2.GetHost() + " - " + url2.GetDefaultPort() + " - " + url2.GetFile() +
				 " - " + url2.GetRef());
			Println(url1.GetHost().GetHashCode() + " - " + url1.GetDefaultPort() + " - " + url1
				.GetFile().GetHashCode() + " - " + url1.GetRef());
			Println(url2.GetHost().GetHashCode() + " - " + url2.GetDefaultPort() + " - " + url2
				.GetFile().GetHashCode() + " - " + url2.GetRef());
			NeoDatis.Odb.ODB odb = Open(Name);
			odb.Store(url1);
			odb.Store(url2);
			odb.Close();
			odb = Open(Name);
			NeoDatis.Odb.Objects l = odb.GetObjects(typeof(Java.Net.URL));
			odb.Close();
			if (testNewFeature)
			{
				AssertEquals("Same HashCode Problem", 2, l.Count);
			}
		}